From 09506d563016aca8e7f37bdb7fab5ee07694b715 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Tue, 27 Sep 2016 12:31:00 -0700 Subject: [PATCH] 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 --- .../lib/demo/progress_indicator_demo.dart | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/examples/flutter_gallery/lib/demo/progress_indicator_demo.dart b/examples/flutter_gallery/lib/demo/progress_indicator_demo.dart index f4bb242f82..05619a21d5 100644 --- a/examples/flutter_gallery/lib/demo/progress_indicator_demo.dart +++ b/examples/flutter_gallery/lib/demo/progress_indicator_demo.dart @@ -63,26 +63,36 @@ class _ProgressIndicatorDemoState extends State with Sing Widget _buildIndicators(BuildContext context, Widget child) { List indicators = [ - new SizedBox( - width: 200.0, - child: new LinearProgressIndicator() - ), - new LinearProgressIndicator(), - new LinearProgressIndicator(), - new LinearProgressIndicator(value: _animation.value), - new CircularProgressIndicator(), - new SizedBox( - width: 20.0, + new SizedBox( + width: 200.0, + child: new LinearProgressIndicator() + ), + new LinearProgressIndicator(), + new LinearProgressIndicator(), + new LinearProgressIndicator(value: _animation.value), + new Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + new CircularProgressIndicator(), + new SizedBox( + width: 20.0, + height: 20.0, + child: new CircularProgressIndicator(value: _animation.value) + ), + new SizedBox( + width: 100.0, height: 20.0, - child: new CircularProgressIndicator(value: _animation.value) - ), - new Text('${(_animation.value * 100.0).toStringAsFixed(1)}%${ _controller.isAnimating ? "" : " (paused)" }') + child: new Text('${(_animation.value * 100.0).toStringAsFixed(1)}%', + textAlign: TextAlign.right + ), + ), + ], + ), ]; return new Column( children: indicators .map((Widget c) => new Container(child: c, margin: const EdgeInsets.symmetric(vertical: 15.0, horizontal: 20.0))) .toList(), - mainAxisAlignment: MainAxisAlignment.center ); } @@ -90,16 +100,20 @@ class _ProgressIndicatorDemoState extends State with Sing Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar(title: new Text('Progress indicators')), - body: new DefaultTextStyle( - style: Theme.of(context).textTheme.title, - child: new GestureDetector( - onTap: _handleTap, - behavior: HitTestBehavior.opaque, - child: new Container( - padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), - child: new AnimatedBuilder( - animation: _animation, - builder: _buildIndicators + body: new Center( + child: new ScrollableViewport( + child: new DefaultTextStyle( + style: Theme.of(context).textTheme.title, + child: new GestureDetector( + onTap: _handleTap, + behavior: HitTestBehavior.opaque, + child: new Container( + padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0), + child: new AnimatedBuilder( + animation: _animation, + builder: _buildIndicators + ) + ) ) ) )