Cupertino navbar ellipsis fix (#118841)
* Passdown context * make transitions ignore preffered text size * Add test * Add comment * Return const constructor
This commit is contained in:
parent
a07e8a6ac4
commit
3c769effad
@ -1770,12 +1770,16 @@ class _NavigationBarTransition extends StatelessWidget {
|
|||||||
// The actual outer box is big enough to contain both the bottom and top
|
// The actual outer box is big enough to contain both the bottom and top
|
||||||
// navigation bars. It's not a direct Rect lerp because some components
|
// navigation bars. It's not a direct Rect lerp because some components
|
||||||
// can actually be outside the linearly lerp'ed Rect in the middle of
|
// can actually be outside the linearly lerp'ed Rect in the middle of
|
||||||
// the animation, such as the topLargeTitle.
|
// the animation, such as the topLargeTitle. The textScaleFactor is kept
|
||||||
return SizedBox(
|
// at 1 to avoid odd transitions between pages.
|
||||||
height: math.max(heightTween.begin!, heightTween.end!) + MediaQuery.paddingOf(context).top,
|
return MediaQuery(
|
||||||
width: double.infinity,
|
data: MediaQuery.of(context).copyWith(textScaleFactor: 1),
|
||||||
child: Stack(
|
child: SizedBox(
|
||||||
children: children,
|
height: math.max(heightTween.begin!, heightTween.end!) + MediaQuery.paddingOf(context).top,
|
||||||
|
width: double.infinity,
|
||||||
|
child: Stack(
|
||||||
|
children: children,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -25,14 +25,18 @@ Future<void> startTransitionBetween(
|
|||||||
String? toTitle,
|
String? toTitle,
|
||||||
TextDirection textDirection = TextDirection.ltr,
|
TextDirection textDirection = TextDirection.ltr,
|
||||||
CupertinoThemeData? theme,
|
CupertinoThemeData? theme,
|
||||||
|
double textScale = 1.0,
|
||||||
}) async {
|
}) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
CupertinoApp(
|
CupertinoApp(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
builder: (BuildContext context, Widget? navigator) {
|
builder: (BuildContext context, Widget? navigator) {
|
||||||
return Directionality(
|
return MediaQuery(
|
||||||
textDirection: textDirection,
|
data: MediaQuery.of(context).copyWith(textScaleFactor: textScale),
|
||||||
child: navigator!,
|
child: Directionality(
|
||||||
|
textDirection: textDirection,
|
||||||
|
child: navigator!,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
home: const Placeholder(),
|
home: const Placeholder(),
|
||||||
@ -1225,6 +1229,14 @@ void main() {
|
|||||||
expect(find.text('Page 1'), findsOneWidget);
|
expect(find.text('Page 1'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('textScaleFactor is set to 1.0 on transition', (WidgetTester tester) async {
|
||||||
|
await startTransitionBetween(tester, fromTitle: 'Page 1', textScale: 99);
|
||||||
|
|
||||||
|
await tester.pump(const Duration(milliseconds: 50));
|
||||||
|
|
||||||
|
expect(tester.firstWidget<RichText>(flying(tester, find.byType(RichText))).textScaleFactor, 1);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('Back swipe gesture cancels properly with transition', (WidgetTester tester) async {
|
testWidgets('Back swipe gesture cancels properly with transition', (WidgetTester tester) async {
|
||||||
await startTransitionBetween(
|
await startTransitionBetween(
|
||||||
tester,
|
tester,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user