Add Container.align and Container.position (#5128)
These let you add Align widget to the inside or outside of a container. Several customers have asked for these properties. Fixes #4950
This commit is contained in:
@@ -166,20 +166,16 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
child: new Align(
|
||||
alignment: FractionalOffset.bottomLeft,
|
||||
child: new Text('Event name', style: theme.textTheme.display2)
|
||||
)
|
||||
align: FractionalOffset.bottomLeft,
|
||||
child: new Text('Event name', style: theme.textTheme.display2)
|
||||
),
|
||||
new Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border(bottom: new BorderSide(color: theme.dividerColor))
|
||||
),
|
||||
child: new Align(
|
||||
alignment: FractionalOffset.bottomLeft,
|
||||
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
|
||||
)
|
||||
align: FractionalOffset.bottomLeft,
|
||||
child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54))
|
||||
),
|
||||
new Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -331,7 +331,7 @@ class _RecipePageState extends State<_RecipePage> {
|
||||
const double fabHalfSize = 28.0; // TODO(mpcomplete): needs to adapt to screen size
|
||||
return new Hero(
|
||||
tag: config.recipe.imagePath,
|
||||
child: new DecoratedBox(
|
||||
child: new Container(
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: Theme.of(context).canvasColor,
|
||||
backgroundImage: new BackgroundImage(
|
||||
@@ -340,33 +340,31 @@ class _RecipePageState extends State<_RecipePage> {
|
||||
fit: fullWidth ? ImageFit.fitWidth : ImageFit.cover
|
||||
)
|
||||
),
|
||||
child: new Align(
|
||||
alignment: FractionalOffset.bottomCenter,
|
||||
child: new Block(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: _getAppBarHeight(context)),
|
||||
child: new Stack(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: fabHalfSize),
|
||||
child: new SizedBox(
|
||||
width: fullWidth ? null : _kRecipePageMaxWidth,
|
||||
child: new _RecipeSheet(recipe: config.recipe)
|
||||
)
|
||||
),
|
||||
new Positioned(
|
||||
right: 16.0,
|
||||
child: new FloatingActionButton(
|
||||
child: new Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
|
||||
onPressed: _toggleFavorite
|
||||
)
|
||||
align: FractionalOffset.bottomCenter,
|
||||
child: new Block(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: _getAppBarHeight(context)),
|
||||
child: new Stack(
|
||||
children: <Widget>[
|
||||
new Padding(
|
||||
padding: new EdgeInsets.only(top: fabHalfSize),
|
||||
child: new SizedBox(
|
||||
width: fullWidth ? null : _kRecipePageMaxWidth,
|
||||
child: new _RecipeSheet(recipe: config.recipe)
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
new Positioned(
|
||||
right: 16.0,
|
||||
child: new FloatingActionButton(
|
||||
child: new Icon(isFavorite ? Icons.favorite : Icons.favorite_border),
|
||||
onPressed: _toggleFavorite
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -71,10 +71,8 @@ class GalleryHomeState extends State<GalleryHome> {
|
||||
new Container(
|
||||
height: 48.0,
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
child: new Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: new Text(galleryItem.category, style: headerStyle)
|
||||
)
|
||||
align: FractionalOffset.centerLeft,
|
||||
child: new Text(galleryItem.category, style: headerStyle)
|
||||
)
|
||||
);
|
||||
category = galleryItem.category;
|
||||
|
||||
Reference in New Issue
Block a user