Skip to content

Commit 39870b7

Browse files
committed
Document Example #2
- Improve wording.
1 parent eba4dd1 commit 39870b7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/main.dart

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class MyApp extends StatelessWidget {
1414
@override
1515
Widget build(BuildContext context) {
1616
return MaterialApp(
17-
// Make breakpoint values accessible throughout the app by wrapping the
18-
// app with a builder method.
17+
// Wrapping the app with a builder method makes breakpoints
18+
// accessible throughout the widget tree.
1919
builder: (context, child) => ResponsiveBreakpoints.builder(
2020
child: child!,
2121
breakpoints: [
@@ -26,25 +26,28 @@ class MyApp extends StatelessWidget {
2626
],
2727
),
2828
initialRoute: '/',
29-
// The following code demonstrates an implementation of the AutoScale functionality
30-
// of ResponsiveScaledBox. The ResponsiveScaledBox widget preserves
29+
// The following code implements the legacy ResponsiveWrapper AutoScale functionality
30+
// using the new ResponsiveScaledBox. The ResponsiveScaledBox widget preserves
3131
// the legacy ResponsiveWrapper behavior, scaling the UI instead of resizing.
32+
//
33+
// A ConditionalRouteWidget is used to showcase how to disable the AutoScale
34+
// behavior for a page.
3235
onGenerateRoute: (RouteSettings settings) {
3336
// A custom `fadeThrough` route transition animation.
3437
return Routes.fadeThrough(settings, (context) {
3538
// Wrap widgets with another widget based on the route.
36-
// Wrap the page with ResponsiveScaledBox on desired pages.
39+
// Wrap the page with the ResponsiveScaledBox for desired pages.
3740
return ConditionalRouteWidget(
3841
routesExcluded: const [
3942
TypographyPage.name
40-
], // An example of excluding a page from AutoScale.
43+
], // Excluding a page from AutoScale.
4144
builder: (context, child) => MaxWidthBox(
4245
// A widget that limits the maximum width.
4346
// This is used to create a gutter area on either side of the content.
4447
maxWidth: 1200,
4548
background: Container(color: const Color(0xFFF5F5F5)),
4649
child: ResponsiveScaledBox(
47-
// ResponsiveScaledBox renders it's child with a FittedBox set to the `width` value.
50+
// ResponsiveScaledBox renders its child with a FittedBox set to the `width` value.
4851
// Set the fixed width value based on the active breakpoint.
4952
width: ResponsiveValue<double>(context,
5053
conditionalValues: [
@@ -53,7 +56,8 @@ class MyApp extends StatelessWidget {
5356
start: 800, end: 1100, value: 800),
5457
const Condition.between(
5558
start: 1000, end: 1200, value: 1000),
56-
// Because the `maxWidth` is set to 1200 via the MaxWidthBox, the layout cannot expand over 1200px.
59+
// There are no conditions for width over 1200
60+
// because the `maxWidth` is set to 1200 via the MaxWidthBox.
5761
]).value,
5862
child: child!),
5963
),

0 commit comments

Comments
 (0)