Unverified Commit 486aa63b authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Apply media padding in Cupertino nav bar (#13550)

Applies left and right media padding to Cupertino navigation bar large
titles.
parent e5846d96
......@@ -498,8 +498,12 @@ class _CupertinoLargeTitleNavigationBarSliverDelegate
child: new AnimatedOpacity(
opacity: showLargeTitle ? 1.0 : 0.0,
duration: _kNavBarTitleFadeDuration,
child: title,
)
child: new SafeArea(
top: false,
bottom: false,
child: title,
),
),
),
),
),
......
......@@ -116,6 +116,56 @@ void main() {
expect(find.byType(SliverPersistentHeader), findsNothing);
});
testWidgets('Media padding is applied to CupertinoSliverNavigationBar', (WidgetTester tester) async {
final ScrollController scrollController = new ScrollController();
final Key middleKey = new GlobalKey();
final Key titleKey = new GlobalKey();
await tester.pumpWidget(
new WidgetsApp(
color: const Color(0xFFFFFFFF),
onGenerateRoute: (RouteSettings settings) {
return new CupertinoPageRoute<Null>(
settings: settings,
builder: (BuildContext context) {
return new MediaQuery(
data: const MediaQueryData(
padding: const EdgeInsets.only(
top: 10.0,
left: 20.0,
bottom: 30.0,
right: 40.0,
),
),
child: new CupertinoPageScaffold(
child: new CustomScrollView(
controller: scrollController,
slivers: <Widget>[
new CupertinoSliverNavigationBar(
middle: new Text('Not-large Title', key: middleKey),
largeTitle: new Text('Large Title', key: titleKey),
),
new SliverToBoxAdapter(
child: new Container(
height: 1200.0,
),
),
],
),
),
);
},
);
},
),
);
// Top padding is applied to middle.
expect(tester.getTopLeft(find.byKey(middleKey)), const Offset(277.5, 13.5 + 10.0));
// Top and left padding is applied to large title.
expect(tester.getTopLeft(find.byKey(titleKey)), const Offset(16.0 + 20.0, 58.0 + 10.0));
});
testWidgets('Large title nav bar scrolls', (WidgetTester tester) async {
final ScrollController scrollController = new ScrollController();
await tester.pumpWidget(
......@@ -357,4 +407,4 @@ class _ExpectStyles extends StatelessWidget {
count += index;
return new Container();
}
}
\ No newline at end of file
}
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