Skip to content

Commit

Permalink
TW-1369: Handle show bottom sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui authored and hoangdat committed Mar 14, 2024
1 parent 52081fb commit 23624b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BottomMenuWeb extends StatelessWidget {
icon: Icon(
Icons.close,
color: Theme.of(context).colorScheme.onSurfaceVariant,
size: 20,
size: PinnedMessagesStyle.bottomMenuCloseButtonSize,
),
),
Text(
Expand Down
25 changes: 24 additions & 1 deletion lib/pages/chat/chat_pinned_events/pinned_messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:fluffychat/pages/chat/context_item_chat_action.dart';
import 'package:fluffychat/presentation/extensions/event_update_extension.dart';
import 'package:fluffychat/presentation/model/forward/forward_argument.dart';
import 'package:fluffychat/resource/image_paths.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/extension/build_context_extension.dart';
import 'package:fluffychat/utils/extension/value_notifier_extension.dart';
import 'package:fluffychat/utils/localized_exception_extension.dart';
Expand Down Expand Up @@ -189,6 +190,25 @@ class PinnedMessagesController extends State<PinnedMessages>
}
}

void onLongPressMessage(BuildContext context, Event event) {
if (PinnedMessagesStyle.responsiveUtils.isMobile(context)) {
_showMessageBottomSheet(event);
}
}

void _showMessageBottomSheet(Event event) async {
await showAdaptiveBottomSheet(
context: context,
showDragHandle: true,
builder: (context) {
return Column(
mainAxisSize: MainAxisSize.min,
children: pinnedMessagesActionsList(context, event),
);
},
);
}

void _initPinnedEvents() {
if (widget.pinnedEvents.isNotEmpty) {
_updateEventsNotifier(widget.pinnedEvents);
Expand Down Expand Up @@ -274,7 +294,10 @@ class PinnedMessagesController extends State<PinnedMessages>
isSelected: isSelected(event),
),
iconAction: action.getIconData(unpin: event.isPinned),
imagePath: action.getImagePath(),
imagePath: action.getImagePath(unpin: event.isPinned),
colorIcon: action == ChatContextMenuActions.pinChat && event.isPinned
? Theme.of(context).colorScheme.onSurface
: null,
onCallbackAction: () => _handleClickOnContextMenuItem(
action,
event,
Expand Down

0 comments on commit 23624b3

Please sign in to comment.