Skip to content

Commit 6e59307

Browse files
committed
compose [nfc]: Make _ComposeBoxContainer accept children
This gives the control over the SafeArea padding to the callers. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 82c3c69 commit 6e59307

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

lib/widgets/compose_box.dart

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,9 @@ class _SendButtonState extends State<_SendButton> {
10731073
}
10741074

10751075
class _ComposeBoxContainer extends StatelessWidget {
1076-
const _ComposeBoxContainer({required this.child});
1076+
const _ComposeBoxContainer({required this.children});
10771077

1078-
final Widget child;
1078+
final List<Widget> children;
10791079

10801080
@override
10811081
Widget build(BuildContext context) {
@@ -1088,8 +1088,7 @@ class _ComposeBoxContainer extends StatelessWidget {
10881088
border: Border(top: BorderSide(color: designVariables.borderBar))),
10891089
child: Material(
10901090
color: designVariables.composeBoxBg,
1091-
child: SafeArea(minimum: const EdgeInsets.symmetric(horizontal: 8),
1092-
child: child)));
1091+
child: Column(children: children)));
10931092
}
10941093
}
10951094

@@ -1133,24 +1132,28 @@ class _ComposeBoxLayout extends StatelessWidget {
11331132
return IconButtonTheme(
11341133
data: iconButtonThemeData,
11351134
child: _ComposeBoxContainer(
1136-
child: Column(children: [
1137-
Padding(
1138-
padding: const EdgeInsets.symmetric(horizontal: 8),
1139-
child: Theme(
1140-
data: inputThemeData,
1141-
child: Column(children: [
1142-
if (topicInput != null) topicInput!,
1143-
contentInput,
1144-
]))),
1145-
SizedBox(
1146-
height: _composeButtonSize,
1147-
child: Row(
1148-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1149-
children: [
1150-
composeButtonBar,
1151-
sendButton,
1152-
])),
1153-
])));
1135+
children: [
1136+
SafeArea(
1137+
minimum: const EdgeInsets.symmetric(horizontal: 8),
1138+
child: Column(children: [
1139+
Padding(
1140+
padding: const EdgeInsets.symmetric(horizontal: 8),
1141+
child: Theme(
1142+
data: inputThemeData,
1143+
child: Column(children: [
1144+
if (topicInput != null) topicInput!,
1145+
contentInput,
1146+
]))),
1147+
SizedBox(
1148+
height: _composeButtonSize,
1149+
child: Row(
1150+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
1151+
children: [
1152+
composeButtonBar,
1153+
sendButton,
1154+
])),
1155+
])),
1156+
]));
11541157
}
11551158
}
11561159

@@ -1363,7 +1366,10 @@ class ComposeBox extends StatelessWidget {
13631366
Widget build(BuildContext context) {
13641367
final errorBanner = _errorBanner(context);
13651368
if (errorBanner != null) {
1366-
return _ComposeBoxContainer(child: errorBanner);
1369+
return _ComposeBoxContainer(children: [
1370+
SafeArea(minimum: const EdgeInsets.symmetric(horizontal: 8),
1371+
child: errorBanner)
1372+
]);
13671373
}
13681374

13691375
final narrow = this.narrow;

0 commit comments

Comments
 (0)