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

Apply media padding in Cupertino Navigation demo (#13585)

Adds safe areas around:
1. The body of the colour swatch view (tab 1)
2. The chat header (tab 2)
3. The chat bubbles (tab 2)
4. The 'Sign In' launcher button (tab 3)
parent 8a77036b
...@@ -132,8 +132,13 @@ class CupertinoDemoTab1 extends StatelessWidget { ...@@ -132,8 +132,13 @@ class CupertinoDemoTab1 extends StatelessWidget {
trailing: const ExitButton(), trailing: const ExitButton(),
), ),
new SliverPadding( new SliverPadding(
// Top media query padding already consumed by CupertinoSliverNavigationBar. // Top media padding consumed by CupertinoSliverNavigationBar.
padding: MediaQuery.of(context).removePadding(removeTop: true).padding, // Left/Right media padding consumed by Tab1RowItem.
padding: MediaQuery.of(context).removePadding(
removeTop: true,
removeLeft: true,
removeRight: true,
).padding,
sliver: new SliverList( sliver: new SliverList(
delegate: new SliverChildBuilderDelegate( delegate: new SliverChildBuilderDelegate(
(BuildContext context, int index) { (BuildContext context, int index) {
...@@ -175,6 +180,9 @@ class Tab1RowItem extends StatelessWidget { ...@@ -175,6 +180,9 @@ class Tab1RowItem extends StatelessWidget {
), ),
)); ));
}, },
child: new SafeArea(
top: false,
bottom: false,
child: new Padding( child: new Padding(
padding: const EdgeInsets.only(left: 16.0, top: 8.0, bottom: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 16.0, top: 8.0, bottom: 8.0, right: 8.0),
child: new Row( child: new Row(
...@@ -220,6 +228,7 @@ class Tab1RowItem extends StatelessWidget { ...@@ -220,6 +228,7 @@ class Tab1RowItem extends StatelessWidget {
], ],
), ),
), ),
),
); );
if (lastItem) { if (lastItem) {
...@@ -273,6 +282,9 @@ class Tab1ItemPageState extends State<Tab1ItemPage> { ...@@ -273,6 +282,9 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
middle: new Text(widget.colorName), middle: new Text(widget.colorName),
trailing: const ExitButton(), trailing: const ExitButton(),
), ),
child: new SafeArea(
top: false,
bottom: false,
child: new ListView( child: new ListView(
children: <Widget>[ children: <Widget>[
const Padding(padding: const EdgeInsets.only(top: 16.0)), const Padding(padding: const EdgeInsets.only(top: 16.0)),
...@@ -386,6 +398,7 @@ class Tab1ItemPageState extends State<Tab1ItemPage> { ...@@ -386,6 +398,7 @@ class Tab1ItemPageState extends State<Tab1ItemPage> {
), ),
], ],
), ),
),
); );
} }
} }
...@@ -412,6 +425,9 @@ class Tab2Header extends StatelessWidget { ...@@ -412,6 +425,9 @@ class Tab2Header extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return new Padding( return new Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: new SafeArea(
top: false,
bottom: false,
child: new ClipRRect( child: new ClipRRect(
borderRadius: const BorderRadius.all(const Radius.circular(16.0)), borderRadius: const BorderRadius.all(const Radius.circular(16.0)),
child: new Column( child: new Column(
...@@ -520,6 +536,7 @@ class Tab2Header extends StatelessWidget { ...@@ -520,6 +536,7 @@ class Tab2Header extends StatelessWidget {
], ],
), ),
), ),
),
); );
} }
} }
...@@ -623,11 +640,13 @@ class Tab2ConversationRow extends StatelessWidget { ...@@ -623,11 +640,13 @@ class Tab2ConversationRow extends StatelessWidget {
: Tab2ConversationBubbleColor.gray, : Tab2ConversationBubbleColor.gray,
), ),
); );
return new Row( return new SafeArea(
child: new Row(
mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start, mainAxisAlignment: isSelf ? MainAxisAlignment.end : MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end, crossAxisAlignment: isSelf ? CrossAxisAlignment.center : CrossAxisAlignment.end,
children: children, children: children,
),
); );
} }
} }
...@@ -703,6 +722,9 @@ class CupertinoDemoTab3 extends StatelessWidget { ...@@ -703,6 +722,9 @@ class CupertinoDemoTab3 extends StatelessWidget {
height: 44.0, height: 44.0,
child: new Padding( child: new Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0), padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: new SafeArea(
top: false,
bottom: false,
child: new Row(children: <Widget>[ const Text( child: new Row(children: <Widget>[ const Text(
'Sign in', 'Sign in',
style: const TextStyle(color: CupertinoColors.activeBlue), style: const TextStyle(color: CupertinoColors.activeBlue),
...@@ -710,6 +732,7 @@ class CupertinoDemoTab3 extends StatelessWidget { ...@@ -710,6 +732,7 @@ class CupertinoDemoTab3 extends StatelessWidget {
), ),
), ),
), ),
),
], ],
), ),
), ),
......
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