@@ -46,13 +46,7 @@ void _showActionSheet(
4646 Widget ? header,
4747 required List <List <Widget >> buttonSections,
4848}) {
49- // This assert does look absurd, but see dartdoc -- [BottomSheetHeader] adds
50- // vertical padding to position itself on the sheet, so isn't suitable here.
51- // When it grows a param to omit that padding, soon, it'll be usable here.
52- // (Currently the only caller that passes `header` is the message action sheet,
53- // and that header widget only adds internal padding, on a distinct-colored
54- // surface, not padding for positioning.)
55- assert (header is ! BottomSheetHeader );
49+ assert (header is ! BottomSheetHeader || ! header.outerVerticalPadding);
5650
5751 // Could omit this if we need _showActionSheet outside a per-account context.
5852 final accountId = PerAccountStoreWidget .accountIdOf (pageContext);
@@ -128,6 +122,9 @@ typedef WidgetBuilderFromTextStyle = Widget Function(TextStyle);
128122/// The "build" params support richer content, such as [TextWithLink] ,
129123/// and the callback is passed a [TextStyle] which is the base style.
130124///
125+ /// To add outer vertical padding to position the header on the sheet,
126+ /// pass true for [outerVerticalPadding] .
127+ ///
131128/// Figma; just message no title:
132129/// https://www.figma.com/design/1JTNtYo9memgW7vV6d0ygq/Zulip-Mobile?node-id=3481-26993&m=dev
133130///
@@ -145,6 +142,7 @@ class BottomSheetHeader extends StatelessWidget {
145142 this .buildTitle,
146143 this .message,
147144 this .buildMessage,
145+ this .outerVerticalPadding = false ,
148146 }) : assert (message == null || buildMessage == null ),
149147 assert (title == null || buildTitle == null ),
150148 assert ((message != null || buildMessage != null )
@@ -154,6 +152,7 @@ class BottomSheetHeader extends StatelessWidget {
154152 final Widget Function (TextStyle )? buildTitle;
155153 final String ? message;
156154 final Widget Function (TextStyle )? buildMessage;
155+ final bool outerVerticalPadding;
157156
158157 @override
159158 Widget build (BuildContext context) {
@@ -182,12 +181,20 @@ class BottomSheetHeader extends StatelessWidget {
182181 _ => null ,
183182 };
184183
185- return Padding (
186- padding: EdgeInsets .fromLTRB ( 16 , 16 , 16 , 4 ),
184+ Widget result = Padding (
185+ padding: EdgeInsets .symmetric (horizontal : 16 ),
187186 child: Column (
188187 crossAxisAlignment: CrossAxisAlignment .stretch,
189188 spacing: 8 ,
190189 children: [? effectiveTitle, ? effectiveMessage]));
190+
191+ if (outerVerticalPadding) {
192+ result = Padding (
193+ padding: EdgeInsets .only (top: 16 , bottom: 4 ),
194+ child: result);
195+ }
196+
197+ return result;
191198 }
192199}
193200
0 commit comments