From 5fbcddd38f7962c76c34f7ba1868b71789428a9a Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Tue, 17 Nov 2020 18:08:07 -0600 Subject: [PATCH 1/5] Scope SnackBars for nested Scaffolds in demo --- lib/demos/material/snackbar_demo.dart | 50 +++++++++++++++------------ 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/lib/demos/material/snackbar_demo.dart b/lib/demos/material/snackbar_demo.dart index e238e7b1b0..bdc0273064 100644 --- a/lib/demos/material/snackbar_demo.dart +++ b/lib/demos/material/snackbar_demo.dart @@ -12,33 +12,39 @@ class SnackbarsDemo extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: Text(GalleryLocalizations.of(context).demoSnackbarsTitle), - ), - body: Center( - child: ElevatedButton( - child: - Text(GalleryLocalizations.of(context).demoSnackbarsButtonLabel), - onPressed: () { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text(GalleryLocalizations.of(context).demoSnackbarsText), - action: SnackBarAction( - label: GalleryLocalizations.of(context) - .demoSnackbarsActionButtonLabel, + return ScaffoldMessenger( + child: Builder( + builder: (context) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Text(GalleryLocalizations.of(context).demoSnackbarsTitle), + ), + body: Center( + child: ElevatedButton( + child: + Text(GalleryLocalizations.of(context).demoSnackbarsButtonLabel), onPressed: () { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - GalleryLocalizations.of(context).demoSnackbarsAction, - ))); + content: Text(GalleryLocalizations.of(context).demoSnackbarsText), + action: SnackBarAction( + label: GalleryLocalizations.of(context) + .demoSnackbarsActionButtonLabel, + onPressed: () { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + GalleryLocalizations.of(context).demoSnackbarsAction, + ))); + }, + ), + )); }, ), - )); - }, - ), + ), + ); + }, ), ); } From f6cf4318520d87aff99ef5e9244075bd01bb5c17 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Fri, 20 Nov 2020 17:03:20 -0600 Subject: [PATCH 2/5] ++ --- lib/codeviewer/code_segments.dart | 201 ++++++++++++++---------- lib/demos/material/dialog_demo.dart | 80 +++++----- lib/demos/material/menu_demo.dart | 23 ++- lib/demos/material/text_field_demo.dart | 5 +- lib/pages/demo.dart | 100 ++++++------ pubspec.lock | 2 +- 6 files changed, 225 insertions(+), 186 deletions(-) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index f7dd1a864a..3870f6ef75 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -20424,23 +20424,29 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Navigator'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan( style: codeStyle.commentStyle, text: '// Adding [ValueKey] to make sure that the widget gets rebuilt when'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.commentStyle, text: '// changing type.'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a key'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a key'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ValueKey'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'type'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a onGenerateRoute'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a onGenerateRoute'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20448,7 +20454,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan( @@ -20456,7 +20462,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '<'), TextSpan(style: codeStyle.keywordStyle, text: 'void'), TextSpan(style: codeStyle.punctuationStyle, text: '>('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20467,19 +20473,19 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'AppBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a automaticallyImplyLeading'), + text: '\u000a automaticallyImplyLeading'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'false'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -20488,19 +20494,20 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ')),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Center'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ElevatedButton'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -20514,13 +20521,14 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: 'dialogShow'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a onPressed'), + style: codeStyle.baseStyle, + text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'switch'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20528,7 +20536,8 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20537,15 +20546,16 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showAlertDialog'), + text: '\u000a _showAlertDialog'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20554,15 +20564,16 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showAlertDialogWithTitle'), + text: '\u000a _showAlertDialogWithTitle'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20571,15 +20582,16 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showSimpleDialog'), + text: '\u000a _showSimpleDialog'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20587,7 +20599,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: 'fullscreen'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Navigator'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'push'), @@ -20596,15 +20608,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '>('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a context'), + text: '\u000a context'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'MaterialPageRoute'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a builder'), + text: '\u000a builder'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20617,35 +20629,37 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '(),'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a fullscreenDialog'), + text: '\u000a fullscreenDialog'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'true'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '}'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -35986,21 +36000,39 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Builder'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'context'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'return'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'AppBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a automaticallyImplyLeading'), + text: '\u000a automaticallyImplyLeading'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'false'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -36013,21 +36045,21 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsTitle'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Center'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ElevatedButton'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), @@ -36038,13 +36070,14 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsButtonLabel'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a onPressed'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36053,7 +36086,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'hideCurrentSnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '();'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36064,7 +36097,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.classStyle, text: 'SnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a content'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a content'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -36077,12 +36112,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsText'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a action'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a action'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'SnackBarAction'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a label'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a label'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), @@ -36091,19 +36129,22 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ')'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan( style: codeStyle.baseStyle, text: 'demoSnackbarsActionButtonLabel'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a onPressed'), + style: codeStyle.baseStyle, + text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36112,7 +36153,8 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'hideCurrentSnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '();'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36125,12 +36167,14 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a content'), + text: '\u000a content'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36139,18 +36183,26 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsAction'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ')));'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '));'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '));'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -36770,8 +36822,13 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'const'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TextFormFieldDemo'), - TextSpan(style: codeStyle.punctuationStyle, text: '(),'), + TextSpan(style: codeStyle.punctuationStyle, text: '()),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -37180,20 +37237,6 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'final'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'GlobalKey'), - TextSpan(style: codeStyle.punctuationStyle, text: '<'), - TextSpan(style: codeStyle.classStyle, text: 'ScaffoldState'), - TextSpan(style: codeStyle.punctuationStyle, text: '>'), - TextSpan(style: codeStyle.baseStyle, text: ' _scaffoldKey '), - TextSpan(style: codeStyle.punctuationStyle, text: '='), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'GlobalKey'), - TextSpan(style: codeStyle.punctuationStyle, text: '<'), - TextSpan(style: codeStyle.classStyle, text: 'ScaffoldState'), - TextSpan(style: codeStyle.punctuationStyle, text: '>();'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.classStyle, text: 'PersonData'), TextSpan(style: codeStyle.baseStyle, text: ' person '), TextSpan(style: codeStyle.punctuationStyle, text: '='), @@ -37619,10 +37662,6 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a key'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _scaffoldKey'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), diff --git a/lib/demos/material/dialog_demo.dart b/lib/demos/material/dialog_demo.dart index 5aa1e05097..428d3e9183 100644 --- a/lib/demos/material/dialog_demo.dart +++ b/lib/demos/material/dialog_demo.dart @@ -124,47 +124,49 @@ class DialogDemo extends StatelessWidget { @override Widget build(BuildContext context) { - return Navigator( - // Adding [ValueKey] to make sure that the widget gets rebuilt when - // changing type. - key: ValueKey(type), - onGenerateRoute: (settings) { - return _NoAnimationMaterialPageRoute( - builder: (context) => Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: Text(_title(context)), - ), - body: Center( - child: ElevatedButton( - child: Text(GalleryLocalizations.of(context).dialogShow), - onPressed: () { - switch (type) { - case DialogDemoType.alert: - _showAlertDialog(context); - break; - case DialogDemoType.alertTitle: - _showAlertDialogWithTitle(context); - break; - case DialogDemoType.simple: - _showSimpleDialog(context); - break; - case DialogDemoType.fullscreen: - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => _FullScreenDialogDemo(), - fullscreenDialog: true, - ), - ); - break; - } - }, + return ScaffoldMessenger( + child: Navigator( + // Adding [ValueKey] to make sure that the widget gets rebuilt when + // changing type. + key: ValueKey(type), + onGenerateRoute: (settings) { + return _NoAnimationMaterialPageRoute( + builder: (context) => Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Text(_title(context)), + ), + body: Center( + child: ElevatedButton( + child: Text(GalleryLocalizations.of(context).dialogShow), + onPressed: () { + switch (type) { + case DialogDemoType.alert: + _showAlertDialog(context); + break; + case DialogDemoType.alertTitle: + _showAlertDialogWithTitle(context); + break; + case DialogDemoType.simple: + _showSimpleDialog(context); + break; + case DialogDemoType.fullscreen: + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => _FullScreenDialogDemo(), + fullscreenDialog: true, + ), + ); + break; + } + }, + ), ), ), - ), - ); - }, + ); + }, + ), ); } } diff --git a/lib/demos/material/menu_demo.dart b/lib/demos/material/menu_demo.dart index b1fc285d7f..403001bc00 100644 --- a/lib/demos/material/menu_demo.dart +++ b/lib/demos/material/menu_demo.dart @@ -36,8 +36,6 @@ class MenuDemo extends StatefulWidget { } class _MenuDemoState extends State { - final GlobalKey _scaffoldKey = GlobalKey(); - void showInSnackBar(String value) { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( @@ -63,16 +61,17 @@ class _MenuDemoState extends State { break; } - return Scaffold( - key: _scaffoldKey, - appBar: AppBar( - title: Text(GalleryLocalizations.of(context).demoMenuTitle), - automaticallyImplyLeading: false, - ), - body: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Center( - child: demo, + return ScaffoldMessenger( + child: Scaffold( + appBar: AppBar( + title: Text(GalleryLocalizations.of(context).demoMenuTitle), + automaticallyImplyLeading: false, + ), + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Center( + child: demo, + ), ), ), ); diff --git a/lib/demos/material/text_field_demo.dart b/lib/demos/material/text_field_demo.dart index 26116171c0..2dd4a41456 100644 --- a/lib/demos/material/text_field_demo.dart +++ b/lib/demos/material/text_field_demo.dart @@ -21,7 +21,7 @@ class TextFieldDemo extends StatelessWidget { automaticallyImplyLeading: false, title: Text(GalleryLocalizations.of(context).demoTextFieldTitle), ), - body: const TextFormFieldDemo(), + body: const ScaffoldMessenger(child: TextFormFieldDemo()), ); } } @@ -102,8 +102,6 @@ class _PasswordFieldState extends State { } class TextFormFieldDemoState extends State { - final GlobalKey _scaffoldKey = GlobalKey(); - PersonData person = PersonData(); void showInSnackBar(String value) { @@ -172,7 +170,6 @@ class TextFormFieldDemoState extends State { const sizedBoxSpace = SizedBox(height: 24); return Scaffold( - key: _scaffoldKey, body: Form( key: _formKey, autovalidateMode: _autoValidateMode, diff --git a/lib/pages/demo.dart b/lib/pages/demo.dart index d0f7da5bc6..1c969d20c4 100644 --- a/lib/pages/demo.dart +++ b/lib/pages/demo.dart @@ -449,60 +449,62 @@ class _GalleryDemoPageState extends State Widget page; if (isDesktop) { - page = AnimatedBuilder( - animation: _codeBackgroundColorController, - builder: (context, child) { - Brightness themeBrightness; - - switch (GalleryOptions.of(context).themeMode) { - case ThemeMode.system: - themeBrightness = MediaQuery.of(context).platformBrightness; - break; - case ThemeMode.light: - themeBrightness = Brightness.light; - break; - case ThemeMode.dark: - themeBrightness = Brightness.dark; - break; - } + page = ScaffoldMessenger( + child: AnimatedBuilder( + animation: _codeBackgroundColorController, + builder: (context, child) { + Brightness themeBrightness; + + switch (GalleryOptions.of(context).themeMode) { + case ThemeMode.system: + themeBrightness = MediaQuery.of(context).platformBrightness; + break; + case ThemeMode.light: + themeBrightness = Brightness.light; + break; + case ThemeMode.dark: + themeBrightness = Brightness.dark; + break; + } - Widget contents = Container( - padding: EdgeInsets.symmetric(horizontal: horizontalPadding), - child: ApplyTextOptions( - child: Scaffold( - appBar: appBar, - body: body, - backgroundColor: Colors.transparent, - ), - ), - ); - - if (themeBrightness == Brightness.light) { - // If it is currently in light mode, add a - // dark background for code. - Widget codeBackground = Container( - padding: const EdgeInsets.only(top: 56), - child: Container( - color: ColorTween( - begin: Colors.transparent, - end: GalleryThemeData.darkThemeData.canvasColor, - ).animate(_codeBackgroundColorController).value, + Widget contents = Container( + padding: EdgeInsets.symmetric(horizontal: horizontalPadding), + child: ApplyTextOptions( + child: Scaffold( + appBar: appBar, + body: body, + backgroundColor: Colors.transparent, + ), ), ); - contents = Stack( - children: [ - codeBackground, - contents, - ], - ); - } + if (themeBrightness == Brightness.light) { + // If it is currently in light mode, add a + // dark background for code. + Widget codeBackground = Container( + padding: const EdgeInsets.only(top: 56), + child: Container( + color: ColorTween( + begin: Colors.transparent, + end: GalleryThemeData.darkThemeData.canvasColor, + ).animate(_codeBackgroundColorController).value, + ), + ); + + contents = Stack( + children: [ + codeBackground, + contents, + ], + ); + } - return Container( - color: colorScheme.background, - child: contents, - ); - }); + return Container( + color: colorScheme.background, + child: contents, + ); + }), + ); } else { page = Container( color: colorScheme.background, diff --git a/pubspec.lock b/pubspec.lock index 1119f72872..38862b5a01 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -658,7 +658,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "5.2.0" + version: "5.5.0" watcher: dependency: transitive description: From 684e1acd0bf4c23d4b69db2344fb51e1e5f46197 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Fri, 20 Nov 2020 17:09:43 -0600 Subject: [PATCH 3/5] One more demo --- lib/pages/demo.dart | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/pages/demo.dart b/lib/pages/demo.dart index 1c969d20c4..4ccd227540 100644 --- a/lib/pages/demo.dart +++ b/lib/pages/demo.dart @@ -506,14 +506,18 @@ class _GalleryDemoPageState extends State }), ); } else { - page = Container( - color: colorScheme.background, - child: ApplyTextOptions( - child: Scaffold( - appBar: appBar, - body: body, - ), - ), + page = Builder( + builder: (context) { + return Container( + color: colorScheme.background, + child: ApplyTextOptions( + child: Scaffold( + appBar: appBar, + body: body, + ), + ), + ); + }, ); } From cc3a506a606bc7fa25f8a12a6e1d80751adf4369 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Fri, 20 Nov 2020 17:58:00 -0600 Subject: [PATCH 4/5] Cleaner fix --- lib/codeviewer/code_segments.dart | 183 ++++++++---------------- lib/demos/material/dialog_demo.dart | 80 +++++------ lib/demos/material/menu_demo.dart | 20 ++- lib/demos/material/snackbar_demo.dart | 50 +++---- lib/demos/material/text_field_demo.dart | 2 +- lib/pages/demo.dart | 136 +++++++++--------- 6 files changed, 201 insertions(+), 270 deletions(-) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index 3870f6ef75..65d753d3ee 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -20424,29 +20424,23 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Navigator'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan( style: codeStyle.commentStyle, text: '// Adding [ValueKey] to make sure that the widget gets rebuilt when'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.commentStyle, text: '// changing type.'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a key'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a key'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ValueKey'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'type'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a onGenerateRoute'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a onGenerateRoute'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20454,7 +20448,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan( @@ -20462,7 +20456,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '<'), TextSpan(style: codeStyle.keywordStyle, text: 'void'), TextSpan(style: codeStyle.punctuationStyle, text: '>('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20473,19 +20467,19 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'AppBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a automaticallyImplyLeading'), + text: '\u000a automaticallyImplyLeading'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'false'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -20494,20 +20488,19 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ')),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Center'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ElevatedButton'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -20521,14 +20514,13 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: 'dialogShow'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan( - style: codeStyle.baseStyle, - text: '\u000a onPressed'), + style: codeStyle.baseStyle, text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'switch'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20536,8 +20528,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20546,16 +20537,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showAlertDialog'), + text: '\u000a _showAlertDialog'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20564,16 +20554,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showAlertDialogWithTitle'), + text: '\u000a _showAlertDialogWithTitle'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20582,16 +20571,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _showSimpleDialog'), + text: '\u000a _showSimpleDialog'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'case'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'DialogDemoType'), @@ -20599,7 +20587,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: 'fullscreen'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Navigator'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'push'), @@ -20608,15 +20596,15 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '>('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a context'), + text: '\u000a context'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'MaterialPageRoute'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a builder'), + text: '\u000a builder'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -20629,37 +20617,35 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '(),'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a fullscreenDialog'), + text: '\u000a fullscreenDialog'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'true'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'break'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '}'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -36000,39 +35986,21 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'Builder'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a builder'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: 'context'), - TextSpan(style: codeStyle.punctuationStyle, text: ')'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'return'), - TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a appBar'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'AppBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a automaticallyImplyLeading'), + text: '\u000a automaticallyImplyLeading'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'false'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a title'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -36045,21 +36013,21 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsTitle'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Center'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'ElevatedButton'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), @@ -36070,14 +36038,13 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsButtonLabel'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a onPressed'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36086,7 +36053,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'hideCurrentSnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '();'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36097,9 +36064,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.classStyle, text: 'SnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, - text: '\u000a content'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a content'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), @@ -36112,15 +36077,12 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsText'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a action'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a action'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'SnackBarAction'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, - text: '\u000a label'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a label'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), @@ -36129,22 +36091,19 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ')'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan( style: codeStyle.baseStyle, text: 'demoSnackbarsActionButtonLabel'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, - text: '\u000a onPressed'), + style: codeStyle.baseStyle, text: '\u000a onPressed'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36153,8 +36112,7 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'hideCurrentSnackBar'), TextSpan(style: codeStyle.punctuationStyle, text: '();'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36167,14 +36125,12 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( style: codeStyle.baseStyle, - text: '\u000a content'), + text: '\u000a content'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan( - style: codeStyle.baseStyle, - text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -36183,26 +36139,18 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoSnackbarsAction'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: ')));'), - TextSpan( - style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '},'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '));'), + TextSpan(style: codeStyle.punctuationStyle, text: ')));'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '},'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.punctuationStyle, text: '));'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.punctuationStyle, text: ');'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '},'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -36822,13 +36770,8 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'const'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'ScaffoldMessenger'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: 'child'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TextFormFieldDemo'), - TextSpan(style: codeStyle.punctuationStyle, text: '()),'), + TextSpan(style: codeStyle.punctuationStyle, text: '(),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), diff --git a/lib/demos/material/dialog_demo.dart b/lib/demos/material/dialog_demo.dart index 428d3e9183..5aa1e05097 100644 --- a/lib/demos/material/dialog_demo.dart +++ b/lib/demos/material/dialog_demo.dart @@ -124,49 +124,47 @@ class DialogDemo extends StatelessWidget { @override Widget build(BuildContext context) { - return ScaffoldMessenger( - child: Navigator( - // Adding [ValueKey] to make sure that the widget gets rebuilt when - // changing type. - key: ValueKey(type), - onGenerateRoute: (settings) { - return _NoAnimationMaterialPageRoute( - builder: (context) => Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: Text(_title(context)), - ), - body: Center( - child: ElevatedButton( - child: Text(GalleryLocalizations.of(context).dialogShow), - onPressed: () { - switch (type) { - case DialogDemoType.alert: - _showAlertDialog(context); - break; - case DialogDemoType.alertTitle: - _showAlertDialogWithTitle(context); - break; - case DialogDemoType.simple: - _showSimpleDialog(context); - break; - case DialogDemoType.fullscreen: - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => _FullScreenDialogDemo(), - fullscreenDialog: true, - ), - ); - break; - } - }, - ), + return Navigator( + // Adding [ValueKey] to make sure that the widget gets rebuilt when + // changing type. + key: ValueKey(type), + onGenerateRoute: (settings) { + return _NoAnimationMaterialPageRoute( + builder: (context) => Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Text(_title(context)), + ), + body: Center( + child: ElevatedButton( + child: Text(GalleryLocalizations.of(context).dialogShow), + onPressed: () { + switch (type) { + case DialogDemoType.alert: + _showAlertDialog(context); + break; + case DialogDemoType.alertTitle: + _showAlertDialogWithTitle(context); + break; + case DialogDemoType.simple: + _showSimpleDialog(context); + break; + case DialogDemoType.fullscreen: + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => _FullScreenDialogDemo(), + fullscreenDialog: true, + ), + ); + break; + } + }, ), ), - ); - }, - ), + ), + ); + }, ); } } diff --git a/lib/demos/material/menu_demo.dart b/lib/demos/material/menu_demo.dart index 403001bc00..cb4a151682 100644 --- a/lib/demos/material/menu_demo.dart +++ b/lib/demos/material/menu_demo.dart @@ -61,17 +61,15 @@ class _MenuDemoState extends State { break; } - return ScaffoldMessenger( - child: Scaffold( - appBar: AppBar( - title: Text(GalleryLocalizations.of(context).demoMenuTitle), - automaticallyImplyLeading: false, - ), - body: Padding( - padding: const EdgeInsets.symmetric(horizontal: 20), - child: Center( - child: demo, - ), + return Scaffold( + appBar: AppBar( + title: Text(GalleryLocalizations.of(context).demoMenuTitle), + automaticallyImplyLeading: false, + ), + body: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Center( + child: demo, ), ), ); diff --git a/lib/demos/material/snackbar_demo.dart b/lib/demos/material/snackbar_demo.dart index bdc0273064..e238e7b1b0 100644 --- a/lib/demos/material/snackbar_demo.dart +++ b/lib/demos/material/snackbar_demo.dart @@ -12,39 +12,33 @@ class SnackbarsDemo extends StatelessWidget { @override Widget build(BuildContext context) { - return ScaffoldMessenger( - child: Builder( - builder: (context) { - return Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: Text(GalleryLocalizations.of(context).demoSnackbarsTitle), - ), - body: Center( - child: ElevatedButton( - child: - Text(GalleryLocalizations.of(context).demoSnackbarsButtonLabel), + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Text(GalleryLocalizations.of(context).demoSnackbarsTitle), + ), + body: Center( + child: ElevatedButton( + child: + Text(GalleryLocalizations.of(context).demoSnackbarsButtonLabel), + onPressed: () { + ScaffoldMessenger.of(context).hideCurrentSnackBar(); + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text(GalleryLocalizations.of(context).demoSnackbarsText), + action: SnackBarAction( + label: GalleryLocalizations.of(context) + .demoSnackbarsActionButtonLabel, onPressed: () { ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text(GalleryLocalizations.of(context).demoSnackbarsText), - action: SnackBarAction( - label: GalleryLocalizations.of(context) - .demoSnackbarsActionButtonLabel, - onPressed: () { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - GalleryLocalizations.of(context).demoSnackbarsAction, - ))); - }, - ), - )); + content: Text( + GalleryLocalizations.of(context).demoSnackbarsAction, + ))); }, ), - ), - ); - }, + )); + }, + ), ), ); } diff --git a/lib/demos/material/text_field_demo.dart b/lib/demos/material/text_field_demo.dart index 2dd4a41456..a5c454a928 100644 --- a/lib/demos/material/text_field_demo.dart +++ b/lib/demos/material/text_field_demo.dart @@ -21,7 +21,7 @@ class TextFieldDemo extends StatelessWidget { automaticallyImplyLeading: false, title: Text(GalleryLocalizations.of(context).demoTextFieldTitle), ), - body: const ScaffoldMessenger(child: TextFormFieldDemo()), + body: const TextFormFieldDemo(), ); } } diff --git a/lib/pages/demo.dart b/lib/pages/demo.dart index 4ccd227540..8f20f3574e 100644 --- a/lib/pages/demo.dart +++ b/lib/pages/demo.dart @@ -63,9 +63,11 @@ class _DemoPageState extends State { // Return to root if invalid slug. Navigator.of(context).pop(); } - return GalleryDemoPage( - restorationId: widget.slug, - demo: slugToDemoMap[widget.slug], + return ScaffoldMessenger( + child: GalleryDemoPage( + restorationId: widget.slug, + demo: slugToDemoMap[widget.slug], + ) ); } } @@ -382,9 +384,11 @@ class _GalleryDemoPageState extends State } Widget body; - Widget demoContent = DemoContent( - height: contentHeight, - buildRoute: _currentConfig.buildRoute, + Widget demoContent = ScaffoldMessenger( + child: DemoContent( + height: contentHeight, + buildRoute: _currentConfig.buildRoute, + ), ); if (isDesktop) { final isFullScreen = currentDemoState == _DemoState.fullscreen; @@ -449,75 +453,69 @@ class _GalleryDemoPageState extends State Widget page; if (isDesktop) { - page = ScaffoldMessenger( - child: AnimatedBuilder( - animation: _codeBackgroundColorController, - builder: (context, child) { - Brightness themeBrightness; - - switch (GalleryOptions.of(context).themeMode) { - case ThemeMode.system: - themeBrightness = MediaQuery.of(context).platformBrightness; - break; - case ThemeMode.light: - themeBrightness = Brightness.light; - break; - case ThemeMode.dark: - themeBrightness = Brightness.dark; - break; - } + page = AnimatedBuilder( + animation: _codeBackgroundColorController, + builder: (context, child) { + Brightness themeBrightness; + + switch (GalleryOptions.of(context).themeMode) { + case ThemeMode.system: + themeBrightness = MediaQuery.of(context).platformBrightness; + break; + case ThemeMode.light: + themeBrightness = Brightness.light; + break; + case ThemeMode.dark: + themeBrightness = Brightness.dark; + break; + } - Widget contents = Container( - padding: EdgeInsets.symmetric(horizontal: horizontalPadding), - child: ApplyTextOptions( - child: Scaffold( - appBar: appBar, - body: body, - backgroundColor: Colors.transparent, - ), + Widget contents = Container( + padding: EdgeInsets.symmetric(horizontal: horizontalPadding), + child: ApplyTextOptions( + child: Scaffold( + appBar: appBar, + body: body, + backgroundColor: Colors.transparent, + ), + ), + ); + + if (themeBrightness == Brightness.light) { + // If it is currently in light mode, add a + // dark background for code. + Widget codeBackground = Container( + padding: const EdgeInsets.only(top: 56), + child: Container( + color: ColorTween( + begin: Colors.transparent, + end: GalleryThemeData.darkThemeData.canvasColor, + ).animate(_codeBackgroundColorController).value, ), ); - if (themeBrightness == Brightness.light) { - // If it is currently in light mode, add a - // dark background for code. - Widget codeBackground = Container( - padding: const EdgeInsets.only(top: 56), - child: Container( - color: ColorTween( - begin: Colors.transparent, - end: GalleryThemeData.darkThemeData.canvasColor, - ).animate(_codeBackgroundColorController).value, - ), - ); - - contents = Stack( - children: [ - codeBackground, - contents, - ], - ); - } - - return Container( - color: colorScheme.background, - child: contents, + contents = Stack( + children: [ + codeBackground, + contents, + ], ); - }), - ); + } + + return Container( + color: colorScheme.background, + child: contents, + ); + }); } else { - page = Builder( - builder: (context) { - return Container( - color: colorScheme.background, - child: ApplyTextOptions( - child: Scaffold( - appBar: appBar, - body: body, - ), - ), - ); - }, + page = Container( + color: colorScheme.background, + child: ApplyTextOptions( + child: Scaffold( + appBar: appBar, + body: body, + ), + ), ); } From 572f2f8e18b4f9f8db3bf42ef34110875edef206 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Fri, 20 Nov 2020 18:24:24 -0600 Subject: [PATCH 5/5] Formatting --- lib/pages/demo.dart | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/pages/demo.dart b/lib/pages/demo.dart index 8f20f3574e..3b21614230 100644 --- a/lib/pages/demo.dart +++ b/lib/pages/demo.dart @@ -65,10 +65,9 @@ class _DemoPageState extends State { } return ScaffoldMessenger( child: GalleryDemoPage( - restorationId: widget.slug, - demo: slugToDemoMap[widget.slug], - ) - ); + restorationId: widget.slug, + demo: slugToDemoMap[widget.slug], + )); } }