From 79cfe1e09250201e9e758dae5869f29844e20aed Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Sun, 3 Apr 2016 13:08:00 -0700 Subject: [PATCH] Make a variety of private State members actually private. --- .../lib/demo/buttons_demo.dart | 10 +++---- .../lib/demo/dialog_demo.dart | 8 +++--- .../lib/demo/drop_down_demo.dart | 6 ++-- .../lib/demo/fitness_demo.dart | 28 +++++++++---------- .../lib/demo/flexible_space_demo.dart | 20 ++++++------- .../lib/demo/full_screen_dialog_demo.dart | 28 +++++++++---------- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/examples/material_gallery/lib/demo/buttons_demo.dart b/examples/material_gallery/lib/demo/buttons_demo.dart index e4f103a9ec..b6e77bdf9d 100644 --- a/examples/material_gallery/lib/demo/buttons_demo.dart +++ b/examples/material_gallery/lib/demo/buttons_demo.dart @@ -63,12 +63,12 @@ class ButtonsDemo extends StatefulWidget { } class _ButtonsDemoState extends State { - List<_ButtonDemo> demos; + List<_ButtonDemo> _demos; @override void initState() { super.initState(); - demos = <_ButtonDemo>[ + _demos = <_ButtonDemo>[ new _ButtonDemo(title: 'FLOATING', text: _floatingText, builder: buildFloatingButton), new _ButtonDemo(title: 'RAISED', text: _raisedText, builder: buildRaisedButton), new _ButtonDemo(title: 'FLAT', text: _flatText, builder: buildFlatButton), @@ -198,17 +198,17 @@ class _ButtonsDemoState extends State { @override Widget build(BuildContext context) { return new TabBarSelection<_ButtonDemo>( - values: demos, + values: _demos, child: new Scaffold( appBar: new AppBar( title: new Text("Buttons"), tabBar: new TabBar<_ButtonDemo>( isScrollable: true, - labels: new Map<_ButtonDemo, TabLabel>.fromIterable(demos, value: (_ButtonDemo demo) => demo.tabLabel) + labels: new Map<_ButtonDemo, TabLabel>.fromIterable(_demos, value: (_ButtonDemo demo) => demo.tabLabel) ) ), body: new TabBarView<_ButtonDemo>( - children: demos.map(buildTabView).toList() + children: _demos.map(buildTabView).toList() ) ) ); diff --git a/examples/material_gallery/lib/demo/dialog_demo.dart b/examples/material_gallery/lib/demo/dialog_demo.dart index 8c141b1dae..7ff054ab30 100644 --- a/examples/material_gallery/lib/demo/dialog_demo.dart +++ b/examples/material_gallery/lib/demo/dialog_demo.dart @@ -60,7 +60,7 @@ class DialogDemo extends StatefulWidget { } class DialogDemoState extends State { - final GlobalKey scaffoldKey = new GlobalKey(); + final GlobalKey _scaffoldKey = new GlobalKey(); void showDemoDialog/**/({ BuildContext context, Dialog dialog }) { showDialog/**/( @@ -69,7 +69,7 @@ class DialogDemoState extends State { ) .then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null. if (value != null) { - scaffoldKey.currentState.showSnackBar(new SnackBar( + _scaffoldKey.currentState.showSnackBar(new SnackBar( content: new Text('You selected: $value') )); } @@ -82,7 +82,7 @@ class DialogDemoState extends State { final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); return new Scaffold( - key: scaffoldKey, + key: _scaffoldKey, appBar: new AppBar( title: new Text('Dialogs') ), @@ -179,7 +179,7 @@ class DialogDemoState extends State { ) .then((TimeOfDay value) { // The value passed to Navigator.pop() or null. if (value != null) { - scaffoldKey.currentState.showSnackBar(new SnackBar( + _scaffoldKey.currentState.showSnackBar(new SnackBar( content: new Text('You selected: $value') )); } diff --git a/examples/material_gallery/lib/demo/drop_down_demo.dart b/examples/material_gallery/lib/demo/drop_down_demo.dart index fe5a7c6695..02edbdcf18 100644 --- a/examples/material_gallery/lib/demo/drop_down_demo.dart +++ b/examples/material_gallery/lib/demo/drop_down_demo.dart @@ -10,7 +10,7 @@ class DropDownDemo extends StatefulWidget { } class _DropDownDemoState extends State { - String value = "Free"; + String _value = "Free"; List> buildItems() { return ["One", "Two", "Free", "Four"].map((String value) { @@ -26,11 +26,11 @@ class _DropDownDemoState extends State { body: new Center( child: new DropDownButton( items: buildItems(), - value: value, + value: _value, onChanged: (String newValue) { setState(() { if (newValue != null) - value = newValue; + _value = newValue; }); } ) diff --git a/examples/material_gallery/lib/demo/fitness_demo.dart b/examples/material_gallery/lib/demo/fitness_demo.dart index 962ad5eff0..129e259a13 100644 --- a/examples/material_gallery/lib/demo/fitness_demo.dart +++ b/examples/material_gallery/lib/demo/fitness_demo.dart @@ -53,16 +53,16 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { AssetBundle bundle = DefaultAssetBundle.of(context); _loadAssets(bundle).then((_) { setState(() { - assetsLoaded = true; + _assetsLoaded = true; workoutAnimation = new _WorkoutAnimationNode( onPerformedJumpingJack: () { setState(() { - count += 1; + _count += 1; }); }, onSecondPassed: (int seconds) { setState(() { - time = seconds; + _time = seconds; }); } ); @@ -70,16 +70,16 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { }); } - bool assetsLoaded = false; - int count = 0; - int time = 0; - int get kcal => (count * 0.2).toInt(); + bool _assetsLoaded = false; + int _count = 0; + int _time = 0; + int get kcal => (_count * 0.2).toInt(); _WorkoutAnimationNode workoutAnimation; @override Widget build(BuildContext context) { - if (!assetsLoaded) + if (!_assetsLoaded) return new Container(); Color buttonColor; @@ -115,8 +115,8 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { child: new Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - _createInfoPanelCell(Icons.accessibility, '$count', 'COUNT'), - _createInfoPanelCell(Icons.timer, _formatSeconds(time), 'TIME'), + _createInfoPanelCell(Icons.accessibility, '$_count', 'COUNT'), + _createInfoPanelCell(Icons.timer, _formatSeconds(_time), 'TIME'), _createInfoPanelCell(Icons.flash_on, '$kcal', 'KCAL') ] ) @@ -170,8 +170,8 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { void startWorkout() { setState(() { - count = 0; - time = 0; + _count = 0; + _time = 0; workoutAnimation.start(); }); } @@ -180,14 +180,14 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { setState(() { workoutAnimation.stop(); - if (count >= 3) { + if (_count >= 3) { showDialog( context: context, child: new Stack(children: [ new _Fireworks(), new Dialog( title: new Text("Awesome workout"), - content: new Text("You have completed $count jumping jacks. Good going!"), + content: new Text("You have completed $_count jumping jacks. Good going!"), actions: [ new FlatButton( child: new Text("SWEET"), diff --git a/examples/material_gallery/lib/demo/flexible_space_demo.dart b/examples/material_gallery/lib/demo/flexible_space_demo.dart index 762d639617..3fcd018e16 100644 --- a/examples/material_gallery/lib/demo/flexible_space_demo.dart +++ b/examples/material_gallery/lib/demo/flexible_space_demo.dart @@ -75,9 +75,9 @@ class FlexibleSpaceDemo extends StatefulWidget { } class FlexibleSpaceDemoState extends State { - final GlobalKey scaffoldKey = new GlobalKey(); - final double appBarHeight = 256.0; - final Key scrollableKey = new UniqueKey(); + final GlobalKey _scaffoldKey = new GlobalKey(); + final double _appBarHeight = 256.0; + final Key _scrollableKey = new UniqueKey(); AppBarBehavior _appBarBehavior = AppBarBehavior.scroll; @override @@ -89,17 +89,17 @@ class FlexibleSpaceDemoState extends State { primarySwatch: Colors.indigo ), child: new Scaffold( - key: scaffoldKey, - scrollableKey: scrollableKey, + key: _scaffoldKey, + scrollableKey: _scrollableKey, appBarBehavior: _appBarBehavior, appBar: new AppBar( - expandedHeight: appBarHeight, + expandedHeight: _appBarHeight, actions: [ new IconButton( icon: Icons.create, tooltip: 'Search', onPressed: () { - scaffoldKey.currentState.showSnackBar(new SnackBar( + _scaffoldKey.currentState.showSnackBar(new SnackBar( content: new Text('Not supported.') )); } @@ -128,14 +128,14 @@ class FlexibleSpaceDemoState extends State { image: new AssetImage( name: 'packages/flutter_gallery_assets/ali_connors.png', fit: ImageFit.cover, - height: appBarHeight + height: _appBarHeight ) ); } ), body: new Block( - scrollableKey: scrollableKey, - padding: new EdgeInsets.only(top: appBarHeight + statusBarHeight), + scrollableKey: _scrollableKey, + padding: new EdgeInsets.only(top: _appBarHeight + statusBarHeight), children: [ new _ContactCategory( icon: Icons.call, diff --git a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart index ba75af7728..e83259c873 100644 --- a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart +++ b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart @@ -99,13 +99,13 @@ class FullScreenDialogDemo extends StatefulWidget { } class FullScreenDialogDemoState extends State { - DateTime fromDateTime = new DateTime.now(); - DateTime toDateTime = new DateTime.now(); - bool allDayValue = false; - bool saveNeeded = false; + DateTime _fromDateTime = new DateTime.now(); + DateTime _toDateTime = new DateTime.now(); + bool _allDayValue = false; + bool _saveNeeded = false; void handleDismissButton(BuildContext context) { - if (!saveNeeded) { + if (!_saveNeeded) { Navigator.pop(context, null); return; } @@ -192,11 +192,11 @@ class FullScreenDialogDemoState extends State { children: [ new Text('From', style: theme.textTheme.caption), new DateTimeItem( - dateTime: fromDateTime, + dateTime: _fromDateTime, onChanged: (DateTime value) { setState(() { - fromDateTime = value; - saveNeeded = true; + _fromDateTime = value; + _saveNeeded = true; }); } ) @@ -208,11 +208,11 @@ class FullScreenDialogDemoState extends State { children: [ new Text('To', style: theme.textTheme.caption), new DateTimeItem( - dateTime: toDateTime, + dateTime: _toDateTime, onChanged: (DateTime value) { setState(() { - toDateTime = value; - saveNeeded = true; + _toDateTime = value; + _saveNeeded = true; }); } ) @@ -225,11 +225,11 @@ class FullScreenDialogDemoState extends State { child: new Row( children: [ new Checkbox( - value: allDayValue, + value: _allDayValue, onChanged: (bool value) { setState(() { - allDayValue = value; - saveNeeded = true; + _allDayValue = value; + _saveNeeded = true; }); } ),