From fc03057b1ab2bc94d8a9b49ea9f16779c5721e63 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Fri, 28 Oct 2016 12:05:01 -0700 Subject: [PATCH] Avoid known wide gallery title issues (#6534) --- .../lib/demo/grid_list_demo.dart | 21 ++++++++++++++++--- .../lib/demo/leave_behind_demo.dart | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/examples/flutter_gallery/lib/demo/grid_list_demo.dart b/examples/flutter_gallery/lib/demo/grid_list_demo.dart index 26b8a06f28..4043bd9135 100644 --- a/examples/flutter_gallery/lib/demo/grid_list_demo.dart +++ b/examples/flutter_gallery/lib/demo/grid_list_demo.dart @@ -37,6 +37,21 @@ class GridPhotoViewer extends StatefulWidget { _GridPhotoViewerState createState() => new _GridPhotoViewerState(); } +class _GridTitleText extends StatelessWidget { + _GridTitleText(this.text); + + final String text; + + @override + Widget build(BuildContext context) { + return new FittedBox( + fit: ImageFit.scaleDown, + alignment: FractionalOffset.centerLeft, + child: new Text(text), + ); + } +} + class _GridPhotoViewerState extends State with SingleTickerProviderStateMixin { AnimationController _controller; Animation _flingAnimation; @@ -180,7 +195,7 @@ class GridDemoPhotoItem extends StatelessWidget { header: new GestureDetector( onTap: () { onBannerTap(photo); }, child: new GridTileBar( - title: new Text(photo.title), + title: new _GridTitleText(photo.title), backgroundColor: Colors.black45, leading: new Icon( icon, @@ -197,8 +212,8 @@ class GridDemoPhotoItem extends StatelessWidget { onTap: () { onBannerTap(photo); }, child: new GridTileBar( backgroundColor: Colors.black45, - title: new Text(photo.title), - subtitle: new Text(photo.caption), + title: new _GridTitleText(photo.title), + subtitle: new _GridTitleText(photo.caption), trailing: new Icon( icon, color: Colors.white diff --git a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart index c67d1e26c2..69f235a988 100644 --- a/examples/flutter_gallery/lib/demo/leave_behind_demo.dart +++ b/examples/flutter_gallery/lib/demo/leave_behind_demo.dart @@ -134,7 +134,7 @@ class LeaveBehindDemoState extends State { key: _scaffoldKey, scrollableKey: _scrollableKey, appBar: new AppBar( - title: new Text('Swipe items to dismiss'), + title: new Text('Swipe to dismiss'), actions: [ new PopupMenuButton( onSelected: handleDemoAction,