@@ -149,25 +149,23 @@ class MessageListPage extends StatelessWidget {
149
149
Widget build (BuildContext context) {
150
150
return Scaffold (
151
151
appBar: AppBar (title: const Text ("All messages" )),
152
- body: Center (
153
- child: Column (children: [
154
- MediaQuery .removePadding (
155
- context: context,
156
-
157
- // The app bar pads the top inset. (If `context` were for a
158
- // location under Scaffold's `body`, we wouldn't have to
159
- // `removeTop`. Scaffold, which knows about the app bar,
160
- // already applies `removeTop` on `body`:
161
- // https://github.com/flutter/flutter/blob/3.7.0-1.2.pre/packages/flutter/lib/src/material/scaffold.dart#L2778
162
- // )
163
- removeTop: true ,
164
-
165
- // The compose box pads the bottom inset.
166
- removeBottom: true ,
167
-
168
- child: const Expanded (child: MessageList ())),
169
- const SizedBox (
170
- height: 80 ,
171
- child: Center (child: Text ("(Compose box goes here.)" )))])));
152
+ body: Builder (
153
+ builder: (BuildContext context) => Center (
154
+ child: Column (children: [
155
+ MediaQuery .removePadding (
156
+ // Scaffold knows about the app bar, and so has run this
157
+ // BuildContext, which is under `body`, through
158
+ // MediaQuery.removePadding with `removeTop: true`.
159
+ context: context,
160
+
161
+ // The compose box pads the bottom inset.
162
+ removeBottom: true ,
163
+
164
+ child: const Expanded (
165
+ child: MessageList ())),
166
+ const SizedBox (
167
+ height: 80 ,
168
+ child: Center (
169
+ child: Text ("(Compose box goes here.)" )))]))));
172
170
}
173
171
}
0 commit comments