@@ -19,11 +19,12 @@ import 'package:fluffychat/widgets/matrix.dart';
1919import 'package:fluffychat/widgets/twake_components/twake_icon_button.dart' ;
2020import 'package:flutter/material.dart' ;
2121import 'package:flutter_emoji_mart/flutter_emoji_mart.dart' ;
22+ import 'package:flutter_gen/gen_l10n/l10n.dart' ;
2223import 'package:flutter_svg/flutter_svg.dart' ;
2324import 'package:linagora_design_flutter/linagora_design_flutter.dart' ;
2425import 'package:matrix/matrix.dart' ;
26+ import 'package:overflow_view/overflow_view.dart' ;
2527import 'package:pull_down_button/pull_down_button.dart' ;
26- import 'package:flutter_gen/gen_l10n/l10n.dart' ;
2728
2829typedef ContextMenuBuilder = List <Widget > Function (BuildContext context);
2930
@@ -50,6 +51,8 @@ class MessageContentWithTimestampBuilder extends StatefulWidget {
5051 final void Function (Event )? onForward;
5152 final void Function (Event )? onCopy;
5253 final void Function (Event )? onPin;
54+ final void Function (BuildContext context, Event , TapDownDetails )?
55+ onTapMoreButton;
5356
5457 static final responsiveUtils = getIt.get <ResponsiveUtils >();
5558
@@ -77,6 +80,7 @@ class MessageContentWithTimestampBuilder extends StatefulWidget {
7780 this .onCopy,
7881 this .onLongPressMessage,
7982 this .onPin,
83+ this .onTapMoreButton,
8084 });
8185
8286 @override
@@ -104,6 +108,34 @@ class _MessageContentWithTimestampBuilderState
104108 MessageTypes .BadEncrypted ,
105109 }.contains (widget.event.messageType);
106110
111+ return OverflowView .flexible (
112+ builder: (context, index) {
113+ return _messageContentWithTimestampBuilder (
114+ context: context,
115+ displayTime: displayTime,
116+ noBubble: noBubble,
117+ timelineText: timelineText,
118+ overlayContextMenu: true ,
119+ );
120+ },
121+ children: [
122+ _messageContentWithTimestampBuilder (
123+ context: context,
124+ displayTime: displayTime,
125+ noBubble: noBubble,
126+ timelineText: timelineText,
127+ ),
128+ ],
129+ );
130+ }
131+
132+ Widget _messageContentWithTimestampBuilder ({
133+ required BuildContext context,
134+ required bool displayTime,
135+ required bool noBubble,
136+ required bool timelineText,
137+ bool overlayContextMenu = false ,
138+ }) {
107139 return Row (
108140 mainAxisSize: MainAxisSize .min,
109141 mainAxisAlignment: MessageStyle .messageAlignment (widget.event, context),
@@ -439,7 +471,28 @@ class _MessageContentWithTimestampBuilderState
439471 ),
440472 ),
441473 ),
442- if (widget.event.status.isAvailable) _menuActionsRowBuilder (context),
474+ if (widget.event.status.isAvailable) ...[
475+ if (overlayContextMenu) ...[
476+ Container (
477+ padding: const EdgeInsets .only (left: 8 ),
478+ decoration: BoxDecoration (
479+ color: Colors .transparent,
480+ borderRadius: BorderRadius .circular (24 ),
481+ ),
482+ child: TwakeIconButton (
483+ onTapDown: (tapDownDetails) => widget.onTapMoreButton? .call (
484+ context,
485+ widget.event,
486+ tapDownDetails,
487+ ),
488+ icon: Icons .more_horiz,
489+ tooltip: L10n .of (context)! .more,
490+ preferBelow: false ,
491+ ),
492+ ),
493+ ] else
494+ _menuActionsRowBuilder (context),
495+ ],
443496 ],
444497 );
445498 }
0 commit comments