Commit f0b8c866 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Fix gallery demo body centering (#6841)

parent e384c0d9
...@@ -119,7 +119,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -119,7 +119,7 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
}); });
} }
Widget _buildBody() { Widget _buildTransitionsStack() {
final List<FadeTransition> transitions = <FadeTransition>[]; final List<FadeTransition> transitions = <FadeTransition>[];
for (NavigationIconView view in _navigationViews) for (NavigationIconView view in _navigationViews)
...@@ -175,7 +175,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo> ...@@ -175,7 +175,9 @@ class _BottomNavigationDemoState extends State<BottomNavigationDemo>
) )
], ],
), ),
body: _buildBody(), body: new Center(
child: _buildTransitionsStack()
),
bottomNavigationBar: botNavBar, bottomNavigationBar: botNavBar,
); );
} }
......
...@@ -36,16 +36,18 @@ class _DatePickerDemoState extends State<DatePickerDemo> { ...@@ -36,16 +36,18 @@ class _DatePickerDemoState extends State<DatePickerDemo> {
return return
new Scaffold( new Scaffold(
appBar: new AppBar(title: new Text('Date picker')), appBar: new AppBar(title: new Text('Date picker')),
body: new Column( body: new Center(
children: <Widget>[ child: new Column(
new Text(new DateFormat.yMMMd().format(_selectedDate)), mainAxisAlignment: MainAxisAlignment.center,
new SizedBox(height: 20.0), children: <Widget>[
new RaisedButton( new Text(new DateFormat.yMMMd().format(_selectedDate)),
onPressed: _handleSelectDate, new SizedBox(height: 20.0),
child: new Text('SELECT DATE') new RaisedButton(
), onPressed: _handleSelectDate,
], child: new Text('SELECT DATE')
mainAxisAlignment: MainAxisAlignment.center ),
],
),
) )
); );
} }
......
...@@ -19,52 +19,54 @@ class _SliderDemoState extends State<SliderDemo> { ...@@ -19,52 +19,54 @@ class _SliderDemoState extends State<SliderDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Sliders')), appBar: new AppBar(title: new Text('Sliders')),
body: new Column( body: new Center(
mainAxisAlignment: MainAxisAlignment.spaceAround, child: new Column(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.spaceAround,
new Column( children: <Widget>[
mainAxisSize: MainAxisSize.min, new Column(
children: <Widget> [ mainAxisSize: MainAxisSize.min,
new Slider( children: <Widget> [
value: _value, new Slider(
min: 0.0, value: _value,
max: 100.0, min: 0.0,
onChanged: (double value) { max: 100.0,
setState(() { onChanged: (double value) {
_value = value; setState(() {
}); _value = value;
} });
), }
new Text('Continuous'), ),
] new Text('Continuous'),
), ]
new Column( ),
mainAxisSize: MainAxisSize.min, new Column(
children: <Widget> [ mainAxisSize: MainAxisSize.min,
new Slider(value: 0.25, onChanged: null), children: <Widget> [
new Text('Disabled'), new Slider(value: 0.25, onChanged: null),
] new Text('Disabled'),
), ]
new Column( ),
mainAxisSize: MainAxisSize.min, new Column(
children: <Widget> [ mainAxisSize: MainAxisSize.min,
new Slider( children: <Widget> [
value: _discreteValue, new Slider(
min: 0.0, value: _discreteValue,
max: 100.0, min: 0.0,
divisions: 5, max: 100.0,
label: '${_discreteValue.round()}', divisions: 5,
onChanged: (double value) { label: '${_discreteValue.round()}',
setState(() { onChanged: (double value) {
_discreteValue = value; setState(() {
}); _discreteValue = value;
} });
), }
new Text('Discrete'), ),
] new Text('Discrete'),
), ],
] ),
) ],
),
),
); );
} }
} }
...@@ -32,17 +32,19 @@ class _TimePickerDemoState extends State<TimePickerDemo> { ...@@ -32,17 +32,19 @@ class _TimePickerDemoState extends State<TimePickerDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Time picker')), appBar: new AppBar(title: new Text('Time picker')),
body: new Column( body: new Center(
mainAxisAlignment: MainAxisAlignment.center, child: new Column(
children: <Widget>[ mainAxisAlignment: MainAxisAlignment.center,
new Text('$_selectedTime'), children: <Widget>[
new SizedBox(height: 20.0), new Text('$_selectedTime'),
new RaisedButton( new SizedBox(height: 20.0),
onPressed: _handleSelectTime, new RaisedButton(
child: new Text('SELECT TIME') onPressed: _handleSelectTime,
), child: new Text('SELECT TIME')
] ),
) ],
),
),
); );
} }
} }
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