Commit 09506d56 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Progress indicator demo should look good in landscape (#6088)

This patch fixes the issue in two ways:

1. The content area is now scrollable, which means you can scroll to reveal any
   parts that don't fit on screen.
2. The content area is now small enough to fit on screen in landscape on a
   Nexus 5.

Fixes #6054
parent c7369a40
...@@ -63,26 +63,36 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing ...@@ -63,26 +63,36 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
Widget _buildIndicators(BuildContext context, Widget child) { Widget _buildIndicators(BuildContext context, Widget child) {
List<Widget> indicators = <Widget>[ List<Widget> indicators = <Widget>[
new SizedBox( new SizedBox(
width: 200.0, width: 200.0,
child: new LinearProgressIndicator() child: new LinearProgressIndicator()
), ),
new LinearProgressIndicator(), new LinearProgressIndicator(),
new LinearProgressIndicator(), new LinearProgressIndicator(),
new LinearProgressIndicator(value: _animation.value), new LinearProgressIndicator(value: _animation.value),
new CircularProgressIndicator(), new Row(
new SizedBox( mainAxisAlignment: MainAxisAlignment.spaceEvenly,
width: 20.0, children: <Widget>[
new CircularProgressIndicator(),
new SizedBox(
width: 20.0,
height: 20.0,
child: new CircularProgressIndicator(value: _animation.value)
),
new SizedBox(
width: 100.0,
height: 20.0, height: 20.0,
child: new CircularProgressIndicator(value: _animation.value) child: new Text('${(_animation.value * 100.0).toStringAsFixed(1)}%',
), textAlign: TextAlign.right
new Text('${(_animation.value * 100.0).toStringAsFixed(1)}%${ _controller.isAnimating ? "" : " (paused)" }') ),
),
],
),
]; ];
return new Column( return new Column(
children: indicators children: indicators
.map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0))) .map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0)))
.toList(), .toList(),
mainAxisAlignment: MainAxisAlignment.center
); );
} }
...@@ -90,16 +100,20 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing ...@@ -90,16 +100,20 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Scaffold( return new Scaffold(
appBar: new AppBar(title: new Text('Progress indicators')), appBar: new AppBar(title: new Text('Progress indicators')),
body: new DefaultTextStyle( body: new Center(
style: Theme.of(context).textTheme.title, child: new ScrollableViewport(
child: new GestureDetector( child: new DefaultTextStyle(
onTap: _handleTap, style: Theme.of(context).textTheme.title,
behavior: HitTestBehavior.opaque, child: new GestureDetector(
child: new Container( onTap: _handleTap,
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), behavior: HitTestBehavior.opaque,
child: new AnimatedBuilder( child: new Container(
animation: _animation, padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
builder: _buildIndicators child: new AnimatedBuilder(
animation: _animation,
builder: _buildIndicators
)
)
) )
) )
) )
......
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