Skip to content

Commit 6202186

Browse files
committed
compose [nfc]: Bring _ComposeBoxContainer out of _ComposeBoxBody
Now, _ComposeBoxContainer is available as a nice place to put things other than the "body" that (unlike the body) will want to consume the left and right insets. Specifically, for zulip#720, an error banner and an overlaid progress indicator. Next, we'll rename `_ComposeBoxContainer.child` to `body`. We'll also go ahead and add a param for the error banner, redesign the error banner that we currently have and are passing as `child` / `body`, and pass the banner as that new param instead.
1 parent 132d7ef commit 6202186

File tree

1 file changed

+26
-24
lines changed

1 file changed

+26
-24
lines changed

lib/widgets/compose_box.dart

+26-24
Original file line numberDiff line numberDiff line change
@@ -1073,27 +1073,26 @@ abstract class _ComposeBoxBody extends StatelessWidget {
10731073
];
10741074

10751075
final topicInput = this.topicInput();
1076-
return _ComposeBoxContainer(
1077-
child: Column(children: [
1078-
Padding(
1079-
padding: const EdgeInsets.symmetric(horizontal: 8),
1080-
child: Theme(
1081-
data: inputThemeData,
1082-
child: Column(children: [
1083-
if (topicInput != null) topicInput,
1084-
contentInput(),
1076+
return Column(children: [
1077+
Padding(
1078+
padding: const EdgeInsets.symmetric(horizontal: 8),
1079+
child: Theme(
1080+
data: inputThemeData,
1081+
child: Column(children: [
1082+
if (topicInput != null) topicInput,
1083+
contentInput(),
1084+
]))),
1085+
SizedBox(
1086+
height: _composeButtonSize,
1087+
child: IconButtonTheme(
1088+
data: iconButtonThemeData,
1089+
child: Row(
1090+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1091+
children: [
1092+
Row(children: composeButtons),
1093+
sendButton(),
10851094
]))),
1086-
SizedBox(
1087-
height: _composeButtonSize,
1088-
child: IconButtonTheme(
1089-
data: iconButtonThemeData,
1090-
child: Row(
1091-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1092-
children: [
1093-
Row(children: composeButtons),
1094-
sendButton(),
1095-
]))),
1096-
]));
1095+
]);
10971096
}
10981097
}
10991098

@@ -1298,24 +1297,27 @@ class _ComposeBoxState extends State<ComposeBox> implements ComposeBoxState {
12981297
}
12991298

13001299
final narrow = widget.narrow;
1300+
final Widget body;
13011301
switch (narrow) {
13021302
case ChannelNarrow():
13031303
assert(_controller is StreamComposeBoxController);
1304-
return _StreamComposeBoxBody(controller: (_controller as StreamComposeBoxController),
1304+
body = _StreamComposeBoxBody(controller: (_controller as StreamComposeBoxController),
13051305
narrow: narrow);
13061306
case TopicNarrow():
13071307
assert(_controller is FixedDestinationComposeBoxController);
1308-
return _FixedDestinationComposeBoxBody(controller: (_controller as FixedDestinationComposeBoxController),
1308+
body = _FixedDestinationComposeBoxBody(controller: (_controller as FixedDestinationComposeBoxController),
13091309
narrow: narrow);
13101310
case DmNarrow():
13111311
assert(_controller is FixedDestinationComposeBoxController);
1312-
return _FixedDestinationComposeBoxBody(controller: (_controller as FixedDestinationComposeBoxController),
1312+
body = _FixedDestinationComposeBoxBody(controller: (_controller as FixedDestinationComposeBoxController),
13131313
narrow: narrow);
13141314
case CombinedFeedNarrow():
13151315
case MentionsNarrow():
13161316
case StarredMessagesNarrow():
13171317
assert(false);
1318-
return const SizedBox.shrink();
1318+
body = const SizedBox.shrink();
13191319
}
1320+
1321+
return _ComposeBoxContainer(child: body);
13201322
}
13211323
}

0 commit comments

Comments
 (0)