Unverified Commit e478a547 authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Apply media padding in Gallery Pesto demo (#13668)

Applies horizontal safe area insets to the Pesto demo in the Gallery.
This is to support the iPhone X sensor housing notch and other similarly
creative display features when in landscape orientation.
parent 37f216bf
...@@ -137,7 +137,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> { ...@@ -137,7 +137,13 @@ class _RecipeGridPageState extends State<RecipeGridPage> {
} }
Widget _buildBody(BuildContext context, double statusBarHeight) { Widget _buildBody(BuildContext context, double statusBarHeight) {
final EdgeInsets padding = const EdgeInsets.all(8.0); final EdgeInsets mediaPadding = MediaQuery.of(context).padding;
final EdgeInsets padding = new EdgeInsets.only(
top: 8.0,
left: 8.0 + mediaPadding.left,
right: 8.0 + mediaPadding.right,
bottom: 8.0
);
return new SliverPadding( return new SliverPadding(
padding: padding, padding: padding,
sliver: new SliverGrid( sliver: new SliverGrid(
...@@ -432,69 +438,73 @@ class RecipeSheet extends StatelessWidget { ...@@ -432,69 +438,73 @@ class RecipeSheet extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Material( return new Material(
child: new Padding( child: new SafeArea(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 40.0), top: false,
child: new Table( bottom: false,
columnWidths: <int, TableColumnWidth>{ child: new Padding(
0: const FixedColumnWidth(64.0) padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 40.0),
}, child: new Table(
children: <TableRow>[ columnWidths: <int, TableColumnWidth>{
new TableRow( 0: const FixedColumnWidth(64.0)
children: <Widget>[ },
new TableCell( children: <TableRow>[
verticalAlignment: TableCellVerticalAlignment.middle, new TableRow(
child: new Image.asset( children: <Widget>[
recipe.ingredientsImagePath, new TableCell(
package: recipe.ingredientsImagePackage, verticalAlignment: TableCellVerticalAlignment.middle,
width: 32.0, child: new Image.asset(
height: 32.0, recipe.ingredientsImagePath,
alignment: Alignment.centerLeft, package: recipe.ingredientsImagePackage,
fit: BoxFit.scaleDown width: 32.0,
) height: 32.0,
), alignment: Alignment.centerLeft,
new TableCell( fit: BoxFit.scaleDown
verticalAlignment: TableCellVerticalAlignment.middle, )
child: new Text(recipe.name, style: titleStyle) ),
), new TableCell(
] verticalAlignment: TableCellVerticalAlignment.middle,
), child: new Text(recipe.name, style: titleStyle)
new TableRow( ),
children: <Widget>[ ]
const SizedBox(), ),
new Padding( new TableRow(
padding: const EdgeInsets.only(top: 8.0, bottom: 4.0), children: <Widget>[
child: new Text(recipe.description, style: descriptionStyle) const SizedBox(),
), new Padding(
] padding: const EdgeInsets.only(top: 8.0, bottom: 4.0),
), child: new Text(recipe.description, style: descriptionStyle)
new TableRow( ),
children: <Widget>[ ]
const SizedBox(), ),
new Padding( new TableRow(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0), children: <Widget>[
child: new Text('Ingredients', style: headingStyle) const SizedBox(),
), new Padding(
] padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
), child: new Text('Ingredients', style: headingStyle)
]..addAll(recipe.ingredients.map( ),
(RecipeIngredient ingredient) { ]
return _buildItemRow(ingredient.amount, ingredient.description); ),
} ]..addAll(recipe.ingredients.map(
))..add( (RecipeIngredient ingredient) {
new TableRow( return _buildItemRow(ingredient.amount, ingredient.description);
children: <Widget>[ }
const SizedBox(), ))..add(
new Padding( new TableRow(
padding: const EdgeInsets.only(top: 24.0, bottom: 4.0), children: <Widget>[
child: new Text('Steps', style: headingStyle) const SizedBox(),
), new Padding(
] padding: const EdgeInsets.only(top: 24.0, bottom: 4.0),
) child: new Text('Steps', style: headingStyle)
)..addAll(recipe.steps.map( ),
(RecipeStep step) { ]
return _buildItemRow(step.duration ?? '', step.description); )
} )..addAll(recipe.steps.map(
)), (RecipeStep step) {
return _buildItemRow(step.duration ?? '', step.description);
}
)),
),
), ),
), ),
); );
......
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