Unverified Commit 43e31977 authored by Darren Austin's avatar Darren Austin Committed by GitHub

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

parent 8427af46
...@@ -546,8 +546,9 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder { ...@@ -546,8 +546,9 @@ 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 with a matching platform is not found, then the /// If a builder for the current [ThemeData.platform] is not found, then
/// [FadeUpwardsPageTransitionsBuilder] is used. /// no animated transition will occur. The new page will just be displayed
/// immediately.
/// ///
/// See also: /// See also:
/// ///
...@@ -563,16 +564,23 @@ class PageTransitionsTheme with Diagnosticable { ...@@ -563,16 +564,23 @@ 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 [CupertinoPageTransitionsBuilder] for /// for [TargetPlatform.android] and [TargetPlatform.fuchsia],
/// [TargetPlatform.iOS] and [TargetPlatform.macOS]. /// [CupertinoPageTransitionsBuilder] for [TargetPlatform.iOS], and no
const PageTransitionsTheme({ Map<TargetPlatform, PageTransitionsBuilder> builders = _defaultBuilders }) : _builders = builders; /// animated transition for other platforms or if the app is running on the
/// 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.linux: FadeUpwardsPageTransitionsBuilder(), TargetPlatform.fuchsia: 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.
...@@ -595,9 +603,8 @@ class PageTransitionsTheme with Diagnosticable { ...@@ -595,9 +603,8 @@ class PageTransitionsTheme with Diagnosticable {
if (CupertinoRouteTransitionMixin.isPopGestureInProgress(route)) if (CupertinoRouteTransitionMixin.isPopGestureInProgress(route))
platform = TargetPlatform.iOS; platform = TargetPlatform.iOS;
final PageTransitionsBuilder matchingBuilder = final PageTransitionsBuilder? matchingBuilder = builders[platform];
builders[platform] ?? const FadeUpwardsPageTransitionsBuilder(); return matchingBuilder?.buildTransitions<T>(route, context, animation, secondaryAnimation, child) ?? child;
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,6 +3,7 @@ ...@@ -3,6 +3,7 @@
// 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';
...@@ -65,7 +66,7 @@ void main() { ...@@ -65,7 +66,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);
testWidgets('test page transition', (WidgetTester tester) async { testWidgets('test page transition', (WidgetTester tester) async {
final Key page2Key = UniqueKey(); final Key page2Key = UniqueKey();
...@@ -146,7 +147,7 @@ void main() { ...@@ -146,7 +147,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);
testWidgets('test fullscreen dialog transition', (WidgetTester tester) async { testWidgets('test fullscreen dialog transition', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -206,7 +207,7 @@ void main() { ...@@ -206,7 +207,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);
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(
...@@ -236,7 +237,7 @@ void main() { ...@@ -236,7 +237,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);
testWidgets('test back gesture', (WidgetTester tester) async { testWidgets('test back gesture', (WidgetTester tester) async {
await tester.pumpWidget( await tester.pumpWidget(
...@@ -277,7 +278,7 @@ void main() { ...@@ -277,7 +278,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);
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>{
...@@ -362,13 +363,13 @@ void main() { ...@@ -362,13 +363,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));
expect(find.text('PUSH'), findsOneWidget); // As no transitions are specified for macOS the drag should do nothing
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.dx, lessThan(helloPosition6.dx)); expect(helloPosition5, helloPosition6);
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);
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(
...@@ -479,7 +480,7 @@ void main() { ...@@ -479,7 +480,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);
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(
...@@ -547,7 +548,7 @@ void main() { ...@@ -547,7 +548,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);
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
...@@ -642,7 +643,7 @@ void main() { ...@@ -642,7 +643,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);
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
...@@ -712,7 +713,7 @@ void main() { ...@@ -712,7 +713,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);
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
...@@ -783,7 +784,7 @@ void main() { ...@@ -783,7 +784,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);
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.
...@@ -811,7 +812,7 @@ void main() { ...@@ -811,7 +812,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);
testWidgets('MaterialPage works', (WidgetTester tester) async { testWidgets('MaterialPage works', (WidgetTester tester) async {
final LocalKey pageKey = UniqueKey(); final LocalKey pageKey = UniqueKey();
......
...@@ -11,17 +11,33 @@ void main() { ...@@ -11,17 +11,33 @@ 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);
for (final TargetPlatform platform in TargetPlatform.values) { if (kIsWeb) {
if (platform == TargetPlatform.fuchsia) { // There aren't any default transitions defined for web
// No builder on Fuchsia. expect(theme.builders, isEmpty);
continue; } else {
// 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 CupertionPageTransition', (WidgetTester tester) async { testWidgets('Default PageTransitionsTheme builds a CupertinoPageTransition', (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(
...@@ -45,7 +61,7 @@ void main() { ...@@ -45,7 +61,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);
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>{
...@@ -78,7 +94,7 @@ void main() { ...@@ -78,7 +94,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);
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>{
...@@ -118,7 +134,7 @@ void main() { ...@@ -118,7 +134,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);
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>{
...@@ -158,7 +174,7 @@ void main() { ...@@ -158,7 +174,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);
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
...@@ -204,5 +220,5 @@ void main() { ...@@ -204,5 +220,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);
} }
...@@ -1448,13 +1448,13 @@ void main() { ...@@ -1448,13 +1448,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(FadeTransition), of: find.byType(Overlay),
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('Sawping controllers should update selection', (WidgetTester tester) async { testWidgets('Swapping 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,7 +1836,7 @@ Future<void> main() async { ...@@ -1836,7 +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);
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;
...@@ -1879,7 +1879,7 @@ Future<void> main() async { ...@@ -1879,7 +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);
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;
...@@ -1915,7 +1915,7 @@ Future<void> main() async { ...@@ -1915,7 +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);
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,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// 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';
...@@ -196,7 +197,7 @@ void main() { ...@@ -196,7 +197,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: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb);
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();
...@@ -239,7 +240,7 @@ void main() { ...@@ -239,7 +240,7 @@ void main() {
expect(find.text('Home'), isOnstage); expect(find.text('Home'), isOnstage);
expect(find.text('Settings'), findsNothing); expect(find.text('Settings'), findsNothing);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb);
// 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 {
...@@ -293,7 +294,7 @@ void main() { ...@@ -293,7 +294,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: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: TargetPlatformVariant.only(TargetPlatform.iOS), skip: kIsWeb);
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