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

Apply media padding to Gallery Material Design demos (#13593)

Applies media padding (e.g. iPhone X safe area insets) to the Material Design demos in the Gallery.

Covers the following demos:
* Buttons (via the TabbedComponentDemoScaffold change)
* Cards
* Expansion panels
* Grid list
* Icons
* Images (via the TabbedComponentDemoScaffold change)
* Page Selector
* Progress Indicator
* Scrollable tabs
* Selection controls (via the TabbedComponentDemoScaffold change)
* Snack bar
* Tabs
* Text fields
* Tooltips

Fixes #13594
parent d9edab84
......@@ -60,7 +60,10 @@ class TravelDestinationItem extends StatelessWidget {
final TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white);
final TextStyle descriptionStyle = theme.textTheme.subhead;
return new Container(
return new SafeArea(
top: false,
bottom: false,
child: new Container(
padding: const EdgeInsets.all(8.0),
height: height,
child: new Card(
......@@ -141,6 +144,7 @@ class TravelDestinationItem extends StatelessWidget {
],
),
),
),
);
}
}
......
......@@ -131,6 +131,9 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
return new Scaffold(
appBar: new AppBar(title: const Text('Date and time pickers')),
body: new DropdownButtonHideUnderline(
child: new SafeArea(
top: false,
bottom: false,
child: new ListView(
padding: const EdgeInsets.all(16.0),
children: <Widget>[
......@@ -201,6 +204,7 @@ class _DateAndTimePickerDemoState extends State<DateAndTimePickerDemo> {
],
),
),
),
);
}
}
......@@ -336,6 +336,9 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
return new Scaffold(
appBar: new AppBar(title: const Text('Expansion panels')),
body: new SingleChildScrollView(
child: new SafeArea(
top: false,
bottom: false,
child: new Container(
margin: const EdgeInsets.all(24.0),
child: new ExpansionPanelList(
......@@ -351,9 +354,10 @@ class _ExpansionPanelsDemoState extends State<ExpasionPanelsDemo> {
body: item.builder(item)
);
}).toList()
)
)
)
),
),
),
),
);
}
}
......@@ -363,6 +363,9 @@ class GridListDemoState extends State<GridListDemo> {
body: new Column(
children: <Widget>[
new Expanded(
child: new SafeArea(
top: false,
bottom: false,
child: new GridView.count(
crossAxisCount: (orientation == Orientation.portrait) ? 2 : 3,
mainAxisSpacing: 4.0,
......@@ -380,10 +383,11 @@ class GridListDemoState extends State<GridListDemo> {
}
);
}).toList(),
)
)
]
)
),
),
),
],
),
);
}
}
......@@ -54,6 +54,9 @@ class IconsDemoState extends State<IconsDemo> {
data: new IconThemeData(color: iconColor),
child: new Padding(
padding: const EdgeInsets.all(24.0),
child: new SafeArea(
top: false,
bottom: false,
child: new Column(
children: <Widget>[
new _IconsDemoCard(handleIconButtonPress),
......@@ -61,6 +64,7 @@ class IconsDemoState extends State<IconsDemo> {
),
),
),
),
);
}
}
......
......@@ -19,7 +19,10 @@ class _PageSelector extends StatelessWidget {
Widget build(BuildContext context) {
final TabController controller = DefaultTabController.of(context);
final Color color = Theme.of(context).accentColor;
return new Column(
return new SafeArea(
top: false,
bottom: false,
child: new Column(
children: <Widget>[
new Container(
margin: const EdgeInsets.only(top: 16.0),
......@@ -58,6 +61,7 @@ class _PageSelector extends StatelessWidget {
),
),
],
),
);
}
}
......
......@@ -107,17 +107,21 @@ class _ProgressIndicatorDemoState extends State<ProgressIndicatorDemo> with Sing
child: new GestureDetector(
onTap: _handleTap,
behavior: HitTestBehavior.opaque,
child: new SafeArea(
top: false,
bottom: false,
child: new Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 8.0),
child: new AnimatedBuilder(
animation: _animation,
builder: _buildIndicators
)
)
)
)
)
)
),
),
),
),
),
),
),
);
}
}
......@@ -105,7 +105,10 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
body: new TabBarView(
controller: _controller,
children: _allPages.map((_Page page) {
return new Container(
return new SafeArea(
top: false,
bottom: false,
child: new Container(
key: new ObjectKey(page.icon),
padding: const EdgeInsets.all(12.0),
child:new Card(
......@@ -117,6 +120,7 @@ class ScrollableTabsDemoState extends State<ScrollableTabsDemo> with SingleTicke
),
),
),
),
);
}).toList()
),
......
......@@ -29,7 +29,10 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
int _snackBarIndex = 1;
Widget buildBody(BuildContext context) {
return new ListView(
return new SafeArea(
top: false,
bottom: false,
child: new ListView(
padding: const EdgeInsets.all(24.0),
children: <Widget>[
const Text(_text1),
......@@ -48,10 +51,10 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
content: new Text('You pressed snackbar $thisSnackBarIndex\'s action.')
));
}
)
),
));
}
)
),
),
const Text(_text3),
]
......@@ -62,6 +65,7 @@ class _SnackBarDemoState extends State<SnackBarDemo> {
);
})
.toList()
),
);
}
......
......@@ -154,7 +154,10 @@ class TabsDemo extends StatelessWidget {
},
body: new TabBarView(
children: _allPages.keys.map((_Page page) {
return new ListView(
return new SafeArea(
top: false,
bottom: false,
child: new ListView(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
itemExtent: _CardDataItem.height,
children: _allPages[page].map((_CardData data) {
......@@ -163,6 +166,7 @@ class TabsDemo extends StatelessWidget {
child: new _CardDataItem(page: page, data: data),
);
}).toList(),
),
);
}).toList(),
),
......
......@@ -108,7 +108,10 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
appBar: new AppBar(
title: const Text('Text fields'),
),
body: new Form(
body: new SafeArea(
top: false,
bottom: false,
child: new Form(
key: _formKey,
autovalidate: _autovalidate,
onWillPop: _warnUserAboutInvalidData,
......@@ -199,7 +202,8 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
child: new Text('* indicates required field', style: Theme.of(context).textTheme.caption),
),
],
)
),
),
),
);
}
......
......@@ -22,7 +22,10 @@ class TooltipDemo extends StatelessWidget {
),
body: new Builder(
builder: (BuildContext context) {
return new ListView(
return new SafeArea(
top: false,
bottom: false,
child: new ListView(
children: <Widget>[
new Text(_introText, style: theme.textTheme.subhead),
new Row(
......@@ -60,6 +63,7 @@ class TooltipDemo extends StatelessWidget {
);
})
.toList()
),
);
}
)
......
......@@ -77,7 +77,10 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
),
body: new TabBarView(
children: demos.map((ComponentDemoTabData demo) {
return new Column(
return new SafeArea(
top: false,
bottom: false,
child: new Column(
children: <Widget>[
new Padding(
padding: const EdgeInsets.all(16.0),
......@@ -87,6 +90,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
),
new Expanded(child: demo.demoWidget)
],
),
);
}).toList(),
),
......
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