Make a variety of private State members actually private.
This commit is contained in:
parent
7f2efb2cfd
commit
79cfe1e092
@ -63,12 +63,12 @@ class ButtonsDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ButtonsDemoState extends State<ButtonsDemo> {
|
class _ButtonsDemoState extends State<ButtonsDemo> {
|
||||||
List<_ButtonDemo> demos;
|
List<_ButtonDemo> _demos;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
demos = <_ButtonDemo>[
|
_demos = <_ButtonDemo>[
|
||||||
new _ButtonDemo(title: 'FLOATING', text: _floatingText, builder: buildFloatingButton),
|
new _ButtonDemo(title: 'FLOATING', text: _floatingText, builder: buildFloatingButton),
|
||||||
new _ButtonDemo(title: 'RAISED', text: _raisedText, builder: buildRaisedButton),
|
new _ButtonDemo(title: 'RAISED', text: _raisedText, builder: buildRaisedButton),
|
||||||
new _ButtonDemo(title: 'FLAT', text: _flatText, builder: buildFlatButton),
|
new _ButtonDemo(title: 'FLAT', text: _flatText, builder: buildFlatButton),
|
||||||
@ -198,17 +198,17 @@ class _ButtonsDemoState extends State<ButtonsDemo> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new TabBarSelection<_ButtonDemo>(
|
return new TabBarSelection<_ButtonDemo>(
|
||||||
values: demos,
|
values: _demos,
|
||||||
child: new Scaffold(
|
child: new Scaffold(
|
||||||
appBar: new AppBar(
|
appBar: new AppBar(
|
||||||
title: new Text("Buttons"),
|
title: new Text("Buttons"),
|
||||||
tabBar: new TabBar<_ButtonDemo>(
|
tabBar: new TabBar<_ButtonDemo>(
|
||||||
isScrollable: true,
|
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>(
|
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> {
|
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 }) {
|
void showDemoDialog/*<T>*/({ BuildContext context, Dialog dialog }) {
|
||||||
showDialog/*<T>*/(
|
showDialog/*<T>*/(
|
||||||
@ -69,7 +69,7 @@ class DialogDemoState extends State<DialogDemo> {
|
|||||||
)
|
)
|
||||||
.then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null.
|
.then((dynamic/*=T*/ value) { // The value passed to Navigator.pop() or null.
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
scaffoldKey.currentState.showSnackBar(new SnackBar(
|
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||||
content: new Text('You selected: $value')
|
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);
|
final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color);
|
||||||
|
|
||||||
return new Scaffold(
|
return new Scaffold(
|
||||||
key: scaffoldKey,
|
key: _scaffoldKey,
|
||||||
appBar: new AppBar(
|
appBar: new AppBar(
|
||||||
title: new Text('Dialogs')
|
title: new Text('Dialogs')
|
||||||
),
|
),
|
||||||
@ -179,7 +179,7 @@ class DialogDemoState extends State<DialogDemo> {
|
|||||||
)
|
)
|
||||||
.then((TimeOfDay value) { // The value passed to Navigator.pop() or null.
|
.then((TimeOfDay value) { // The value passed to Navigator.pop() or null.
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
scaffoldKey.currentState.showSnackBar(new SnackBar(
|
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||||
content: new Text('You selected: $value')
|
content: new Text('You selected: $value')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class DropDownDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _DropDownDemoState extends State<DropDownDemo> {
|
class _DropDownDemoState extends State<DropDownDemo> {
|
||||||
String value = "Free";
|
String _value = "Free";
|
||||||
|
|
||||||
List<DropDownMenuItem<String>> buildItems() {
|
List<DropDownMenuItem<String>> buildItems() {
|
||||||
return <String>["One", "Two", "Free", "Four"].map((String value) {
|
return <String>["One", "Two", "Free", "Four"].map((String value) {
|
||||||
@ -26,11 +26,11 @@ class _DropDownDemoState extends State<DropDownDemo> {
|
|||||||
body: new Center(
|
body: new Center(
|
||||||
child: new DropDownButton<String>(
|
child: new DropDownButton<String>(
|
||||||
items: buildItems(),
|
items: buildItems(),
|
||||||
value: value,
|
value: _value,
|
||||||
onChanged: (String newValue) {
|
onChanged: (String newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (newValue != null)
|
if (newValue != null)
|
||||||
value = newValue;
|
_value = newValue;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -53,16 +53,16 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
|||||||
AssetBundle bundle = DefaultAssetBundle.of(context);
|
AssetBundle bundle = DefaultAssetBundle.of(context);
|
||||||
_loadAssets(bundle).then((_) {
|
_loadAssets(bundle).then((_) {
|
||||||
setState(() {
|
setState(() {
|
||||||
assetsLoaded = true;
|
_assetsLoaded = true;
|
||||||
workoutAnimation = new _WorkoutAnimationNode(
|
workoutAnimation = new _WorkoutAnimationNode(
|
||||||
onPerformedJumpingJack: () {
|
onPerformedJumpingJack: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
count += 1;
|
_count += 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSecondPassed: (int seconds) {
|
onSecondPassed: (int seconds) {
|
||||||
setState(() {
|
setState(() {
|
||||||
time = seconds;
|
_time = seconds;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -70,16 +70,16 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool assetsLoaded = false;
|
bool _assetsLoaded = false;
|
||||||
int count = 0;
|
int _count = 0;
|
||||||
int time = 0;
|
int _time = 0;
|
||||||
int get kcal => (count * 0.2).toInt();
|
int get kcal => (_count * 0.2).toInt();
|
||||||
|
|
||||||
_WorkoutAnimationNode workoutAnimation;
|
_WorkoutAnimationNode workoutAnimation;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!assetsLoaded)
|
if (!_assetsLoaded)
|
||||||
return new Container();
|
return new Container();
|
||||||
|
|
||||||
Color buttonColor;
|
Color buttonColor;
|
||||||
@ -115,8 +115,8 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
|||||||
child: new Row(
|
child: new Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_createInfoPanelCell(Icons.accessibility, '$count', 'COUNT'),
|
_createInfoPanelCell(Icons.accessibility, '$_count', 'COUNT'),
|
||||||
_createInfoPanelCell(Icons.timer, _formatSeconds(time), 'TIME'),
|
_createInfoPanelCell(Icons.timer, _formatSeconds(_time), 'TIME'),
|
||||||
_createInfoPanelCell(Icons.flash_on, '$kcal', 'KCAL')
|
_createInfoPanelCell(Icons.flash_on, '$kcal', 'KCAL')
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -170,8 +170,8 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
|||||||
|
|
||||||
void startWorkout() {
|
void startWorkout() {
|
||||||
setState(() {
|
setState(() {
|
||||||
count = 0;
|
_count = 0;
|
||||||
time = 0;
|
_time = 0;
|
||||||
workoutAnimation.start();
|
workoutAnimation.start();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -180,14 +180,14 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
workoutAnimation.stop();
|
workoutAnimation.stop();
|
||||||
|
|
||||||
if (count >= 3) {
|
if (_count >= 3) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
child: new Stack(children: <Widget>[
|
child: new Stack(children: <Widget>[
|
||||||
new _Fireworks(),
|
new _Fireworks(),
|
||||||
new Dialog(
|
new Dialog(
|
||||||
title: new Text("Awesome workout"),
|
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>[
|
actions: <Widget>[
|
||||||
new FlatButton(
|
new FlatButton(
|
||||||
child: new Text("SWEET"),
|
child: new Text("SWEET"),
|
||||||
|
@ -75,9 +75,9 @@ class FlexibleSpaceDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
||||||
final GlobalKey<ScaffoldState> scaffoldKey = new GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||||
final double appBarHeight = 256.0;
|
final double _appBarHeight = 256.0;
|
||||||
final Key scrollableKey = new UniqueKey();
|
final Key _scrollableKey = new UniqueKey();
|
||||||
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
|
AppBarBehavior _appBarBehavior = AppBarBehavior.scroll;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -89,17 +89,17 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
|||||||
primarySwatch: Colors.indigo
|
primarySwatch: Colors.indigo
|
||||||
),
|
),
|
||||||
child: new Scaffold(
|
child: new Scaffold(
|
||||||
key: scaffoldKey,
|
key: _scaffoldKey,
|
||||||
scrollableKey: scrollableKey,
|
scrollableKey: _scrollableKey,
|
||||||
appBarBehavior: _appBarBehavior,
|
appBarBehavior: _appBarBehavior,
|
||||||
appBar: new AppBar(
|
appBar: new AppBar(
|
||||||
expandedHeight: appBarHeight,
|
expandedHeight: _appBarHeight,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
new IconButton(
|
new IconButton(
|
||||||
icon: Icons.create,
|
icon: Icons.create,
|
||||||
tooltip: 'Search',
|
tooltip: 'Search',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
scaffoldKey.currentState.showSnackBar(new SnackBar(
|
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||||
content: new Text('Not supported.')
|
content: new Text('Not supported.')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -128,14 +128,14 @@ class FlexibleSpaceDemoState extends State<FlexibleSpaceDemo> {
|
|||||||
image: new AssetImage(
|
image: new AssetImage(
|
||||||
name: 'packages/flutter_gallery_assets/ali_connors.png',
|
name: 'packages/flutter_gallery_assets/ali_connors.png',
|
||||||
fit: ImageFit.cover,
|
fit: ImageFit.cover,
|
||||||
height: appBarHeight
|
height: _appBarHeight
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
body: new Block(
|
body: new Block(
|
||||||
scrollableKey: scrollableKey,
|
scrollableKey: _scrollableKey,
|
||||||
padding: new EdgeInsets.only(top: appBarHeight + statusBarHeight),
|
padding: new EdgeInsets.only(top: _appBarHeight + statusBarHeight),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new _ContactCategory(
|
new _ContactCategory(
|
||||||
icon: Icons.call,
|
icon: Icons.call,
|
||||||
|
@ -99,13 +99,13 @@ class FullScreenDialogDemo extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||||
DateTime fromDateTime = new DateTime.now();
|
DateTime _fromDateTime = new DateTime.now();
|
||||||
DateTime toDateTime = new DateTime.now();
|
DateTime _toDateTime = new DateTime.now();
|
||||||
bool allDayValue = false;
|
bool _allDayValue = false;
|
||||||
bool saveNeeded = false;
|
bool _saveNeeded = false;
|
||||||
|
|
||||||
void handleDismissButton(BuildContext context) {
|
void handleDismissButton(BuildContext context) {
|
||||||
if (!saveNeeded) {
|
if (!_saveNeeded) {
|
||||||
Navigator.pop(context, null);
|
Navigator.pop(context, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -192,11 +192,11 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('From', style: theme.textTheme.caption),
|
new Text('From', style: theme.textTheme.caption),
|
||||||
new DateTimeItem(
|
new DateTimeItem(
|
||||||
dateTime: fromDateTime,
|
dateTime: _fromDateTime,
|
||||||
onChanged: (DateTime value) {
|
onChanged: (DateTime value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
fromDateTime = value;
|
_fromDateTime = value;
|
||||||
saveNeeded = true;
|
_saveNeeded = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -208,11 +208,11 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Text('To', style: theme.textTheme.caption),
|
new Text('To', style: theme.textTheme.caption),
|
||||||
new DateTimeItem(
|
new DateTimeItem(
|
||||||
dateTime: toDateTime,
|
dateTime: _toDateTime,
|
||||||
onChanged: (DateTime value) {
|
onChanged: (DateTime value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
toDateTime = value;
|
_toDateTime = value;
|
||||||
saveNeeded = true;
|
_saveNeeded = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -225,11 +225,11 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
|||||||
child: new Row(
|
child: new Row(
|
||||||
children: <Widget> [
|
children: <Widget> [
|
||||||
new Checkbox(
|
new Checkbox(
|
||||||
value: allDayValue,
|
value: _allDayValue,
|
||||||
onChanged: (bool value) {
|
onChanged: (bool value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
allDayValue = value;
|
_allDayValue = value;
|
||||||
saveNeeded = true;
|
_saveNeeded = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user