Unverified Commit 00143388 authored by xster's avatar xster Committed by GitHub

default CupertinoSliverNavigationBar's stretch to false (#74669)

parent d1538320
...@@ -541,7 +541,7 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> { ...@@ -541,7 +541,7 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> {
/// The [stretch] parameter determines whether the nav bar should stretch to /// The [stretch] parameter determines whether the nav bar should stretch to
/// fill the over-scroll area. The nav bar can still expand and contract as the /// fill the over-scroll area. The nav bar can still expand and contract as the
/// user scrolls, but it will also stretch when the user over-scrolls if the /// user scrolls, but it will also stretch when the user over-scrolls if the
/// [stretch] value is `true`. Defaults to `true`. /// [stretch] value is `true`. Defaults to `false`.
/// ///
/// See also: /// See also:
/// ///
...@@ -566,7 +566,7 @@ class CupertinoSliverNavigationBar extends StatefulWidget { ...@@ -566,7 +566,7 @@ class CupertinoSliverNavigationBar extends StatefulWidget {
this.padding, this.padding,
this.transitionBetweenRoutes = true, this.transitionBetweenRoutes = true,
this.heroTag = _defaultHeroTag, this.heroTag = _defaultHeroTag,
this.stretch = true, this.stretch = false,
}) : assert(automaticallyImplyLeading != null), }) : assert(automaticallyImplyLeading != null),
assert(automaticallyImplyTitle != null), assert(automaticallyImplyTitle != null),
assert( assert(
...@@ -658,7 +658,12 @@ class CupertinoSliverNavigationBar extends StatefulWidget { ...@@ -658,7 +658,12 @@ class CupertinoSliverNavigationBar extends StatefulWidget {
/// ///
/// The nav bar can still expand and contract as the user scrolls, but it will /// The nav bar can still expand and contract as the user scrolls, but it will
/// also stretch when the user over-scrolls if the [stretch] value is `true`. /// also stretch when the user over-scrolls if the [stretch] value is `true`.
/// Defaults to `true`. ///
/// When set to `true`, the nav bar will prevent subsequent slivers from
/// accessing overscrolls. This may be undesirable for using overscroll-based
/// widgets like the [CupertinoSliverRefreshControl].
///
/// Defaults to `false`.
final bool stretch; final bool stretch;
@override @override
......
...@@ -1230,6 +1230,7 @@ void main() { ...@@ -1230,6 +1230,7 @@ void main() {
const CupertinoSliverNavigationBar( const CupertinoSliverNavigationBar(
trailing: trailingText, trailing: trailingText,
largeTitle: titleText, largeTitle: titleText,
stretch: true,
), ),
SliverToBoxAdapter( SliverToBoxAdapter(
child: Container( child: Container(
......
...@@ -918,6 +918,47 @@ void main() { ...@@ -918,6 +918,47 @@ void main() {
expect(tester.takeException(), isNull); expect(tester.takeException(), isNull);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
// Test to make sure the refresh sliver's overscroll isn't eaten by the
// nav bar sliver https://github.com/flutter/flutter/issues/74516.
testWidgets(
'properly displays when the refresh sliver is behind the large title nav bar sliver',
(WidgetTester tester) async {
await tester.pumpWidget(
CupertinoApp(
home: CustomScrollView(
slivers: <Widget>[
const CupertinoSliverNavigationBar(
largeTitle: Text('Title'),
),
CupertinoSliverRefreshControl(
builder: mockHelper.builder,
),
buildAListOfStuff(),
],
),
),
);
final double initialFirstCellY = tester.getTopLeft(find.widgetWithText(Container, '0')).dy;
// Drag down but not enough to trigger the refresh.
await tester.drag(find.text('0'), const Offset(0.0, 50.0), touchSlopY: 0);
await tester.pump();
expect(mockHelper.invocations.first, matchesBuilder(
refreshState: RefreshIndicatorMode.drag,
pulledExtent: 50,
refreshTriggerPullDistance: 100, // default value.
refreshIndicatorExtent: 60, // default value.
));
expect(mockHelper.invocations, hasLength(1));
expect(
tester.getTopLeft(find.widgetWithText(Container, '0')).dy,
initialFirstCellY + 50
);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
}; };
final VoidCallback stateMachineTestGroup = () { final VoidCallback stateMachineTestGroup = () {
......
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