diff --git a/src/codelabs/layout-basics.md b/src/codelabs/layout-basics.md index fd4ec1e968..632bf24c5f 100644 --- a/src/codelabs/layout-basics.md +++ b/src/codelabs/layout-basics.md @@ -93,11 +93,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -123,7 +123,7 @@ Future main() async { final columns = controller.widgetList(find.byType(Column)); - if (columns.length == 0) { + if (columns.isEmpty) { _result(false, ['The Row contains three BlueBox widgets and lays them out horizontally.']); return; } @@ -235,11 +235,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -263,7 +263,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find Row!']); return; } @@ -377,11 +377,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -404,7 +404,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -551,11 +551,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -579,7 +579,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -712,11 +712,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -740,7 +740,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -870,11 +870,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -898,7 +898,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1028,11 +1028,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1056,7 +1056,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1160,11 +1160,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1188,7 +1188,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1301,11 +1301,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1329,7 +1329,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1469,11 +1469,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1497,7 +1497,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1616,11 +1616,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1644,7 +1644,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1741,11 +1741,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1769,7 +1769,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1858,11 +1858,11 @@ class MyApp extends StatelessWidget { return Directionality( textDirection: TextDirection.ltr, child: Container( - color: Color(0xffeeeeee), + color: const Color(0xffeeeeee), child: Center( child: Container( child: MyWidget(), - color: Color(0xffcccccc), + color: const Color(0xffcccccc), ), ), ), @@ -1886,7 +1886,7 @@ Future main() async { final rows = controller.widgetList(find.byType(Row)); - if (rows.length == 0) { + if (rows.isEmpty) { _result(false, ['Couldn\'t find a Row!']); return; } @@ -1997,7 +1997,7 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ); } @@ -2010,8 +2010,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( - scaffoldBackgroundColor: Color(0xffeeeeee), - textTheme: TextTheme( + scaffoldBackgroundColor: const Color(0xffeeeeee), + textTheme: const TextTheme( bodyText2: TextStyle( fontSize: 16, ), @@ -2023,9 +2023,9 @@ class MyApp extends StatelessWidget { child: Center( child: Container( decoration: BoxDecoration( - color: Color(0xffffffff), + color: const Color(0xffffffff), border: Border.all(), - boxShadow: [ + boxShadow: const [ BoxShadow( blurRadius: 10, color: Color(0x80000000), @@ -2160,7 +2160,7 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ); } @@ -2176,8 +2176,8 @@ class MyWidget extends StatelessWidget { Widget build(BuildContext context) { return Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -2188,7 +2188,7 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], @@ -2203,8 +2203,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( - scaffoldBackgroundColor: Color(0xffeeeeee), - textTheme: TextTheme( + scaffoldBackgroundColor: const Color(0xffeeeeee), + textTheme: const TextTheme( bodyText2: TextStyle( fontSize: 16, ), @@ -2216,9 +2216,9 @@ class MyApp extends StatelessWidget { child: Center( child: Container( decoration: BoxDecoration( - color: Color(0xffffffff), + color: const Color(0xffffffff), border: Border.all(), - boxShadow: [ + boxShadow: const [ BoxShadow( blurRadius: 10, color: Color(0x80000000), @@ -2392,8 +2392,8 @@ class MyWidget extends StatelessWidget { Widget build(BuildContext context) { return Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -2404,7 +2404,7 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], @@ -2426,8 +2426,8 @@ class MyWidget extends StatelessWidget { children: [ Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -2438,14 +2438,14 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row(), - SizedBox(height: 16), + const SizedBox(height: 16), Row(), ], ); @@ -2459,8 +2459,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( - scaffoldBackgroundColor: Color(0xffeeeeee), - textTheme: TextTheme( + scaffoldBackgroundColor: const Color(0xffeeeeee), + textTheme: const TextTheme( bodyText2: TextStyle( fontSize: 16, ), @@ -2472,9 +2472,9 @@ class MyApp extends StatelessWidget { child: Center( child: Container( decoration: BoxDecoration( - color: Color(0xffffffff), + color: const Color(0xffffffff), border: Border.all(), - boxShadow: [ + boxShadow: const [ BoxShadow( blurRadius: 10, color: Color(0x80000000), @@ -2681,7 +2681,7 @@ class MyWidget extends StatelessWidget { children: [ Row( children: [ - Padding( + const Padding( padding: const EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), @@ -2693,18 +2693,18 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( - children: [], + children: const [], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( - children: [], + children: const [], ), ], ); @@ -2725,8 +2725,8 @@ class MyWidget extends StatelessWidget { children: [ Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -2737,15 +2737,15 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: const [ Text( '123 Main Street', ), @@ -2754,9 +2754,9 @@ class MyWidget extends StatelessWidget { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( - children: [], + children: const [], ), ], ); @@ -2770,8 +2770,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( - scaffoldBackgroundColor: Color(0xffeeeeee), - textTheme: TextTheme( + scaffoldBackgroundColor: const Color(0xffeeeeee), + textTheme: const TextTheme( bodyText2: TextStyle( fontSize: 16, ), @@ -2783,9 +2783,9 @@ class MyApp extends StatelessWidget { child: Center( child: Container( decoration: BoxDecoration( - color: Color(0xffffffff), + color: const Color(0xffffffff), border: Border.all(), - boxShadow: [ + boxShadow: const [ BoxShadow( blurRadius: 10, color: Color(0x80000000), @@ -3012,8 +3012,8 @@ class MyWidget extends StatelessWidget { children: [ Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -3024,22 +3024,22 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: const [ Text('123 Main Street'), Text('415-555-0198'), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( - children: [], + children: const [], ), ], ); @@ -3060,8 +3060,8 @@ class MyWidget extends StatelessWidget { children: [ Row( children: [ - Padding( - padding: const EdgeInsets.all(8.0), + const Padding( + padding: EdgeInsets.all(8.0), child: Icon(Icons.account_circle, size: 50), ), Column( @@ -3072,15 +3072,15 @@ class MyWidget extends StatelessWidget { 'Flutter McFlutter', style: Theme.of(context).textTheme.headline5, ), - Text('Experienced App Developer'), + const Text('Experienced App Developer'), ], ), ], ), - SizedBox(height: 8), + const SizedBox(height: 8), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ + children: const [ Text( '123 Main Street', ), @@ -3089,10 +3089,10 @@ class MyWidget extends StatelessWidget { ), ], ), - SizedBox(height: 16), + const SizedBox(height: 16), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ + children: const [ Icon(Icons.accessibility), Icon(Icons.timer), Icon(Icons.phone_android), @@ -3111,8 +3111,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( - scaffoldBackgroundColor: Color(0xffeeeeee), - textTheme: TextTheme( + scaffoldBackgroundColor: const Color(0xffeeeeee), + textTheme: const TextTheme( bodyText2: TextStyle( fontSize: 16, ), @@ -3124,9 +3124,9 @@ class MyApp extends StatelessWidget { child: Center( child: Container( decoration: BoxDecoration( - color: Color(0xffffffff), + color: const Color(0xffffffff), border: Border.all(), - boxShadow: [ + boxShadow: const [ BoxShadow( blurRadius: 10, color: Color(0x80000000),