Skip to content

Commit 6d1f026

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 #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 6169311 commit 6d1f026

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 = buildTopicInput();
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-
buildContentInput(),
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+
buildContentInput(),
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+
buildSendButton(),
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-
buildSendButton(),
1095-
]))),
1096-
]));
1095+
]);
10971096
}
10981097
}
10991098

@@ -1298,21 +1297,24 @@ 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
_controller as StreamComposeBoxController;
1304-
return _StreamComposeBoxBody(controller: _controller, narrow: narrow);
1304+
body = _StreamComposeBoxBody(controller: _controller, narrow: narrow);
13051305
case TopicNarrow():
13061306
_controller as FixedDestinationComposeBoxController;
1307-
return _FixedDestinationComposeBoxBody(controller: _controller, narrow: narrow);
1307+
body = _FixedDestinationComposeBoxBody(controller: _controller, narrow: narrow);
13081308
case DmNarrow():
13091309
_controller as FixedDestinationComposeBoxController;
1310-
return _FixedDestinationComposeBoxBody(controller: _controller, narrow: narrow);
1310+
body = _FixedDestinationComposeBoxBody(controller: _controller, narrow: narrow);
13111311
case CombinedFeedNarrow():
13121312
case MentionsNarrow():
13131313
case StarredMessagesNarrow():
13141314
assert(false);
1315-
return const SizedBox.shrink();
1315+
body = const SizedBox.shrink();
13161316
}
1317+
1318+
return _ComposeBoxContainer(child: body);
13171319
}
13181320
}

0 commit comments

Comments
 (0)