Unverified Commit 738430ca authored by Darren Austin's avatar Darren Austin Committed by GitHub

Revert "Removed default page transitions for desktop and web platforms. (#82596)" (#89997)

This reverts commit 43e31977
parent 9db9256b
...@@ -546,9 +546,8 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder { ...@@ -546,9 +546,8 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
/// current [PageTransitionsTheme] with `Theme.of(context).pageTransitionsTheme` /// current [PageTransitionsTheme] with `Theme.of(context).pageTransitionsTheme`
/// and delegates to [buildTransitions]. /// and delegates to [buildTransitions].
/// ///
/// If a builder for the current [ThemeData.platform] is not found, then /// If a builder with a matching platform is not found, then the
/// no animated transition will occur. The new page will just be displayed /// [FadeUpwardsPageTransitionsBuilder] is used.
/// immediately.
/// ///
/// See also: /// See also:
/// ///
...@@ -564,23 +563,16 @@ class PageTransitionsTheme with Diagnosticable { ...@@ -564,23 +563,16 @@ class PageTransitionsTheme with Diagnosticable {
/// Constructs an object that selects a transition based on the platform. /// Constructs an object that selects a transition based on the platform.
/// ///
/// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder] /// By default the list of builders is: [FadeUpwardsPageTransitionsBuilder]
/// for [TargetPlatform.android] and [TargetPlatform.fuchsia], /// for [TargetPlatform.android], and [CupertinoPageTransitionsBuilder] for
/// [CupertinoPageTransitionsBuilder] for [TargetPlatform.iOS], and no /// [TargetPlatform.iOS] and [TargetPlatform.macOS].
/// animated transition for other platforms or if the app is running on the const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder> builders = _defaultBuilders }) : _builders = builders;
/// web.
const PageTransitionsTheme({
Map<TargetPlatform, PageTransitionsBuilder> builders = kIsWeb ? _defaultWebBuilders : _defaultBuilders,
}) : _builders = builders;
static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{ static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders = <TargetPlatform, PageTransitionsBuilder>{
// Only have default transitions for mobile platforms
TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(), TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(),
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.fuchsia: FadeUpwardsPageTransitionsBuilder(), TargetPlatform.linux: FadeUpwardsPageTransitionsBuilder(),
}; TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
TargetPlatform.windows: FadeUpwardsPageTransitionsBuilder(),
static const Map<TargetPlatform, PageTransitionsBuilder> _defaultWebBuilders = <TargetPlatform, PageTransitionsBuilder>{
// By default no page transitions for web apps.
}; };
/// The [PageTransitionsBuilder]s supported by this theme. /// The [PageTransitionsBuilder]s supported by this theme.
...@@ -603,8 +595,9 @@ class PageTransitionsTheme with Diagnosticable { ...@@ -603,8 +595,9 @@ class PageTransitionsTheme with Diagnosticable {
if (CupertinoRouteTransitionMixin.isPopGestureInProgress(route)) if (CupertinoRouteTransitionMixin.isPopGestureInProgress(route))
platform = TargetPlatform.iOS; platform = TargetPlatform.iOS;
final PageTransitionsBuilder? matchingBuilder = builders[platform]; final PageTransitionsBuilder matchingBuilder =
return matchingBuilder?.buildTransitions<T>(route, context, animation, secondaryAnimation, child) ?? child; builders[platform] ?? const FadeUpwardsPageTransitionsBuilder();
return matchingBuilder.buildTransitions<T>(route, context, animation, secondaryAnimation, child);
} }
// Just used to the builders Map to a list with one PageTransitionsBuilder per platform // Just used to the builders Map to a list with one PageTransitionsBuilder per platform
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/cupertino.dart' show CupertinoPageRoute; import 'package:flutter/cupertino.dart' show CupertinoPageRoute;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -66,10 +65,7 @@ void main() { ...@@ -66,10 +65,7 @@ void main() {
expect(find.text('Page 1'), isOnstage); expect(find.text('Page 1'), isOnstage);
expect(find.text('Page 2'), findsNothing); expect(find.text('Page 2'), findsNothing);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('test page transition', (WidgetTester tester) async { testWidgets('test page transition', (WidgetTester tester) async {
final Key page2Key = UniqueKey(); final Key page2Key = UniqueKey();
...@@ -150,10 +146,7 @@ void main() { ...@@ -150,10 +146,7 @@ void main() {
// Page 1 is back where it started. // Page 1 is back where it started.
expect(widget1InitialTopLeft == widget1TransientTopLeft, true); expect(widget1InitialTopLeft == widget1TransientTopLeft, true);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('test fullscreen dialog transition', (WidgetTester tester) async { testWidgets('test fullscreen dialog transition', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -213,10 +206,7 @@ void main() { ...@@ -213,10 +206,7 @@ void main() {
// Page 1 is back where it started. // Page 1 is back where it started.
expect(widget1InitialTopLeft == widget1TransientTopLeft, true); expect(widget1InitialTopLeft == widget1TransientTopLeft, true);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('test no back gesture on Android', (WidgetTester tester) async { testWidgets('test no back gesture on Android', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -246,10 +236,7 @@ void main() { ...@@ -246,10 +236,7 @@ void main() {
// Page 2 didn't move // Page 2 didn't move
expect(tester.getTopLeft(find.text('Page 2')), Offset.zero); expect(tester.getTopLeft(find.text('Page 2')), Offset.zero);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('test back gesture', (WidgetTester tester) async { testWidgets('test back gesture', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -290,10 +277,7 @@ void main() { ...@@ -290,10 +277,7 @@ void main() {
await tester.pump(); await tester.pump();
expect(tester.getTopLeft(find.text('Page 2')), const Offset(100.0, 0.0)); expect(tester.getTopLeft(find.text('Page 2')), const Offset(100.0, 0.0));
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('back gesture while OS changes', (WidgetTester tester) async { testWidgets('back gesture while OS changes', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
...@@ -378,13 +362,13 @@ void main() { ...@@ -378,13 +362,13 @@ void main() {
expect(find.text('PUSH'), findsNothing); expect(find.text('PUSH'), findsNothing);
expect(find.text('HELLO'), findsOneWidget); expect(find.text('HELLO'), findsOneWidget);
await tester.pump(const Duration(milliseconds: 20)); await tester.pump(const Duration(milliseconds: 20));
// As no transitions are specified for macOS the drag should do nothing expect(find.text('PUSH'), findsOneWidget);
expect(find.text('PUSH'), findsNothing);
expect(find.text('HELLO'), findsOneWidget); expect(find.text('HELLO'), findsOneWidget);
final Offset helloPosition6 = tester.getCenter(find.text('HELLO')); final Offset helloPosition6 = tester.getCenter(find.text('HELLO'));
expect(helloPosition5, helloPosition6); expect(helloPosition5.dx, lessThan(helloPosition6.dx));
expect(helloPosition5.dy, helloPosition6.dy);
expect(Theme.of(tester.element(find.text('HELLO'))).platform, TargetPlatform.macOS); expect(Theme.of(tester.element(find.text('HELLO'))).platform, TargetPlatform.macOS);
}, skip: kIsWeb); // [intended] doesn't apply to the web. });
testWidgets('test no back gesture on fullscreen dialogs', (WidgetTester tester) async { testWidgets('test no back gesture on fullscreen dialogs', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -495,10 +479,7 @@ void main() { ...@@ -495,10 +479,7 @@ void main() {
// Page 1 is back where it started. // Page 1 is back where it started.
expect(widget1InitialTopLeft == widget1TransientTopLeft, true); expect(widget1InitialTopLeft == widget1TransientTopLeft, true);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('test edge swipe then drop back at starting point works', (WidgetTester tester) async { testWidgets('test edge swipe then drop back at starting point works', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -566,10 +547,7 @@ void main() { ...@@ -566,10 +547,7 @@ void main() {
expect(find.text('Page 1'), isOnstage); expect(find.text('Page 1'), isOnstage);
expect(find.text('Page 2'), findsNothing); expect(find.text('Page 2'), findsNothing);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('Back swipe dismiss interrupted by route push', (WidgetTester tester) async { testWidgets('Back swipe dismiss interrupted by route push', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/28728 // Regression test for https://github.com/flutter/flutter/issues/28728
...@@ -664,10 +642,7 @@ void main() { ...@@ -664,10 +642,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('route'), findsOneWidget); expect(find.text('route'), findsOneWidget);
expect(find.text('push'), findsNothing); expect(find.text('push'), findsNothing);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('During back swipe the route ignores input', (WidgetTester tester) async { testWidgets('During back swipe the route ignores input', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/39989 // Regression test for https://github.com/flutter/flutter/issues/39989
...@@ -737,10 +712,7 @@ void main() { ...@@ -737,10 +712,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(tester.getTopLeft(find.byKey(pageScaffoldKey)), const Offset(400, 0)); expect(tester.getTopLeft(find.byKey(pageScaffoldKey)), const Offset(400, 0));
expect(tester.getTopLeft(find.byKey(homeScaffoldKey)).dx, lessThan(0)); expect(tester.getTopLeft(find.byKey(homeScaffoldKey)).dx, lessThan(0));
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('After a pop caused by a back-swipe, input reaches the exposed route', (WidgetTester tester) async { testWidgets('After a pop caused by a back-swipe, input reaches the exposed route', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/41024 // Regression test for https://github.com/flutter/flutter/issues/41024
...@@ -811,10 +783,7 @@ void main() { ...@@ -811,10 +783,7 @@ void main() {
await tester.tap(find.byKey(homeScaffoldKey)); await tester.tap(find.byKey(homeScaffoldKey));
expect(homeTapCount, 2); expect(homeTapCount, 2);
expect(pageTapCount, 1); expect(pageTapCount, 1);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('A MaterialPageRoute should slide out with CupertinoPageTransition when a compatible PageRoute is pushed on top of it', (WidgetTester tester) async { testWidgets('A MaterialPageRoute should slide out with CupertinoPageTransition when a compatible PageRoute is pushed on top of it', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/44864. // Regression test for https://github.com/flutter/flutter/issues/44864.
...@@ -842,10 +811,7 @@ void main() { ...@@ -842,10 +811,7 @@ void main() {
// Title of the first route slides to the left. // Title of the first route slides to the left.
expect(titleInitialTopLeft.dy, equals(titleTransientTopLeft.dy)); expect(titleInitialTopLeft.dy, equals(titleTransientTopLeft.dy));
expect(titleInitialTopLeft.dx, greaterThan(titleTransientTopLeft.dx)); expect(titleInitialTopLeft.dx, greaterThan(titleTransientTopLeft.dx));
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('MaterialPage works', (WidgetTester tester) async { testWidgets('MaterialPage works', (WidgetTester tester) async {
final LocalKey pageKey = UniqueKey(); final LocalKey pageKey = UniqueKey();
......
...@@ -11,33 +11,17 @@ void main() { ...@@ -11,33 +11,17 @@ void main() {
testWidgets('Default PageTransitionsTheme platform', (WidgetTester tester) async { testWidgets('Default PageTransitionsTheme platform', (WidgetTester tester) async {
await tester.pumpWidget(const MaterialApp(home: Text('home'))); await tester.pumpWidget(const MaterialApp(home: Text('home')));
final PageTransitionsTheme theme = Theme.of(tester.element(find.text('home'))).pageTransitionsTheme; final PageTransitionsTheme theme = Theme.of(tester.element(find.text('home'))).pageTransitionsTheme;
expect(theme.builders, isNotNull); expect(theme.builders, isNotNull);
if (kIsWeb) { for (final TargetPlatform platform in TargetPlatform.values) {
// There aren't any default transitions defined for web if (platform == TargetPlatform.fuchsia) {
expect(theme.builders, isEmpty); // No builder on Fuchsia.
} else { continue;
// There should only be builders for the mobile platforms.
for (final TargetPlatform platform in TargetPlatform.values) {
switch (platform) {
case TargetPlatform.android:
case TargetPlatform.iOS:
case TargetPlatform.fuchsia:
expect(theme.builders[platform], isNotNull,
reason: 'theme builder for $platform is null');
break;
case TargetPlatform.linux:
case TargetPlatform.macOS:
case TargetPlatform.windows:
expect(theme.builders[platform], isNull,
reason: 'theme builder for $platform is not null');
break;
}
} }
expect(theme.builders[platform], isNotNull, reason: 'theme builder for $platform is null');
} }
}); });
testWidgets('Default PageTransitionsTheme builds a CupertinoPageTransition', (WidgetTester tester) async { testWidgets('Default PageTransitionsTheme builds a CupertionPageTransition', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
'/': (BuildContext context) => Material( '/': (BuildContext context) => Material(
child: TextButton( child: TextButton(
...@@ -61,10 +45,7 @@ void main() { ...@@ -61,10 +45,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('page b'), findsOneWidget); expect(find.text('page b'), findsOneWidget);
expect(find.byType(CupertinoPageTransition), findsOneWidget); expect(find.byType(CupertinoPageTransition), findsOneWidget);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('Default PageTransitionsTheme builds a _FadeUpwardsPageTransition for android', (WidgetTester tester) async { testWidgets('Default PageTransitionsTheme builds a _FadeUpwardsPageTransition for android', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
...@@ -97,10 +78,7 @@ void main() { ...@@ -97,10 +78,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('page b'), findsOneWidget); expect(find.text('page b'), findsOneWidget);
expect(findFadeUpwardsPageTransition(), findsOneWidget); expect(findFadeUpwardsPageTransition(), findsOneWidget);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('PageTransitionsTheme override builds a _OpenUpwardsPageTransition', (WidgetTester tester) async { testWidgets('PageTransitionsTheme override builds a _OpenUpwardsPageTransition', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
...@@ -140,10 +118,7 @@ void main() { ...@@ -140,10 +118,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('page b'), findsOneWidget); expect(find.text('page b'), findsOneWidget);
expect(findOpenUpwardsPageTransition(), findsOneWidget); expect(findOpenUpwardsPageTransition(), findsOneWidget);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('PageTransitionsTheme override builds a _ZoomPageTransition', (WidgetTester tester) async { testWidgets('PageTransitionsTheme override builds a _ZoomPageTransition', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
...@@ -183,10 +158,7 @@ void main() { ...@@ -183,10 +158,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('page b'), findsOneWidget); expect(find.text('page b'), findsOneWidget);
expect(findZoomPageTransition(), findsOneWidget); expect(findZoomPageTransition(), findsOneWidget);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
testWidgets('_ZoomPageTransition only cause child widget built once', (WidgetTester tester) async { testWidgets('_ZoomPageTransition only cause child widget built once', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/issues/58345 // Regression test for https://github.com/flutter/flutter/issues/58345
...@@ -232,8 +204,5 @@ void main() { ...@@ -232,8 +204,5 @@ void main() {
await tester.tap(find.text('pop')); await tester.tap(find.text('pop'));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(builtCount, 1); expect(builtCount, 1);
}, }, variant: TargetPlatformVariant.only(TargetPlatform.android));
variant: TargetPlatformVariant.only(TargetPlatform.android),
skip: kIsWeb, // [intended] no default transitions on the web.
);
} }
...@@ -1479,13 +1479,13 @@ void main() { ...@@ -1479,13 +1479,13 @@ void main() {
// Wait for context menu to be built. // Wait for context menu to be built.
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final RenderBox container = tester.renderObject(find.descendant( final RenderBox container = tester.renderObject(find.descendant(
of: find.byType(Overlay), of: find.byType(FadeTransition),
matching: find.byType(SizedBox), matching: find.byType(SizedBox),
).first); ).first);
expect(container.size, Size.zero); expect(container.size, Size.zero);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia, TargetPlatform.linux, TargetPlatform.windows })); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.android, TargetPlatform.fuchsia, TargetPlatform.linux, TargetPlatform.windows }));
testWidgets('Swapping controllers should update selection', (WidgetTester tester) async { testWidgets('Sawping controllers should update selection', (WidgetTester tester) async {
TextEditingController controller = TextEditingController(text: 'readonly'); TextEditingController controller = TextEditingController(text: 'readonly');
final OverlayEntry entry = OverlayEntry( final OverlayEntry entry = OverlayEntry(
builder: (BuildContext context) { builder: (BuildContext context) {
......
...@@ -1836,10 +1836,7 @@ Future<void> main() async { ...@@ -1836,10 +1836,7 @@ Future<void> main() async {
expect(find.byKey(firstKey), isInCard); expect(find.byKey(firstKey), isInCard);
expect(find.byKey(secondKey), isOnstage); expect(find.byKey(secondKey), isOnstage);
expect(find.byKey(secondKey), isInCard); expect(find.byKey(secondKey), isInCard);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] there are no default transitions on the web.
);
testWidgets('Heroes can transition on gesture in one frame', (WidgetTester tester) async { testWidgets('Heroes can transition on gesture in one frame', (WidgetTester tester) async {
transitionFromUserGestures = true; transitionFromUserGestures = true;
...@@ -1882,10 +1879,7 @@ Future<void> main() async { ...@@ -1882,10 +1879,7 @@ Future<void> main() async {
expect(find.byKey(firstKey), isOnstage); expect(find.byKey(firstKey), isOnstage);
expect(find.byKey(firstKey), isInCard); expect(find.byKey(firstKey), isInCard);
expect(find.byKey(secondKey), findsNothing); expect(find.byKey(secondKey), findsNothing);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] there are no default transitions on the web.
);
testWidgets('Heroes animate should hide destination hero and display original hero in case of dismissed', (WidgetTester tester) async { testWidgets('Heroes animate should hide destination hero and display original hero in case of dismissed', (WidgetTester tester) async {
transitionFromUserGestures = true; transitionFromUserGestures = true;
...@@ -1921,10 +1915,7 @@ Future<void> main() async { ...@@ -1921,10 +1915,7 @@ Future<void> main() async {
expect(find.byKey(firstKey), findsNothing); expect(find.byKey(firstKey), findsNothing);
expect(find.byKey(secondKey), isOnstage); expect(find.byKey(secondKey), isOnstage);
expect(find.byKey(secondKey), isInCard); expect(find.byKey(secondKey), isInCard);
}, }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
skip: kIsWeb, // [intended] there are no default transitions on the web.
);
testWidgets('Handles transitions when a non-default initial route is set', (WidgetTester tester) async { testWidgets('Handles transitions when a non-default initial route is set', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -197,7 +196,7 @@ void main() { ...@@ -197,7 +196,7 @@ void main() {
settingsOffset = tester.getTopLeft(find.text('Settings')); settingsOffset = tester.getTopLeft(find.text('Settings'));
expect(settingsOffset.dx, greaterThan(100.0)); expect(settingsOffset.dx, greaterThan(100.0));
expect(settingsOffset.dy, 100.0); expect(settingsOffset.dy, 100.0);
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb); // [intended] no default transitions on web. }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
testWidgets("Check back gesture doesn't start during transitions", (WidgetTester tester) async { testWidgets("Check back gesture doesn't start during transitions", (WidgetTester tester) async {
final GlobalKey containerKey1 = GlobalKey(); final GlobalKey containerKey1 = GlobalKey();
...@@ -240,7 +239,7 @@ void main() { ...@@ -240,7 +239,7 @@ void main() {
expect(find.text('Home'), isOnstage); expect(find.text('Home'), isOnstage);
expect(find.text('Settings'), findsNothing); expect(find.text('Settings'), findsNothing);
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb); // [intended] no default transitions on web. }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
// Tests bug https://github.com/flutter/flutter/issues/6451 // Tests bug https://github.com/flutter/flutter/issues/6451
testWidgets('Check back gesture with a persistent bottom sheet showing', (WidgetTester tester) async { testWidgets('Check back gesture with a persistent bottom sheet showing', (WidgetTester tester) async {
...@@ -294,7 +293,7 @@ void main() { ...@@ -294,7 +293,7 @@ void main() {
// Sheet did not call setState (since the gesture did nothing). // Sheet did not call setState (since the gesture did nothing).
expect(sheet.setStateCalled, isFalse); expect(sheet.setStateCalled, isFalse);
}, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb); // [intended] no default transitions on web. }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
testWidgets('Test completed future', (WidgetTester tester) async { testWidgets('Test completed future', (WidgetTester tester) async {
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{ final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
......
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