Commit fc03057b authored by Hans Muller's avatar Hans Muller Committed by Adam Barth

Avoid known wide gallery title issues (#6534)

parent 639ba0dd
...@@ -37,6 +37,21 @@ class GridPhotoViewer extends StatefulWidget { ...@@ -37,6 +37,21 @@ class GridPhotoViewer extends StatefulWidget {
_GridPhotoViewerState createState() => new _GridPhotoViewerState(); _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<GridPhotoViewer> with SingleTickerProviderStateMixin { class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProviderStateMixin {
AnimationController _controller; AnimationController _controller;
Animation<Offset> _flingAnimation; Animation<Offset> _flingAnimation;
...@@ -180,7 +195,7 @@ class GridDemoPhotoItem extends StatelessWidget { ...@@ -180,7 +195,7 @@ class GridDemoPhotoItem extends StatelessWidget {
header: new GestureDetector( header: new GestureDetector(
onTap: () { onBannerTap(photo); }, onTap: () { onBannerTap(photo); },
child: new GridTileBar( child: new GridTileBar(
title: new Text(photo.title), title: new _GridTitleText(photo.title),
backgroundColor: Colors.black45, backgroundColor: Colors.black45,
leading: new Icon( leading: new Icon(
icon, icon,
...@@ -197,8 +212,8 @@ class GridDemoPhotoItem extends StatelessWidget { ...@@ -197,8 +212,8 @@ class GridDemoPhotoItem extends StatelessWidget {
onTap: () { onBannerTap(photo); }, onTap: () { onBannerTap(photo); },
child: new GridTileBar( child: new GridTileBar(
backgroundColor: Colors.black45, backgroundColor: Colors.black45,
title: new Text(photo.title), title: new _GridTitleText(photo.title),
subtitle: new Text(photo.caption), subtitle: new _GridTitleText(photo.caption),
trailing: new Icon( trailing: new Icon(
icon, icon,
color: Colors.white color: Colors.white
......
...@@ -134,7 +134,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> { ...@@ -134,7 +134,7 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
key: _scaffoldKey, key: _scaffoldKey,
scrollableKey: _scrollableKey, scrollableKey: _scrollableKey,
appBar: new AppBar( appBar: new AppBar(
title: new Text('Swipe items to dismiss'), title: new Text('Swipe to dismiss'),
actions: <Widget>[ actions: <Widget>[
new PopupMenuButton<LeaveBehindDemoAction>( new PopupMenuButton<LeaveBehindDemoAction>(
onSelected: handleDemoAction, onSelected: handleDemoAction,
......
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