Skip to content

Commit 0e57a62

Browse files
auto-submit[bot]auto-submit[bot]
andauthored
Reverts "Predictive back route transitions by default (flutter#165832)" (flutter#173809)
<!-- start_original_pr_link --> Reverts: flutter#165832 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: matanlurey <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: Breaks `Linux_pixel_7pro embedded_android_views_integration_test`: - https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8918/overview - https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20embedded_android_views_integration_test/8917/overview ```txt [2025-08-14 16:01:17.600761] [STDOUT] stdout: [ +1 ms] Expecte <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: justinmc <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {QuncCccccc} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: This PR turns on predictive back route transitions by default on supported Android devices. With flutter#154718, the default (PredictiveBackPageTransitionsBuilder) is the [shared element transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition). The [full screen transition](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#full-screen-surfaces) is also available by using PredictiveBackFullScreenPageTransitionsBuilder. Original PR: flutter#146788 Depends on: flutter#154718 When this lands in stable, the docs should be updated: https://docs.flutter.dev/platform-integration/android/predictive-back <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <[email protected]>
1 parent 9583f28 commit 0e57a62

23 files changed

+48
-388
lines changed

examples/api/test/material/divider/divider.0_test.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ void main() {
1313
expect(find.byType(Divider), findsOneWidget);
1414

1515
// Divider is positioned horizontally.
16-
final Offset container = tester.getBottomLeft(
17-
find
18-
.descendant(of: find.byType(example.DividerExample), matching: find.byType(ColoredBox))
19-
.first,
20-
);
16+
final Offset container = tester.getBottomLeft(find.byType(ColoredBox).first);
2117
expect(container.dy, tester.getTopLeft(find.byType(Divider)).dy);
2218

2319
final Offset subheader = tester.getTopLeft(find.text('Subheader'));

examples/api/test/widgets/basic/listener.0_test.dart

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,7 @@ void main() {
1616

1717
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
1818
await gesture.addPointer();
19-
await gesture.down(
20-
tester.getCenter(
21-
find.descendant(
22-
of: find.byType(example.ListenerExample),
23-
matching: find.byType(ColoredBox),
24-
),
25-
),
26-
);
19+
await gesture.down(tester.getCenter(find.byType(ColoredBox)));
2720
await tester.pump();
2821

2922
expect(find.text('1 presses\n0 releases'), findsOneWidget);

examples/api/test/widgets/basic/mouse_region.0_test.dart

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,13 @@ void main() {
1818

1919
final TestGesture gesture = await tester.createGesture(kind: PointerDeviceKind.mouse);
2020
await gesture.addPointer();
21-
await gesture.moveTo(
22-
tester.getCenter(
23-
find.descendant(
24-
of: find.byType(example.MouseRegionExample),
25-
matching: find.byType(ColoredBox),
26-
),
27-
),
28-
);
21+
await gesture.moveTo(tester.getCenter(find.byType(ColoredBox)));
2922
await tester.pump();
3023

3124
expect(find.text('1 Entries\n0 Exits'), findsOneWidget);
3225
expect(find.text('The cursor is here: (400.00, 328.00)'), findsOneWidget);
3326

34-
await gesture.moveTo(
35-
tester.getCenter(
36-
find.descendant(
37-
of: find.byType(example.MouseRegionExample),
38-
matching: find.byType(ColoredBox),
39-
),
40-
) +
41-
const Offset(50.0, 30.0),
42-
);
27+
await gesture.moveTo(tester.getCenter(find.byType(ColoredBox)) + const Offset(50.0, 30.0));
4328
await tester.pump();
4429

4530
expect(find.text('The cursor is here: (450.00, 358.00)'), findsOneWidget);

examples/api/test/widgets/heroes/hero.0_test.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ void main() {
2424
expect(heroSize.height.roundToDouble(), 60.0);
2525

2626
// Jump to 50% into the transition.
27-
await tester.pump(quarterTransition);
27+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
2828
heroSize = tester.getSize(find.byType(Container));
2929
expect(heroSize.width.roundToDouble(), 189.0);
3030
expect(heroSize.height.roundToDouble(), 146.0);
3131

3232
// Jump to 75% into the transition.
33-
await tester.pump(quarterTransition);
33+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
3434
heroSize = tester.getSize(find.byType(Container));
3535
expect(heroSize.width.roundToDouble(), 199.0);
3636
expect(heroSize.height.roundToDouble(), 190.0);
3737

3838
// Jump to 100% into the transition.
39-
await tester.pump(quarterTransition);
39+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
4040
heroSize = tester.getSize(find.byType(Container));
4141
expect(heroSize, const Size(200.0, 200.0));
4242

@@ -45,25 +45,25 @@ void main() {
4545
await tester.pump();
4646

4747
// Jump 25% into the transition (total length = 300ms)
48-
await tester.pump(quarterTransition);
48+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
4949
heroSize = tester.getSize(find.byType(Container));
5050
expect(heroSize.width.roundToDouble(), 199.0);
5151
expect(heroSize.height.roundToDouble(), 190.0);
5252

5353
// Jump to 50% into the transition.
54-
await tester.pump(quarterTransition);
54+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
5555
heroSize = tester.getSize(find.byType(Container));
5656
expect(heroSize.width.roundToDouble(), 189.0);
5757
expect(heroSize.height.roundToDouble(), 146.0);
5858

5959
// Jump to 75% into the transition.
60-
await tester.pump(quarterTransition);
60+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
6161
heroSize = tester.getSize(find.byType(Container));
6262
expect(heroSize.width.roundToDouble(), 103.0);
6363
expect(heroSize.height.roundToDouble(), 60.0);
6464

6565
// Jump to 100% into the transition.
66-
await tester.pump(quarterTransition);
66+
await tester.pump(const Duration(milliseconds: 75)); // 25% of 300ms
6767
heroSize = tester.getSize(find.byType(Container));
6868
expect(heroSize, const Size(50.0, 50.0));
6969
});

examples/api/test/widgets/transitions/align_transition.0_test.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
99
void main() {
1010
testWidgets('Shows flutter logo in transition', (WidgetTester tester) async {
1111
await tester.pumpWidget(const example.AlignTransitionExampleApp());
12-
expect(
13-
find.descendant(
14-
of: find.byType(example.AlignTransitionExample),
15-
matching: find.byType(ColoredBox),
16-
),
17-
findsOneWidget,
18-
);
12+
expect(find.byType(ColoredBox), findsOneWidget);
1913
expect(
2014
find.byWidgetPredicate(
2115
(Widget padding) => padding is Padding && padding.padding == const EdgeInsets.all(8.0),

examples/api/test/widgets/transitions/fade_transition.0_test.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,16 @@ void main() {
1313
await tester.pumpWidget(const example.FadeTransitionExampleApp());
1414

1515
expect(
16-
find.descendant(
17-
of: find.byType(example.FadeTransitionExample),
18-
matching: find.byType(FadeTransition),
19-
),
16+
find.ancestor(of: find.byType(FlutterLogo), matching: find.byType(FadeTransition)),
2017
findsOneWidget,
2118
);
2219
});
2320

2421
testWidgets('FadeTransition animates', (WidgetTester tester) async {
2522
await tester.pumpWidget(const example.FadeTransitionExampleApp());
2623

27-
final Finder fadeTransitionFinder = find.descendant(
28-
of: find.byType(example.FadeTransitionExample),
24+
final Finder fadeTransitionFinder = find.ancestor(
25+
of: find.byType(FlutterLogo),
2926
matching: find.byType(FadeTransition),
3027
);
3128

examples/api/test/widgets/transitions/slide_transition.0_test.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ void main() {
1313
expect(find.byType(Center), findsOneWidget);
1414
expect(find.byType(FlutterLogo), findsOneWidget);
1515
expect(find.byType(Padding), findsAtLeast(1));
16-
expect(
17-
find.descendant(
18-
of: find.byType(example.SlideTransitionExample),
19-
matching: find.byType(SlideTransition),
20-
),
21-
findsOneWidget,
22-
);
16+
expect(find.byType(SlideTransition), findsOneWidget);
2317
});
2418

2519
testWidgets('Animates repeatedly every 2 seconds', (WidgetTester tester) async {

packages/flutter/lib/src/material/page_transitions_theme.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import 'package:flutter/services.dart';
1717

1818
import 'color_scheme.dart';
1919
import 'colors.dart';
20-
import 'predictive_back_page_transitions_builder.dart';
2120
import 'theme.dart';
2221

2322
// Slides the page upwards and fades it in, starting from 1/4 screen
@@ -760,12 +759,7 @@ class FadeForwardsPageTransitionsBuilder extends PageTransitionsBuilder {
760759
final Color? backgroundColor;
761760

762761
/// The value of [transitionDuration] in milliseconds.
763-
///
764-
/// Eyeballed on a physical Pixel 9 running Android 16. This does not match
765-
/// the actual value used by native Android, which is 800ms, because native
766-
/// Android is using Material 3 Expressive springs that are not currently
767-
/// supported by Flutter. So for now at least, this is an approximation.
768-
static const int kTransitionMilliseconds = 450;
762+
static const int kTransitionMilliseconds = 800;
769763

770764
@override
771765
Duration get transitionDuration => const Duration(milliseconds: kTransitionMilliseconds);
@@ -1103,7 +1097,7 @@ class PageTransitionsTheme with Diagnosticable {
11031097

11041098
static const Map<TargetPlatform, PageTransitionsBuilder> _defaultBuilders =
11051099
<TargetPlatform, PageTransitionsBuilder>{
1106-
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
1100+
TargetPlatform.android: ZoomPageTransitionsBuilder(),
11071101
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
11081102
TargetPlatform.macOS: CupertinoPageTransitionsBuilder(),
11091103
TargetPlatform.windows: ZoomPageTransitionsBuilder(),

packages/flutter/test/material/bottom_app_bar_test.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ void main() {
191191
final BottomAppBar bottomAppBar = tester.widget(find.byType(BottomAppBar));
192192
expect(bottomAppBar.padding, customPadding);
193193
final Rect babRect = tester.getRect(find.byType(BottomAppBar));
194-
final Rect childRect = tester.getRect(
195-
find.descendant(of: find.byType(BottomAppBar), matching: find.byType(ColoredBox)),
196-
);
194+
final Rect childRect = tester.getRect(find.byType(ColoredBox));
197195
expect(childRect, const Rect.fromLTRB(250, 530, 550, 590));
198196
expect(babRect, const Rect.fromLTRB(240, 520, 560, 600));
199197
});

packages/flutter/test/material/expansion_tile_test.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1690,9 +1690,7 @@ void main() {
16901690
);
16911691

16921692
final Size materialAppSize = tester.getSize(find.byType(MaterialApp));
1693-
final Size titleSize = tester.getSize(
1694-
find.descendant(of: find.byType(ExpansionTile), matching: find.byType(ColoredBox)),
1695-
);
1693+
final Size titleSize = tester.getSize(find.byType(ColoredBox));
16961694

16971695
expect(titleSize.width, materialAppSize.width);
16981696
},
@@ -1715,9 +1713,7 @@ void main() {
17151713
);
17161714

17171715
final Size materialAppSize = tester.getSize(find.byType(MaterialApp));
1718-
final Size titleSize = tester.getSize(
1719-
find.descendant(of: find.byType(ExpansionTile), matching: find.byType(ColoredBox)),
1720-
);
1716+
final Size titleSize = tester.getSize(find.byType(ColoredBox));
17211717

17221718
expect(titleSize.width, materialAppSize.width - 32.0);
17231719
},

0 commit comments

Comments
 (0)