@@ -13,12 +13,14 @@ import '../api/route/channels.dart';
13
13
import '../api/route/messages.dart' ;
14
14
import '../generated/l10n/zulip_localizations.dart' ;
15
15
import '../model/binding.dart' ;
16
+ import '../model/content.dart' ;
16
17
import '../model/emoji.dart' ;
17
18
import '../model/internal_link.dart' ;
18
19
import '../model/narrow.dart' ;
19
20
import 'actions.dart' ;
20
21
import 'color.dart' ;
21
22
import 'compose_box.dart' ;
23
+ import 'content.dart' ;
22
24
import 'dialog.dart' ;
23
25
import 'emoji.dart' ;
24
26
import 'emoji_reaction.dart' ;
@@ -33,6 +35,7 @@ import 'topic_list.dart';
33
35
34
36
void _showActionSheet (
35
37
BuildContext pageContext, {
38
+ Widget ? header,
36
39
required List <Widget > optionButtons,
37
40
}) {
38
41
// Could omit this if we need _showActionSheet outside a per-account context.
@@ -57,15 +60,31 @@ void _showActionSheet(
57
60
child: Column (
58
61
mainAxisSize: MainAxisSize .min,
59
62
children: [
60
- SizedBox (height: 8 ),
63
+ if (header != null )
64
+ Flexible (
65
+ // TODO(upstream) Enforce a flex ratio (e.g. 1:3)
66
+ // only when the header height plus the buttons' height
67
+ // exceeds available space. Otherwise let one or the other
68
+ // grow to fill available space even if it breaks the ratio.
69
+ // Needs support for separate properties like `flex-grow`
70
+ // and `flex-shrink`.
71
+ flex: 1 ,
72
+ child: InsetShadowBox (
73
+ top: 8 , bottom: 8 ,
74
+ color: designVariables.bgContextMenu,
75
+ child: SingleChildScrollView (
76
+ padding: EdgeInsets .symmetric (vertical: 8 ),
77
+ child: header)))
78
+ else
79
+ SizedBox (height: 8 ),
61
80
Flexible (
81
+ flex: 3 ,
62
82
child: Padding (
63
83
padding: const EdgeInsets .fromLTRB (16 , 0 , 16 , 0 ),
64
84
child: Column (
65
85
crossAxisAlignment: CrossAxisAlignment .stretch,
66
86
mainAxisSize: MainAxisSize .min,
67
87
children: [
68
- // TODO(#217): show message text
69
88
Flexible (child: InsetShadowBox (
70
89
top: 8 , bottom: 8 ,
71
90
color: designVariables.bgContextMenu,
@@ -621,7 +640,42 @@ void showMessageActionSheet({required BuildContext context, required Message mes
621
640
EditButton (message: message, pageContext: pageContext),
622
641
];
623
642
624
- _showActionSheet (pageContext, optionButtons: optionButtons);
643
+ _showActionSheet (pageContext,
644
+ optionButtons: optionButtons,
645
+ header: _MessageActionSheetHeader (message: message));
646
+ }
647
+
648
+ class _MessageActionSheetHeader extends StatelessWidget {
649
+ const _MessageActionSheetHeader ({required this .message});
650
+
651
+ final Message message;
652
+
653
+ @override
654
+ Widget build (BuildContext context) {
655
+ final designVariables = DesignVariables .of (context);
656
+
657
+ // TODO this seems to lose the hero animation when opening an image;
658
+ // investigate.
659
+ // TODO should we close the sheet before opening a narrow link?
660
+ // On popping the pushed narrow route, the sheet is still open.
661
+
662
+ return Container (
663
+ // TODO(#647) use different color for highlighted messages
664
+ // TODO(#681) use different color for DM messages
665
+ color: designVariables.bgMessageRegular,
666
+ padding: EdgeInsets .symmetric (vertical: 4 ),
667
+ child: Column (
668
+ spacing: 4 ,
669
+ children: [
670
+ SenderRow (message: message,
671
+ timestampStyle: MessageTimestampStyle .full),
672
+ Padding (
673
+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
674
+ // TODO(#10) offer text selection; the Figma asks for it here:
675
+ // https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3483-30210&m=dev
676
+ child: MessageContent (message: message, content: parseMessageContent (message))),
677
+ ]));
678
+ }
625
679
}
626
680
627
681
abstract class MessageActionSheetMenuItemButton extends ActionSheetMenuItemButton {
0 commit comments