Commit 79cfe1e0 authored by Ian Hickson's avatar Ian Hickson

Make a variety of private State members actually private.

parent 7f2efb2c
......@@ -63,12 +63,12 @@ class ButtonsDemo extends StatefulWidget {
}
class _ButtonsDemoState extends State<ButtonsDemo> {
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<ButtonsDemo> {
@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()
)
)
);
......
......@@ -60,7 +60,7 @@ class DialogDemo extends StatefulWidget {
}
class DialogDemoState extends State<DialogDemo> {
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
void showDemoDialog/*<T>*/({ BuildContext context, Dialog dialog }) {
showDialog/*<T>*/(
......@@ -69,7 +69,7 @@ class DialogDemoState extends State<DialogDemo> {
)
.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<DialogDemo> {
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<DialogDemo> {
)
.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')
));
}
......
......@@ -10,7 +10,7 @@ class DropDownDemo extends StatefulWidget {
}
class _DropDownDemoState extends State<DropDownDemo> {
String value = "Free";
String _value = "Free";
List<DropDownMenuItem<String>> buildItems() {
return <String>["One", "Two", "Free", "Four"].map((String value) {
......@@ -26,11 +26,11 @@ class _DropDownDemoState extends State<DropDownDemo> {
body: new Center(
child: new DropDownButton<String>(
items: buildItems(),
value: value,
value: _value,
onChanged: (String newValue) {
setState(() {
if (newValue != null)
value = newValue;
_value = newValue;
});
}
)
......
......@@ -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: <Widget>[
_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: <Widget>[
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: <Widget>[
new FlatButton(
child: new Text("SWEET"),
......
......@@ -75,9 +75,9 @@ class FlexibleSpaceDemo extends StatefulWidget {
}
class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
final double appBarHeight = 256.0;
final Key scrollableKey = new UniqueKey();
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final double _appBarHeight = 256.0;
final Key _scrollableKey = new UniqueKey();
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
@override
......@@ -89,17 +89,17 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
primarySwatch: Colors.indigo
),
child: new Scaffold(
key: scaffoldKey,
scrollableKey: scrollableKey,
key: _scaffoldKey,
scrollableKey: _scrollableKey,
appBarBehavior: _appBarBehavior,
appBar: new AppBar(
expandedHeight: appBarHeight,
expandedHeight: _appBarHeight,
actions: <Widget>[
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<FlexibleSpaceDemo> {
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: <Widget>[
new _ContactCategory(
icon: Icons.call,
......
......@@ -99,13 +99,13 @@ class FullScreenDialogDemo extends StatefulWidget {
}
class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
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<FullScreenDialogDemo> {
children: <Widget>[
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<FullScreenDialogDemo> {
children: <Widget>[
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<FullScreenDialogDemo> {
child: new Row(
children: <Widget> [
new Checkbox(
value: allDayValue,
value: _allDayValue,
onChanged: (bool value) {
setState(() {
allDayValue = value;
saveNeeded = true;
_allDayValue = value;
_saveNeeded = true;
});
}
),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment