@@ -13,12 +13,14 @@ import '../api/route/channels.dart';
1313import '../api/route/messages.dart' ;
1414import '../generated/l10n/zulip_localizations.dart' ;
1515import '../model/binding.dart' ;
16+ import '../model/content.dart' ;
1617import '../model/emoji.dart' ;
1718import '../model/internal_link.dart' ;
1819import '../model/narrow.dart' ;
1920import 'actions.dart' ;
2021import 'color.dart' ;
2122import 'compose_box.dart' ;
23+ import 'content.dart' ;
2224import 'dialog.dart' ;
2325import 'emoji.dart' ;
2426import 'emoji_reaction.dart' ;
@@ -34,6 +36,8 @@ import 'topic_list.dart';
3436void _showActionSheet (
3537 BuildContext pageContext, {
3638 required List <Widget > optionButtons,
39+ Widget ? header,
40+ Color ? headerBackgroundColor,
3741}) {
3842 // Could omit this if we need _showActionSheet outside a per-account context.
3943 final store = PerAccountStoreWidget .of (pageContext);
@@ -57,15 +61,33 @@ void _showActionSheet(
5761 child: Column (
5862 mainAxisSize: MainAxisSize .min,
5963 children: [
60- SizedBox (height: 8 ),
64+ if (header != null )
65+ Flexible (
66+ // TODO(upstream) Enforce a flex ratio (e.g. 1:3)
67+ // only when the header height plus the buttons' height
68+ // exceeds available space. Otherwise let one or the other
69+ // grow to fill available space even if it breaks the ratio.
70+ // Needs support for separate properties like `flex-grow`
71+ // and `flex-shrink`.
72+ flex: 1 ,
73+ child: InsetShadowBox (
74+ top: 8 , bottom: 8 ,
75+ color: designVariables.bgContextMenu,
76+ child: SingleChildScrollView (
77+ padding: EdgeInsets .symmetric (vertical: 8 ),
78+ child: ColoredBox (
79+ color: headerBackgroundColor ?? Colors .transparent,
80+ child: header))))
81+ else
82+ SizedBox (height: 8 ),
6183 Flexible (
84+ flex: 3 ,
6285 child: Padding (
6386 padding: const EdgeInsets .fromLTRB (16 , 0 , 16 , 0 ),
6487 child: Column (
6588 crossAxisAlignment: CrossAxisAlignment .stretch,
6689 mainAxisSize: MainAxisSize .min,
6790 children: [
68- // TODO(#217): show message text
6991 Flexible (child: InsetShadowBox (
7092 top: 8 , bottom: 8 ,
7193 color: designVariables.bgContextMenu,
@@ -616,7 +638,42 @@ void showMessageActionSheet({required BuildContext context, required Message mes
616638 EditButton (message: message, pageContext: pageContext),
617639 ];
618640
619- _showActionSheet (pageContext, optionButtons: optionButtons);
641+ _showActionSheet (pageContext,
642+ optionButtons: optionButtons,
643+ header: _MessageActionSheetHeader (message: message));
644+ }
645+
646+ class _MessageActionSheetHeader extends StatelessWidget {
647+ const _MessageActionSheetHeader ({required this .message});
648+
649+ final Message message;
650+
651+ @override
652+ Widget build (BuildContext context) {
653+ final designVariables = DesignVariables .of (context);
654+
655+ // TODO this seems to lose the hero animation when opening an image;
656+ // investigate.
657+ // TODO should we close the sheet before opening a narrow link?
658+ // On popping the pushed narrow route, the sheet is still open.
659+
660+ return Container (
661+ // TODO(#647) use different color for highlighted messages
662+ // TODO(#681) use different color for DM messages
663+ color: designVariables.bgMessageRegular,
664+ padding: EdgeInsets .symmetric (vertical: 4 ),
665+ child: Column (
666+ mainAxisSize: MainAxisSize .max,
667+ spacing: 4 ,
668+ children: [
669+ SenderRow (message: message, showTimestamp: true ),
670+ Padding (
671+ padding: const EdgeInsets .symmetric (horizontal: 16 ),
672+ // TODO(#10) offer text selection; the Figma asks for it here:
673+ // https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3483-30210&m=dev
674+ child: MessageContent (message: message, content: parseMessageContent (message))),
675+ ]));
676+ }
620677}
621678
622679abstract class MessageActionSheetMenuItemButton extends ActionSheetMenuItemButton {
0 commit comments