mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-06 18:24:42 +08:00
bugfixes. (#169)
This commit is contained in:
@ -47,13 +47,14 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
|
|||||||
state.copyWith(
|
state.copyWith(
|
||||||
isLoggedIn: true,
|
isLoggedIn: true,
|
||||||
user: user,
|
user: user,
|
||||||
|
status: AuthStatus.loaded,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
emit(
|
emit(
|
||||||
state.copyWith(
|
state.copyWith(
|
||||||
status: AuthStatus.loaded,
|
|
||||||
isLoggedIn: false,
|
isLoggedIn: false,
|
||||||
|
status: AuthStatus.loaded,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import 'package:hacki/models/item/item.dart';
|
|||||||
import 'package:hacki/screens/screens.dart';
|
import 'package:hacki/screens/screens.dart';
|
||||||
import 'package:hacki/screens/widgets/widgets.dart';
|
import 'package:hacki/screens/widgets/widgets.dart';
|
||||||
import 'package:hacki/styles/styles.dart';
|
import 'package:hacki/styles/styles.dart';
|
||||||
import 'package:hacki/utils/link_util.dart';
|
|
||||||
|
|
||||||
class ReplyBox extends StatefulWidget {
|
class ReplyBox extends StatefulWidget {
|
||||||
const ReplyBox({
|
const ReplyBox({
|
||||||
@ -256,6 +255,8 @@ class _ReplyBoxState extends State<ReplyBox> {
|
|||||||
void showTextPopup() {
|
void showTextPopup() {
|
||||||
final Item? replyingTo = context.read<EditCubit>().state.replyingTo;
|
final Item? replyingTo = context.read<EditCubit>().state.replyingTo;
|
||||||
|
|
||||||
|
if (replyingTo == null) return;
|
||||||
|
|
||||||
showDialog<void>(
|
showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
@ -280,13 +281,20 @@ class _ReplyBoxState extends State<ReplyBox> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
replyingTo?.by ?? '',
|
replyingTo.by,
|
||||||
style: const TextStyle(color: Palette.grey),
|
style: const TextStyle(
|
||||||
|
fontSize: TextDimens.pt14,
|
||||||
|
color: Palette.grey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (replyingTo != null)
|
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('View thread'),
|
child: const Text(
|
||||||
|
'View thread',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: TextDimens.pt14,
|
||||||
|
),
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticFeedback.lightImpact();
|
HapticFeedback.lightImpact();
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -308,9 +316,14 @@ class _ReplyBoxState extends State<ReplyBox> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('Copy all'),
|
child: const Text(
|
||||||
|
'Copy all',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: TextDimens.pt14,
|
||||||
|
),
|
||||||
|
),
|
||||||
onPressed: () => FlutterClipboard.copy(
|
onPressed: () => FlutterClipboard.copy(
|
||||||
replyingTo?.text ?? '',
|
replyingTo.text,
|
||||||
).then((_) => HapticFeedback.selectionClick()),
|
).then((_) => HapticFeedback.selectionClick()),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
@ -334,17 +347,8 @@ class _ReplyBoxState extends State<ReplyBox> {
|
|||||||
top: Dimens.pt6,
|
top: Dimens.pt6,
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: SelectableLinkify(
|
child: ItemText(
|
||||||
scrollPhysics: const NeverScrollableScrollPhysics(),
|
item: replyingTo,
|
||||||
textScaleFactor:
|
|
||||||
MediaQuery.of(context).textScaleFactor,
|
|
||||||
linkStyle: const TextStyle(
|
|
||||||
fontSize: TextDimens.pt15,
|
|
||||||
color: Palette.orange,
|
|
||||||
),
|
|
||||||
onOpen: (LinkableElement link) =>
|
|
||||||
LinkUtil.launch(link.url),
|
|
||||||
text: replyingTo?.text ?? '',
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -250,7 +250,7 @@ class CommentTile extends StatelessWidget {
|
|||||||
final Color commentColor = prefState.eyeCandyEnabled
|
final Color commentColor = prefState.eyeCandyEnabled
|
||||||
? color.withOpacity(commentBackgroundColorOpacity)
|
? color.withOpacity(commentBackgroundColorOpacity)
|
||||||
: Palette.transparent;
|
: Palette.transparent;
|
||||||
final bool isMyComment =
|
final bool isMyComment = comment.deleted == false &&
|
||||||
context.read<AuthBloc>().state.username == comment.by;
|
context.read<AuthBloc>().state.username == comment.by;
|
||||||
|
|
||||||
Widget wrapper = child;
|
Widget wrapper = child;
|
||||||
|
@ -181,7 +181,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||||||
this.cursorHeight,
|
this.cursorHeight,
|
||||||
this.selectionControls,
|
this.selectionControls,
|
||||||
this.onSelectionChanged,
|
this.onSelectionChanged,
|
||||||
this.contextMenuBuilder,
|
this.contextMenuBuilder = _defaultContextMenuBuilder,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Text to be linkified
|
/// Text to be linkified
|
||||||
@ -318,6 +318,15 @@ class SelectableLinkify extends StatelessWidget {
|
|||||||
contextMenuBuilder: contextMenuBuilder,
|
contextMenuBuilder: contextMenuBuilder,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Widget _defaultContextMenuBuilder(
|
||||||
|
BuildContext context,
|
||||||
|
EditableTextState editableTextState,
|
||||||
|
) {
|
||||||
|
return AdaptiveTextSelectionToolbar.editableText(
|
||||||
|
editableTextState: editableTextState,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LinkableSpan extends WidgetSpan {
|
class LinkableSpan extends WidgetSpan {
|
||||||
|
@ -55,6 +55,7 @@ class ItemText extends StatelessWidget {
|
|||||||
style: style,
|
style: style,
|
||||||
linkStyle: linkStyle,
|
linkStyle: linkStyle,
|
||||||
onOpen: (LinkableElement link) => LinkUtil.launch(link.url),
|
onOpen: (LinkableElement link) => LinkUtil.launch(link.url),
|
||||||
|
onTap: onTap,
|
||||||
contextMenuBuilder: (
|
contextMenuBuilder: (
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
EditableTextState editableTextState,
|
EditableTextState editableTextState,
|
||||||
|
Reference in New Issue
Block a user