Skip to content

Commit 12666c6

Browse files
committed
Add Back MaxWidthBox
1 parent 4a49d61 commit 12666c6

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lib/main.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,22 @@ class MyApp extends StatelessWidget {
6363
// onGenerateRoute route switcher.
6464
// Navigate using the page name, `Navigator.pushNamed(context, ListPage.name)`.
6565
Widget buildPage(String name) {
66-
switch (name) {
67-
case '/':
68-
case ListPage.name:
69-
return const ListPage();
70-
case PostPage.name:
71-
// Custom "per-page" breakpoints.
72-
return const ResponsiveBreakpoints(breakpoints: [
73-
Breakpoint(start: 0, end: 480, name: MOBILE),
74-
Breakpoint(start: 481, end: 1200, name: TABLET),
75-
Breakpoint(start: 1201, end: double.infinity, name: DESKTOP),
76-
], child: PostPage());
77-
case TypographyPage.name:
78-
return const TypographyPage();
79-
default:
80-
return const SizedBox.shrink();
81-
}
66+
return MaxWidthBox(
67+
// A widget that limits the maximum width.
68+
// This is used to create a gutter area on either side of the content.
69+
maxWidth: 1200,
70+
background: Container(color: const Color(0xFFF5F5F5)),
71+
child: switch (name) {
72+
'/' || ListPage.name => const ListPage(),
73+
PostPage.name =>
74+
// Custom "per-page" breakpoints.
75+
const ResponsiveBreakpoints(breakpoints: [
76+
Breakpoint(start: 0, end: 480, name: MOBILE),
77+
Breakpoint(start: 481, end: 1200, name: TABLET),
78+
Breakpoint(start: 1201, end: double.infinity, name: DESKTOP),
79+
], child: PostPage()),
80+
TypographyPage.name => const TypographyPage(),
81+
_ => const SizedBox.shrink(),
82+
});
8283
}
8384
}

0 commit comments

Comments
 (0)