From ebb2120b8e7558d5ff2a43ce1ddaee55dda4ca9b Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Fri, 20 Nov 2020 15:52:37 +0800 Subject: [PATCH 01/12] State restorable navigation rail --- lib/codeviewer/code_segments.dart | 76 ++++++++++++++++++-- lib/data/demos.dart | 4 +- lib/demos/material/navigation_drawer.dart | 4 +- lib/demos/material/navigation_rail_demo.dart | 25 +++++-- 4 files changed, 96 insertions(+), 13 deletions(-) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index f7dd1a864a..ac419dd1d5 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -26044,11 +26044,11 @@ class CodeSegments { TextSpan( style: codeStyle.commentStyle, text: - '// Pressing the Navigation Drawer button the left of Appbar to show'), + '// Pressing the Navigation Drawer button the left of AppBar to show'), TextSpan(style: codeStyle.baseStyle, text: '\u000a'), TextSpan( style: codeStyle.commentStyle, - text: '// a simple Drawer with Two items.'), + text: '// a simple Drawer with two items.'), TextSpan(style: codeStyle.baseStyle, text: '\u000a'), TextSpan(style: codeStyle.keywordStyle, text: 'class'), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -26383,8 +26383,18 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'NavRailDemo'), TextSpan(style: codeStyle.punctuationStyle, text: '({'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Key'), TextSpan(style: codeStyle.baseStyle, text: ' key'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@required'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'this'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'restorationId'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '})'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -26396,6 +26406,12 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' key'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: '_NavRailDemoState'), @@ -26420,17 +26436,63 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: 'NavRailDemo'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'int'), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), TextSpan(style: codeStyle.baseStyle, text: ' _selectedIndex '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' widget'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'restorationId'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_selectedIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, text: '\u0027selected_index\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Widget'), TextSpan(style: codeStyle.baseStyle, text: ' build'), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -26557,6 +26619,8 @@ class CodeSegments { style: codeStyle.baseStyle, text: '\u000a selectedIndex'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _selectedIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( style: codeStyle.baseStyle, @@ -26575,7 +26639,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _selectedIndex '), + text: '\u000a _selectedIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' index'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -26770,6 +26836,8 @@ class CodeSegments { text: '\u000a selectedItem'), TextSpan(style: codeStyle.punctuationStyle, text: '['), TextSpan(style: codeStyle.baseStyle, text: '_selectedIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: '],'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), diff --git a/lib/data/demos.dart b/lib/data/demos.dart index 96ea8bde07..f9aa3c657f 100644 --- a/lib/data/demos.dart +++ b/lib/data/demos.dart @@ -573,7 +573,9 @@ List materialDemos(GalleryLocalizations localizations) { title: localizations.demoNavigationRailTitle, description: localizations.demoNavigationRailDescription, documentationUrl: '$_docsBaseUrl/material/NavigationRail-class.html', - buildRoute: (_) => const NavRailDemo(), + buildRoute: (_) => const NavRailDemo( + restorationId: 'nav_rail_demo', + ), code: CodeSegments.navRailDemo, ), ], diff --git a/lib/demos/material/navigation_drawer.dart b/lib/demos/material/navigation_drawer.dart index 5bdf3840a0..3d8b7e2876 100644 --- a/lib/demos/material/navigation_drawer.dart +++ b/lib/demos/material/navigation_drawer.dart @@ -8,8 +8,8 @@ import 'package:flutter/cupertino.dart'; // BEGIN navDrawerDemo -// Pressing the Navigation Drawer button the left of Appbar to show -// a simple Drawer with Two items. +// Pressing the Navigation Drawer button the left of AppBar to show +// a simple Drawer with two items. class NavDrawerDemo extends StatelessWidget { const NavDrawerDemo({Key key}) : super(key: key); diff --git a/lib/demos/material/navigation_rail_demo.dart b/lib/demos/material/navigation_rail_demo.dart index 96e6f611dd..3297d2994f 100644 --- a/lib/demos/material/navigation_rail_demo.dart +++ b/lib/demos/material/navigation_rail_demo.dart @@ -8,14 +8,27 @@ import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; // BEGIN navRailDemo class NavRailDemo extends StatefulWidget { - const NavRailDemo({Key key}) : super(key: key); + const NavRailDemo({ + Key key, + @required this.restorationId, + }) : super(key: key); + + final String restorationId; @override _NavRailDemoState createState() => _NavRailDemoState(); } -class _NavRailDemoState extends State { - int _selectedIndex = 0; +class _NavRailDemoState extends State with RestorationMixin { + final RestorableInt _selectedIndex = RestorableInt(0); + + @override + String get restorationId => widget.restorationId; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(_selectedIndex, 'selected_index'); + } @override Widget build(BuildContext context) { @@ -41,10 +54,10 @@ class _NavRailDemoState extends State { child: const Icon(Icons.add), onPressed: () {}, ), - selectedIndex: _selectedIndex, + selectedIndex: _selectedIndex.value, onDestinationSelected: (index) { setState(() { - _selectedIndex = index; + _selectedIndex.value = index; }); }, labelType: NavigationRailLabelType.selected, @@ -88,7 +101,7 @@ class _NavRailDemoState extends State { Expanded( child: Center( child: Text( - selectedItem[_selectedIndex], + selectedItem[_selectedIndex.value], ), ), ), From a03d7e0b0252c219645bc06a4fd02d568cabbc3e Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 19:44:55 +0800 Subject: [PATCH 02/12] navigation rail and selection controls demo --- lib/data/demos.dart | 4 +--- lib/demos/material/navigation_rail_demo.dart | 9 ++------- lib/demos/material/selection_controls_demo.dart | 5 ++++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/data/demos.dart b/lib/data/demos.dart index c4d5dbefab..4e420145e0 100644 --- a/lib/data/demos.dart +++ b/lib/data/demos.dart @@ -572,9 +572,7 @@ List materialDemos(GalleryLocalizations localizations) { title: localizations.demoNavigationRailTitle, description: localizations.demoNavigationRailDescription, documentationUrl: '$_docsBaseUrl/material/NavigationRail-class.html', - buildRoute: (_) => const NavRailDemo( - restorationId: 'nav_rail_demo', - ), + buildRoute: (_) => const NavRailDemo(), code: CodeSegments.navRailDemo, ), ], diff --git a/lib/demos/material/navigation_rail_demo.dart b/lib/demos/material/navigation_rail_demo.dart index 3297d2994f..7ab6551f54 100644 --- a/lib/demos/material/navigation_rail_demo.dart +++ b/lib/demos/material/navigation_rail_demo.dart @@ -8,12 +8,7 @@ import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; // BEGIN navRailDemo class NavRailDemo extends StatefulWidget { - const NavRailDemo({ - Key key, - @required this.restorationId, - }) : super(key: key); - - final String restorationId; + const NavRailDemo({ Key key }) : super(key: key); @override _NavRailDemoState createState() => _NavRailDemoState(); @@ -23,7 +18,7 @@ class _NavRailDemoState extends State with RestorationMixin { final RestorableInt _selectedIndex = RestorableInt(0); @override - String get restorationId => widget.restorationId; + String get restorationId => 'nav_rail_demo'; @override void restoreState(RestorationBucket oldBucket, bool initialRestore) { diff --git a/lib/demos/material/selection_controls_demo.dart b/lib/demos/material/selection_controls_demo.dart index c6ccb8a9d3..43b5671baf 100644 --- a/lib/demos/material/selection_controls_demo.dart +++ b/lib/demos/material/selection_controls_demo.dart @@ -63,7 +63,10 @@ class _CheckboxDemo extends StatefulWidget { _CheckboxDemoState createState() => _CheckboxDemoState(); } -class _CheckboxDemoState extends State<_CheckboxDemo> { +class _CheckboxDemoState extends State<_CheckboxDemo> with RestorationMixin { + // TODO(shihaohong): Introduce RestorableBoolN into the framework + // to allow checkboxes to be properly state restorable (null value has + // meaning in checkboxes). bool checkboxValueA = true; bool checkboxValueB = false; bool checkboxValueC; From a808a38f5a49dad133aa315101695b74673bc5f6 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 19:47:15 +0800 Subject: [PATCH 03/12] Remove RestorationMixin from SelectionControls Demo for now --- lib/demos/material/selection_controls_demo.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/demos/material/selection_controls_demo.dart b/lib/demos/material/selection_controls_demo.dart index 43b5671baf..2411f0d352 100644 --- a/lib/demos/material/selection_controls_demo.dart +++ b/lib/demos/material/selection_controls_demo.dart @@ -63,7 +63,7 @@ class _CheckboxDemo extends StatefulWidget { _CheckboxDemoState createState() => _CheckboxDemoState(); } -class _CheckboxDemoState extends State<_CheckboxDemo> with RestorationMixin { +class _CheckboxDemoState extends State<_CheckboxDemo> { // TODO(shihaohong): Introduce RestorableBoolN into the framework // to allow checkboxes to be properly state restorable (null value has // meaning in checkboxes). From 3f102cc5386bc6ea769f40a7fb060ff57c54238c Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 19:50:23 +0800 Subject: [PATCH 04/12] Migrate remaining selection controls demos --- .../material/selection_controls_demo.dart | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/demos/material/selection_controls_demo.dart b/lib/demos/material/selection_controls_demo.dart index 2411f0d352..09402ca40c 100644 --- a/lib/demos/material/selection_controls_demo.dart +++ b/lib/demos/material/selection_controls_demo.dart @@ -117,12 +117,20 @@ class _RadioDemo extends StatefulWidget { _RadioDemoState createState() => _RadioDemoState(); } -class _RadioDemoState extends State<_RadioDemo> { - int radioValue = 0; +class _RadioDemoState extends State<_RadioDemo> with RestorationMixin { + final RestorableInt radioValue = RestorableInt(0); + + @override + String get restorationId => 'radio_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(radioValue, 'radio_value'); + } void handleRadioValueChanged(int value) { setState(() { - radioValue = value; + radioValue.value = value; }); } @@ -135,7 +143,7 @@ class _RadioDemoState extends State<_RadioDemo> { for (int index = 0; index < 3; ++index) Radio( value: index, - groupValue: radioValue, + groupValue: radioValue.value, onChanged: handleRadioValueChanged, ), ], @@ -153,8 +161,16 @@ class _SwitchDemo extends StatefulWidget { _SwitchDemoState createState() => _SwitchDemoState(); } -class _SwitchDemoState extends State<_SwitchDemo> { - bool switchValue = false; +class _SwitchDemoState extends State<_SwitchDemo> with RestorationMixin { + RestorableBool switchValue = RestorableBool(false); + + @override + String get restorationId => 'switch_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(switchValue, 'switch_value'); + } @override Widget build(BuildContext context) { @@ -164,10 +180,10 @@ class _SwitchDemoState extends State<_SwitchDemo> { label: GalleryLocalizations.of(context).demoSelectionControlsSwitchTitle, child: Switch( - value: switchValue, + value: switchValue.value, onChanged: (value) { setState(() { - switchValue = value; + switchValue.value = value; }); }, ), From 041a44102c8a08379a2e927ab32a121443e53626 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 20:19:37 +0800 Subject: [PATCH 05/12] Restorable Sliders --- lib/demos/material/sliders_demo.dart | 97 +++++++++++++++++++++------- 1 file changed, 73 insertions(+), 24 deletions(-) diff --git a/lib/demos/material/sliders_demo.dart b/lib/demos/material/sliders_demo.dart index 6e3bba6af0..b2512a618b 100644 --- a/lib/demos/material/sliders_demo.dart +++ b/lib/demos/material/sliders_demo.dart @@ -59,9 +59,18 @@ class _Sliders extends StatefulWidget { _SlidersState createState() => _SlidersState(); } -class _SlidersState extends State<_Sliders> { - double _continuousValue = 25; - double _discreteValue = 20; +class _SlidersState extends State<_Sliders> with RestorationMixin { + final RestorableDouble _continuousValue = RestorableDouble(25); + final RestorableDouble _discreteValue = RestorableDouble(20); + + @override + String get restorationId => 'slider_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(_continuousValue, 'continuous_value'); + registerForRestoration(_discreteValue, 'discrete_value'); + } @override Widget build(BuildContext context) { @@ -83,26 +92,26 @@ class _SlidersState extends State<_Sliders> { textAlign: TextAlign.center, onSubmitted: (value) { final newValue = double.tryParse(value); - if (newValue != null && newValue != _continuousValue) { + if (newValue != null && newValue != _continuousValue.value) { setState(() { - _continuousValue = newValue.clamp(0, 100) as double; + _continuousValue.value = newValue.clamp(0, 100) as double; }); } }, keyboardType: TextInputType.number, controller: TextEditingController( - text: _continuousValue.toStringAsFixed(0), + text: _continuousValue.value.toStringAsFixed(0), ), ), ), ), Slider( - value: _continuousValue, + value: _continuousValue.value, min: 0, max: 100, onChanged: (value) { setState(() { - _continuousValue = value; + _continuousValue.value = value; }); }, ), @@ -115,14 +124,14 @@ class _SlidersState extends State<_Sliders> { mainAxisSize: MainAxisSize.min, children: [ Slider( - value: _discreteValue, + value: _discreteValue.value, min: 0, max: 200, divisions: 5, - label: _discreteValue.round().toString(), + label: _discreteValue.value.round().toString(), onChanged: (value) { setState(() { - _discreteValue = value; + _discreteValue.value = value; }); }, ), @@ -144,12 +153,34 @@ class _RangeSliders extends StatefulWidget { _RangeSlidersState createState() => _RangeSlidersState(); } -class _RangeSlidersState extends State<_RangeSliders> { - RangeValues _continuousValues = const RangeValues(25, 75); - RangeValues _discreteValues = const RangeValues(40, 120); +class _RangeSlidersState extends State<_RangeSliders> with RestorationMixin { + final RestorableDouble _continuousStartValue = RestorableDouble(25); + final RestorableDouble _continuousEndValue = RestorableDouble(75); + final RestorableDouble _discreteStartValue = RestorableDouble(40); + final RestorableDouble _discreteEndValue = RestorableDouble(120); + + @override + String get restorationId => 'range_sliders_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(_continuousStartValue, 'continuous_start_value'); + registerForRestoration(_continuousEndValue, 'continuous_end_value'); + registerForRestoration(_discreteStartValue, 'discrete_start_value'); + registerForRestoration(_discreteEndValue, 'discrete_end_value'); + } @override Widget build(BuildContext context) { + final _continuousValues = RangeValues( + _continuousStartValue.value, + _continuousEndValue.value, + ); + final _discreteValues = RangeValues( + _discreteStartValue.value, + _discreteEndValue.value, + ); + return Padding( padding: const EdgeInsets.symmetric(horizontal: 40), child: Column( @@ -164,7 +195,8 @@ class _RangeSlidersState extends State<_RangeSliders> { max: 100, onChanged: (values) { setState(() { - _continuousValues = values; + _continuousStartValue.value = values.start; + _continuousEndValue.value = values.end; }); }, ), @@ -186,7 +218,8 @@ class _RangeSlidersState extends State<_RangeSliders> { ), onChanged: (values) { setState(() { - _discreteValues = values; + _discreteStartValue.value = values.start; + _discreteEndValue.value = values.end; }); }, ), @@ -423,12 +456,27 @@ class _CustomSliders extends StatefulWidget { _CustomSlidersState createState() => _CustomSlidersState(); } -class _CustomSlidersState extends State<_CustomSliders> { - double _discreteCustomValue = 25; - RangeValues _continuousCustomValues = const RangeValues(40, 160); +class _CustomSlidersState extends State<_CustomSliders> with RestorationMixin { + final RestorableDouble _continuousStartCustomValue = RestorableDouble(40); + final RestorableDouble _continuousEndCustomValue = RestorableDouble(160); + final RestorableDouble _discreteCustomValue = RestorableDouble(25); + + @override + String get restorationId => 'custom_sliders_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(_continuousStartCustomValue, 'continuous_start_custom_value'); + registerForRestoration(_continuousEndCustomValue, 'continuous_end_custom_value'); + registerForRestoration(_discreteCustomValue, 'discrete_custom_value'); + } @override Widget build(BuildContext context) { + final customRangeValue = RangeValues( + _continuousStartCustomValue.value, + _continuousEndCustomValue.value, + ); final theme = Theme.of(context); return Padding( padding: const EdgeInsets.symmetric(horizontal: 40), @@ -457,16 +505,16 @@ class _CustomSlidersState extends State<_CustomSliders> { .copyWith(color: theme.colorScheme.onSurface), ), child: Slider( - value: _discreteCustomValue, + value: _discreteCustomValue.value, min: 0, max: 200, divisions: 5, semanticFormatterCallback: (value) => value.round().toString(), - label: '${_discreteCustomValue.round()}', + label: '${_discreteCustomValue.value.round()}', onChanged: (value) { setState(() { - _discreteCustomValue = value; + _discreteCustomValue.value = value; }); }, ), @@ -492,12 +540,13 @@ class _CustomSlidersState extends State<_CustomSliders> { showValueIndicator: ShowValueIndicator.never, ), child: RangeSlider( - values: _continuousCustomValues, + values: customRangeValue, min: 0, max: 200, onChanged: (values) { setState(() { - _continuousCustomValues = values; + _continuousStartCustomValue.value = values.start; + _continuousEndCustomValue.value = values.end; }); }, ), From 819d0fb0967955b8bd89f2f5801f0f061e8fbe20 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 20:53:29 +0800 Subject: [PATCH 06/12] Restorable non scrolling tab --- lib/demos/material/tabs_demo.dart | 83 +++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 21 deletions(-) diff --git a/lib/demos/material/tabs_demo.dart b/lib/demos/material/tabs_demo.dart index bab0adff7c..55643d63fc 100644 --- a/lib/demos/material/tabs_demo.dart +++ b/lib/demos/material/tabs_demo.dart @@ -79,38 +79,79 @@ class _TabsScrollableDemo extends StatelessWidget { // BEGIN tabsNonScrollableDemo -class _TabsNonScrollableDemo extends StatelessWidget { +class _TabsNonScrollableDemo extends StatefulWidget { + @override + __TabsNonScrollableDemoState createState() => __TabsNonScrollableDemoState(); +} + +class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> with SingleTickerProviderStateMixin, RestorationMixin { + TabController _tabController; + + final RestorableInt tabIndex = RestorableInt(0); + + @override + String get restorationId => 'tab_non_scrollable_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(tabIndex, 'tab_index'); + } + + @override + void initState() { + _tabController = TabController( + initialIndex: 0, + length: 3, + vsync: this, + ); + _tabController.addListener(() { + setState(() { + tabIndex.value = _tabController.index; + }); + }); + super.initState(); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { + if (_tabController.index != tabIndex.value) { + _tabController.index = tabIndex.value; + } + final tabs = [ GalleryLocalizations.of(context).colorsRed, GalleryLocalizations.of(context).colorsOrange, GalleryLocalizations.of(context).colorsGreen, ]; - return DefaultTabController( - length: tabs.length, - child: Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: - Text(GalleryLocalizations.of(context).demoTabsNonScrollingTitle), - bottom: TabBar( - isScrollable: false, - tabs: [ - for (final tab in tabs) Tab(text: tab), - ], - ), - ), - body: TabBarView( - children: [ - for (final tab in tabs) - Center( - child: Text(tab), - ), + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: + Text(GalleryLocalizations.of(context).demoTabsNonScrollingTitle,), + bottom: TabBar( + controller: _tabController, + isScrollable: false, + tabs: [ + for (final tab in tabs) Tab(text: tab), ], ), ), + body: TabBarView( + controller: _tabController, + children: [ + for (final tab in tabs) + Center( + child: Text(tab), + ), + ], + ), ); } } From 168ba07f16ecfa3a33707fc83aa022d787bcda01 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 20:53:49 +0800 Subject: [PATCH 07/12] Flutter format --- lib/demos/material/navigation_rail_demo.dart | 2 +- lib/demos/material/sliders_demo.dart | 12 ++++++++---- lib/demos/material/tabs_demo.dart | 8 +++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/demos/material/navigation_rail_demo.dart b/lib/demos/material/navigation_rail_demo.dart index 7ab6551f54..4756560979 100644 --- a/lib/demos/material/navigation_rail_demo.dart +++ b/lib/demos/material/navigation_rail_demo.dart @@ -8,7 +8,7 @@ import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; // BEGIN navRailDemo class NavRailDemo extends StatefulWidget { - const NavRailDemo({ Key key }) : super(key: key); + const NavRailDemo({Key key}) : super(key: key); @override _NavRailDemoState createState() => _NavRailDemoState(); diff --git a/lib/demos/material/sliders_demo.dart b/lib/demos/material/sliders_demo.dart index b2512a618b..5a25d56905 100644 --- a/lib/demos/material/sliders_demo.dart +++ b/lib/demos/material/sliders_demo.dart @@ -92,9 +92,11 @@ class _SlidersState extends State<_Sliders> with RestorationMixin { textAlign: TextAlign.center, onSubmitted: (value) { final newValue = double.tryParse(value); - if (newValue != null && newValue != _continuousValue.value) { + if (newValue != null && + newValue != _continuousValue.value) { setState(() { - _continuousValue.value = newValue.clamp(0, 100) as double; + _continuousValue.value = + newValue.clamp(0, 100) as double; }); } }, @@ -466,8 +468,10 @@ class _CustomSlidersState extends State<_CustomSliders> with RestorationMixin { @override void restoreState(RestorationBucket oldBucket, bool initialRestore) { - registerForRestoration(_continuousStartCustomValue, 'continuous_start_custom_value'); - registerForRestoration(_continuousEndCustomValue, 'continuous_end_custom_value'); + registerForRestoration( + _continuousStartCustomValue, 'continuous_start_custom_value'); + registerForRestoration( + _continuousEndCustomValue, 'continuous_end_custom_value'); registerForRestoration(_discreteCustomValue, 'discrete_custom_value'); } diff --git a/lib/demos/material/tabs_demo.dart b/lib/demos/material/tabs_demo.dart index 55643d63fc..7aea186fbe 100644 --- a/lib/demos/material/tabs_demo.dart +++ b/lib/demos/material/tabs_demo.dart @@ -84,7 +84,8 @@ class _TabsNonScrollableDemo extends StatefulWidget { __TabsNonScrollableDemoState createState() => __TabsNonScrollableDemoState(); } -class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> with SingleTickerProviderStateMixin, RestorationMixin { +class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> + with SingleTickerProviderStateMixin, RestorationMixin { TabController _tabController; final RestorableInt tabIndex = RestorableInt(0); @@ -133,8 +134,9 @@ class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> with Si return Scaffold( appBar: AppBar( automaticallyImplyLeading: false, - title: - Text(GalleryLocalizations.of(context).demoTabsNonScrollingTitle,), + title: Text( + GalleryLocalizations.of(context).demoTabsNonScrollingTitle, + ), bottom: TabBar( controller: _tabController, isScrollable: false, From 8ab1b658636ac52e01e458b022bc71db9f64dd54 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 20:59:04 +0800 Subject: [PATCH 08/12] Restorable scrollable tabs --- lib/demos/material/tabs_demo.dart | 82 +++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 20 deletions(-) diff --git a/lib/demos/material/tabs_demo.dart b/lib/demos/material/tabs_demo.dart index 7aea186fbe..a43312173a 100644 --- a/lib/demos/material/tabs_demo.dart +++ b/lib/demos/material/tabs_demo.dart @@ -31,9 +31,52 @@ class TabsDemo extends StatelessWidget { // BEGIN tabsScrollableDemo -class _TabsScrollableDemo extends StatelessWidget { +class _TabsScrollableDemo extends StatefulWidget { + @override + __TabsScrollableDemoState createState() => __TabsScrollableDemoState(); +} + +class __TabsScrollableDemoState extends State<_TabsScrollableDemo> + with SingleTickerProviderStateMixin, RestorationMixin { + TabController _tabController; + + final RestorableInt tabIndex = RestorableInt(0); + + @override + String get restorationId => 'tab_non_scrollable_demo'; + + @override + void restoreState(RestorationBucket oldBucket, bool initialRestore) { + registerForRestoration(tabIndex, 'tab_index'); + } + + @override + void initState() { + _tabController = TabController( + initialIndex: 0, + length: 12, + vsync: this, + ); + _tabController.addListener(() { + setState(() { + tabIndex.value = _tabController.index; + }); + }); + super.initState(); + } + + @override + void dispose() { + _tabController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { + if (_tabController.index != tabIndex.value) { + _tabController.index = tabIndex.value; + } + final tabs = [ GalleryLocalizations.of(context).colorsRed, GalleryLocalizations.of(context).colorsOrange, @@ -49,28 +92,27 @@ class _TabsScrollableDemo extends StatelessWidget { GalleryLocalizations.of(context).colorsPurple, ]; - return DefaultTabController( - length: tabs.length, - child: Scaffold( - appBar: AppBar( - automaticallyImplyLeading: false, - title: Text(GalleryLocalizations.of(context).demoTabsScrollingTitle), - bottom: TabBar( - isScrollable: true, - tabs: [ - for (final tab in tabs) Tab(text: tab), - ], - ), - ), - body: TabBarView( - children: [ - for (final tab in tabs) - Center( - child: Text(tab), - ), + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + title: Text(GalleryLocalizations.of(context).demoTabsScrollingTitle), + bottom: TabBar( + controller: _tabController, + isScrollable: true, + tabs: [ + for (final tab in tabs) Tab(text: tab), ], ), ), + body: TabBarView( + controller: _tabController, + children: [ + for (final tab in tabs) + Center( + child: Text(tab), + ), + ], + ), ); } } From 62f5be278e5a37735bc97d6b204e2edccec6d2bf Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 21:01:14 +0800 Subject: [PATCH 09/12] TextFormField TODO --- lib/demos/material/text_field_demo.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/demos/material/text_field_demo.dart b/lib/demos/material/text_field_demo.dart index a5c454a928..127de17f9d 100644 --- a/lib/demos/material/text_field_demo.dart +++ b/lib/demos/material/text_field_demo.dart @@ -16,6 +16,8 @@ class TextFieldDemo extends StatelessWidget { @override Widget build(BuildContext context) { + // TODO(shihaohong): Implement state restoration for TextFormField + // on the framework. return Scaffold( appBar: AppBar( automaticallyImplyLeading: false, From 97003bc61c0957913d08447ebea6cac893ec83b5 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Thu, 3 Dec 2020 21:01:46 +0800 Subject: [PATCH 10/12] updated code segments --- lib/codeviewer/code_segments.dart | 1174 ++++++++++++++++++++++++----- 1 file changed, 999 insertions(+), 175 deletions(-) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index 751ae8a74b..66b915bdff 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -17095,28 +17095,109 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: '_CustomSliders'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan( + style: codeStyle.baseStyle, text: ' _continuousStartCustomValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '40'), + 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: 'RestorableDouble'), + TextSpan(style: codeStyle.baseStyle, text: ' _continuousEndCustomValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '160'), + 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: 'RestorableDouble'), TextSpan(style: codeStyle.baseStyle, text: ' _discreteCustomValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '25'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027custom_sliders_demo\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), - TextSpan(style: codeStyle.baseStyle, text: ' _continuousCustomValues '), - TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.numberStyle, text: '40'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousStartCustomValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '160'), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027continuous_start_custom_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousEndCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027continuous_end_custom_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_discreteCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027discrete_custom_value\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -17130,6 +17211,27 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' customRangeValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousStartCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousEndCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + 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.keywordStyle, text: 'final'), TextSpan(style: codeStyle.baseStyle, text: ' theme '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -17348,6 +17450,8 @@ class CodeSegments { style: codeStyle.baseStyle, text: '\u000a value'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _discreteCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -17390,7 +17494,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan( style: codeStyle.stringStyle, - text: '\u0027\u0024{_discreteCustomValue.round()}\u0027'), + text: '\u0027\u0024{_discreteCustomValue.value.round()}\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( style: codeStyle.baseStyle, @@ -17410,7 +17514,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _discreteCustomValue '), + text: '\u000a _discreteCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -17563,7 +17669,7 @@ class CodeSegments { TextSpan( style: codeStyle.baseStyle, text: '\u000a values'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _continuousCustomValues'), + TextSpan(style: codeStyle.baseStyle, text: ' customRangeValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -17593,9 +17699,23 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _continuousCustomValues '), + text: '\u000a _continuousStartCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'start'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousEndCustomValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'end'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '});'), @@ -27184,18 +27304,8 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'NavRailDemo'), TextSpan(style: codeStyle.punctuationStyle, text: '({'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Key'), TextSpan(style: codeStyle.baseStyle, text: ' key'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: '@required'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'this'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'restorationId'), - TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '})'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -27207,12 +27317,6 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' key'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'final'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'String'), - TextSpan(style: codeStyle.baseStyle, text: ' restorationId'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: '_NavRailDemoState'), @@ -27261,9 +27365,8 @@ class CodeSegments { TextSpan(style: codeStyle.keywordStyle, text: 'get'), TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), TextSpan(style: codeStyle.punctuationStyle, text: '=>'), - TextSpan(style: codeStyle.baseStyle, text: ' widget'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'restorationId'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027nav_rail_demo\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), @@ -31977,104 +32080,231 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: '_RangeSliders'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), - TextSpan(style: codeStyle.baseStyle, text: ' _continuousValues '), - TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.baseStyle, text: ' _continuousStartValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '25'), - TextSpan(style: codeStyle.punctuationStyle, 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: 'RestorableDouble'), + TextSpan(style: codeStyle.baseStyle, text: ' _continuousEndValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '75'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), - TextSpan(style: codeStyle.baseStyle, text: ' _discreteValues '), - TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.baseStyle, text: ' _discreteStartValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '40'), - TextSpan(style: codeStyle.punctuationStyle, 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: 'RestorableDouble'), + TextSpan(style: codeStyle.baseStyle, text: ' _discreteEndValue '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '120'), TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'Widget'), - TextSpan(style: codeStyle.baseStyle, text: ' build'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.classStyle, text: 'BuildContext'), - TextSpan(style: codeStyle.baseStyle, text: ' context'), - TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.classStyle, text: 'String'), 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.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'Padding'), + TextSpan( + style: codeStyle.stringStyle, text: '\u0027range_sliders_demo\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'symmetric'), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: 'horizontal'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.numberStyle, text: '40'), - TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: '_continuousStartValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'Column'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a mainAxisAlignment'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'MainAxisAlignment'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'center'), + style: codeStyle.stringStyle, + text: '\u0027continuous_start_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_continuousEndValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'Column'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a mainAxisSize'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'MainAxisSize'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'min'), + style: codeStyle.stringStyle, + text: '\u0027continuous_end_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_discreteStartValue'), TextSpan(style: codeStyle.punctuationStyle, text: ','), - TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.punctuationStyle, text: '['), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'RangeSlider'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan( - style: codeStyle.baseStyle, text: '\u000a values'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' _continuousValues'), + style: codeStyle.stringStyle, + text: '\u0027discrete_start_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_discreteEndValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, text: '\u0027discrete_end_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Widget'), + TextSpan(style: codeStyle.baseStyle, text: ' build'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'BuildContext'), + 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: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' _continuousValues '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousStartValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a _continuousEndValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + 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.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' _discreteValues '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RangeValues'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a _discreteStartValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a _discreteEndValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'return'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Padding'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'symmetric'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'horizontal'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '40'), + 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: 'Column'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a mainAxisAlignment'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'MainAxisAlignment'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'center'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '['), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Column'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a mainAxisSize'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'MainAxisSize'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'min'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '['), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'RangeSlider'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a values'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _continuousValues'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -32102,9 +32332,23 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _continuousValues '), + text: '\u000a _continuousStartValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'start'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _continuousEndValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'end'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '});'), @@ -32220,9 +32464,23 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _discreteValues '), + text: '\u000a _discreteStartValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'start'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a _discreteEndValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' values'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'end'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '});'), @@ -32325,6 +32583,19 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: + '// TODO(shihaohong): Introduce RestorableBoolN into the framework'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: + '// to allow checkboxes to be properly state restorable (null value has'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, text: '// meaning in checkboxes).'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'bool'), TextSpan(style: codeStyle.baseStyle, text: ' checkboxValueA '), TextSpan(style: codeStyle.punctuationStyle, text: '='), @@ -32553,15 +32824,59 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: '_RadioDemo'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'int'), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), TextSpan(style: codeStyle.baseStyle, text: ' radioValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027radio_demo\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'radioValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027radio_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'void'), TextSpan(style: codeStyle.baseStyle, text: ' handleRadioValueChanged'), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -32574,7 +32889,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '(()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a radioValue '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a radioValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -32646,6 +32963,8 @@ class CodeSegments { style: codeStyle.baseStyle, text: '\u000a groupValue'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' radioValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( style: codeStyle.baseStyle, text: '\u000a onChanged'), @@ -32732,17 +33051,59 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: '_SwitchDemo'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.classStyle, text: 'RestorableBool'), TextSpan(style: codeStyle.baseStyle, text: ' switchValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableBool'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.keywordStyle, text: 'false'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027switch_demo\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'switchValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027switch_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Widget'), TextSpan(style: codeStyle.baseStyle, text: ' build'), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -32786,6 +33147,8 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' switchValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a onChanged'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -32800,7 +33163,9 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( - style: codeStyle.baseStyle, text: '\u000a switchValue '), + style: codeStyle.baseStyle, text: '\u000a switchValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -36393,26 +36758,84 @@ class CodeSegments { TextSpan(style: codeStyle.classStyle, text: '_Sliders'), TextSpan(style: codeStyle.punctuationStyle, text: '>'), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), TextSpan(style: codeStyle.baseStyle, text: ' _continuousValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '25'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.keywordStyle, text: 'double'), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), TextSpan(style: codeStyle.baseStyle, text: ' _discreteValue '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableDouble'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '20'), - TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), - TextSpan(style: codeStyle.classStyle, text: 'Widget'), - TextSpan(style: codeStyle.baseStyle, text: ' build'), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027slider_demo\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_continuousValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, text: '\u0027continuous_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_discreteValue'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, text: '\u0027discrete_value\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Widget'), + TextSpan(style: codeStyle.baseStyle, text: ' build'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.classStyle, text: 'BuildContext'), TextSpan(style: codeStyle.baseStyle, text: ' context'), @@ -36553,9 +36976,13 @@ class CodeSegments { TextSpan(style: codeStyle.keywordStyle, text: 'null'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '&&'), - TextSpan(style: codeStyle.baseStyle, text: ' newValue '), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a newValue '), TextSpan(style: codeStyle.punctuationStyle, text: '!='), TextSpan(style: codeStyle.baseStyle, text: ' _continuousValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ')'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), @@ -36567,9 +36994,13 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _continuousValue '), + text: '\u000a _continuousValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), - TextSpan(style: codeStyle.baseStyle, text: ' newValue'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a newValue'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'clamp'), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -36612,6 +37043,8 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _continuousValue'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'toStringAsFixed'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.numberStyle, text: '0'), @@ -36630,6 +37063,8 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _continuousValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -36657,7 +37092,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _continuousValue '), + text: '\u000a _continuousValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -36717,6 +37154,8 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a value'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _discreteValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan(style: codeStyle.baseStyle, text: '\u000a min'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), @@ -36738,6 +37177,8 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' _discreteValue'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'round'), TextSpan(style: codeStyle.punctuationStyle, text: '().'), TextSpan(style: codeStyle.baseStyle, text: 'toString'), @@ -36758,7 +37199,9 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan( style: codeStyle.baseStyle, - text: '\u000a _discreteValue '), + text: '\u000a _discreteValue'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), TextSpan(style: codeStyle.punctuationStyle, text: '='), TextSpan(style: codeStyle.baseStyle, text: ' value'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), @@ -37068,10 +37511,178 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'extends'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'StatelessWidget'), + TextSpan(style: codeStyle.classStyle, text: 'StatefulWidget'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.classStyle, text: '__TabsNonScrollableDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' createState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.classStyle, text: '__TabsNonScrollableDemoState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + TextSpan(style: codeStyle.keywordStyle, text: 'class'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.classStyle, text: '__TabsNonScrollableDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'State'), + TextSpan(style: codeStyle.punctuationStyle, text: '<'), + TextSpan(style: codeStyle.classStyle, text: '_TabsNonScrollableDemo'), + TextSpan(style: codeStyle.punctuationStyle, text: '>'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.classStyle, text: 'SingleTickerProviderStateMixin'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'TabController'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027tab_non_scrollable_demo\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027tab_index\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' initState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'TabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a initialIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a length'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '3'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a vsync'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'this'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'addListener'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index'), + 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.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'initState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Widget'), @@ -37083,6 +37694,30 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'if'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index '), + TextSpan(style: codeStyle.punctuationStyle, text: '!='), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'final'), TextSpan(style: codeStyle.baseStyle, text: ' tabs '), TextSpan(style: codeStyle.punctuationStyle, text: '='), @@ -37120,36 +37755,26 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'DefaultTabController'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a length'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' tabs'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'length'), - 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: '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: '\u000a '), + 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.classStyle, text: 'GalleryLocalizations'), TextSpan(style: codeStyle.punctuationStyle, text: '.'), TextSpan(style: codeStyle.baseStyle, text: 'of'), @@ -37157,23 +37782,29 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: 'context'), TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoTabsNonScrollingTitle'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TabBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a isScrollable'), + style: codeStyle.baseStyle, text: '\u000a isScrollable'), 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 tabs'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a tabs'), 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: 'for'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -37189,22 +37820,26 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' tab'), 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 body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TabBarView'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), 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: 'for'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -37213,22 +37848,20 @@ class CodeSegments { TextSpan(style: codeStyle.keywordStyle, text: 'in'), TextSpan(style: codeStyle.baseStyle, text: ' tabs'), TextSpan(style: codeStyle.punctuationStyle, text: ')'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), 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: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'tab'), 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.punctuationStyle, text: '],'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -37277,10 +37910,175 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.keywordStyle, text: 'extends'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'StatelessWidget'), + TextSpan(style: codeStyle.classStyle, text: 'StatefulWidget'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: '__TabsScrollableDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' createState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: '__TabsScrollableDemoState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + TextSpan(style: codeStyle.keywordStyle, text: 'class'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: '__TabsScrollableDemoState'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'State'), + TextSpan(style: codeStyle.punctuationStyle, text: '<'), + TextSpan(style: codeStyle.classStyle, text: '_TabsScrollableDemo'), + TextSpan(style: codeStyle.punctuationStyle, text: '>'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'with'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.classStyle, text: 'SingleTickerProviderStateMixin'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorationMixin'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'TabController'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'RestorableInt'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'String'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'get'), + TextSpan(style: codeStyle.baseStyle, text: ' restorationId '), + TextSpan(style: codeStyle.punctuationStyle, text: '=>'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027tab_non_scrollable_demo\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' restoreState'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'RestorationBucket'), + TextSpan(style: codeStyle.baseStyle, text: ' oldBucket'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'bool'), + TextSpan(style: codeStyle.baseStyle, text: ' initialRestore'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a registerForRestoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.stringStyle, text: '\u0027tab_index\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' initState'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'TabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a initialIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a length'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '12'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a vsync'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'this'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'addListener'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), + TextSpan(style: codeStyle.punctuationStyle, text: '(()'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index'), + 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.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'initState'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'void'), + TextSpan(style: codeStyle.baseStyle, text: ' dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '()'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'super'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'dispose'), + TextSpan(style: codeStyle.punctuationStyle, text: '();'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.classStyle, text: 'Widget'), @@ -37292,6 +38090,30 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'if'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '_tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index '), + TextSpan(style: codeStyle.punctuationStyle, text: '!='), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'index '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' tabIndex'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'value'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'final'), TextSpan(style: codeStyle.baseStyle, text: ' tabs '), TextSpan(style: codeStyle.punctuationStyle, text: '='), @@ -37410,32 +38232,21 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), - TextSpan(style: codeStyle.classStyle, text: 'DefaultTabController'), - TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a length'), - TextSpan(style: codeStyle.punctuationStyle, text: ':'), - TextSpan(style: codeStyle.baseStyle, text: ' tabs'), - TextSpan(style: codeStyle.punctuationStyle, text: '.'), - TextSpan(style: codeStyle.baseStyle, text: 'length'), - 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: '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'), @@ -37448,22 +38259,26 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ').'), TextSpan(style: codeStyle.baseStyle, text: 'demoTabsScrollingTitle'), TextSpan(style: codeStyle.punctuationStyle, text: '),'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a bottom'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TabBar'), TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), TextSpan( - style: codeStyle.baseStyle, text: '\u000a isScrollable'), + style: codeStyle.baseStyle, text: '\u000a isScrollable'), 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 tabs'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a tabs'), 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: 'for'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -37479,22 +38294,26 @@ class CodeSegments { TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' tab'), 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 body'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a body'), TextSpan(style: codeStyle.punctuationStyle, text: ':'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'TabBarView'), TextSpan(style: codeStyle.punctuationStyle, text: '('), - TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a controller'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' _tabController'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), 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: 'for'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), @@ -37503,22 +38322,20 @@ class CodeSegments { TextSpan(style: codeStyle.keywordStyle, text: 'in'), TextSpan(style: codeStyle.baseStyle, text: ' tabs'), TextSpan(style: codeStyle.punctuationStyle, text: ')'), - TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), 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: 'Text'), TextSpan(style: codeStyle.punctuationStyle, text: '('), TextSpan(style: codeStyle.baseStyle, text: 'tab'), 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.punctuationStyle, text: '],'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.punctuationStyle, text: '),'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), @@ -37603,6 +38420,13 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: + '// TODO(shihaohong): Implement state restoration for TextFormField'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.commentStyle, text: '// on the framework.'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'return'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.classStyle, text: 'Scaffold'), From 5bc74ce3e624c88ced4b3db53c9a441104fab2f5 Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Sun, 6 Dec 2020 20:20:04 +0800 Subject: [PATCH 11/12] Code review comments + inline code comments --- lib/codeviewer/code_segments.dart | 22 ++++++++++++++++++++-- lib/demos/material/navigation_drawer.dart | 2 +- lib/demos/material/tabs_demo.dart | 6 +++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index 66b915bdff..cf8e0deb13 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -26965,7 +26965,7 @@ class CodeSegments { TextSpan( style: codeStyle.commentStyle, text: - '// Pressing the Navigation Drawer button the left of AppBar to show'), + '// Press the Navigation Drawer button to the left of AppBar to show'), TextSpan(style: codeStyle.baseStyle, text: '\u000a'), TextSpan( style: codeStyle.commentStyle, @@ -37973,7 +37973,7 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan( style: codeStyle.stringStyle, - text: '\u0027tab_non_scrollable_demo\u0027'), + text: '\u0027tab_scrollable_demo\u0027'), TextSpan(style: codeStyle.punctuationStyle, text: ';'), TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a '), TextSpan(style: codeStyle.keywordStyle, text: '@override'), @@ -38036,6 +38036,15 @@ 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.commentStyle, + text: + '// When the tab controller\u0027s value is updated, make sure to update the'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: '// tab index value, which is state restorable.'), TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), TextSpan(style: codeStyle.punctuationStyle, text: '(()'), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -38090,6 +38099,15 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: + '// Ensures that the tab controller\u0027s index is updated with the'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: '// state restorable tab index value.'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'if'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), diff --git a/lib/demos/material/navigation_drawer.dart b/lib/demos/material/navigation_drawer.dart index 3d8b7e2876..88e03d3fd3 100644 --- a/lib/demos/material/navigation_drawer.dart +++ b/lib/demos/material/navigation_drawer.dart @@ -8,7 +8,7 @@ import 'package:flutter/cupertino.dart'; // BEGIN navDrawerDemo -// Pressing the Navigation Drawer button the left of AppBar to show +// Press the Navigation Drawer button to the left of AppBar to show // a simple Drawer with two items. class NavDrawerDemo extends StatelessWidget { const NavDrawerDemo({Key key}) : super(key: key); diff --git a/lib/demos/material/tabs_demo.dart b/lib/demos/material/tabs_demo.dart index a43312173a..ff82d1e5f5 100644 --- a/lib/demos/material/tabs_demo.dart +++ b/lib/demos/material/tabs_demo.dart @@ -43,7 +43,7 @@ class __TabsScrollableDemoState extends State<_TabsScrollableDemo> final RestorableInt tabIndex = RestorableInt(0); @override - String get restorationId => 'tab_non_scrollable_demo'; + String get restorationId => 'tab_scrollable_demo'; @override void restoreState(RestorationBucket oldBucket, bool initialRestore) { @@ -58,6 +58,8 @@ class __TabsScrollableDemoState extends State<_TabsScrollableDemo> vsync: this, ); _tabController.addListener(() { + // When the tab controller's value is updated, make sure to update the + // tab index value, which is state restorable. setState(() { tabIndex.value = _tabController.index; }); @@ -73,6 +75,8 @@ class __TabsScrollableDemoState extends State<_TabsScrollableDemo> @override Widget build(BuildContext context) { + // Ensures that the tab controller's index is updated with the + // state restorable tab index value. if (_tabController.index != tabIndex.value) { _tabController.index = tabIndex.value; } From 20f74066167dc17674383c3b8dec2946dd8d18ec Mon Sep 17 00:00:00 2001 From: Shi Hao Hong Date: Sun, 6 Dec 2020 20:21:58 +0800 Subject: [PATCH 12/12] More inline code comments --- lib/codeviewer/code_segments.dart | 18 ++++++++++++++++++ lib/demos/material/tabs_demo.dart | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/lib/codeviewer/code_segments.dart b/lib/codeviewer/code_segments.dart index cf8e0deb13..6cc414ccaa 100644 --- a/lib/codeviewer/code_segments.dart +++ b/lib/codeviewer/code_segments.dart @@ -37640,6 +37640,15 @@ 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.commentStyle, + text: + '// When the tab controller\u0027s value is updated, make sure to update the'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: '// tab index value, which is state restorable.'), TextSpan(style: codeStyle.baseStyle, text: '\u000a setState'), TextSpan(style: codeStyle.punctuationStyle, text: '(()'), TextSpan(style: codeStyle.baseStyle, text: ' '), @@ -37694,6 +37703,15 @@ class CodeSegments { TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '{'), TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: + '// Ensures that the tab controller\u0027s index is updated with the'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan( + style: codeStyle.commentStyle, + text: '// state restorable tab index value.'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), TextSpan(style: codeStyle.keywordStyle, text: 'if'), TextSpan(style: codeStyle.baseStyle, text: ' '), TextSpan(style: codeStyle.punctuationStyle, text: '('), diff --git a/lib/demos/material/tabs_demo.dart b/lib/demos/material/tabs_demo.dart index ff82d1e5f5..bf66dcc2ec 100644 --- a/lib/demos/material/tabs_demo.dart +++ b/lib/demos/material/tabs_demo.dart @@ -152,6 +152,8 @@ class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> vsync: this, ); _tabController.addListener(() { + // When the tab controller's value is updated, make sure to update the + // tab index value, which is state restorable. setState(() { tabIndex.value = _tabController.index; }); @@ -167,6 +169,8 @@ class __TabsNonScrollableDemoState extends State<_TabsNonScrollableDemo> @override Widget build(BuildContext context) { + // Ensures that the tab controller's index is updated with the + // state restorable tab index value. if (_tabController.index != tabIndex.value) { _tabController.index = tabIndex.value; }