Skip to content

Commit 662b1e3

Browse files
auto-submit[bot]auto-submit[bot]
authored andcommitted
Reverts "Match CupertinoPageTransitionsBuilder animation duration to CupertinoPageRoute (flutter#160241)" (flutter#161555)
<!-- start_original_pr_link --> Reverts: flutter#160241 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: yjbanov <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: there's evidence that this broke the tree <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: chika3742 <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {chunhtai, MitchellGoodwin} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: <!-- Thanks for filing a pull request! Reviewers are typically assigned within a week of filing a request. To learn more about code review, see our documentation on Tree Hygiene: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md --> The recent changes have made it possible to customize the duration in PageTransitionsBuilder, so I have adjusted CupertinoPageTransitionsBuilder's transition duration to CupertinoPageRoute. related issue: flutter#29068 | Before | After | Native | | --- | --- | --- | | <video src="https://github.com/user-attachments/assets/1420bb86-37d2-4d5a-b0f9-e0860e3c8f01"> | <video src="https://github.com/user-attachments/assets/f0455f3a-ca80-4cb6-a803-b9c48ec2075e"> | <video src="https://github.com/user-attachments/assets/74218f9d-f4a1-4008-84ac-caf73355f467"> | ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <[email protected]>
1 parent 4989e83 commit 662b1e3

File tree

4 files changed

+4
-53
lines changed

4 files changed

+4
-53
lines changed

packages/flutter/lib/src/cupertino/route.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,9 @@ mixin CupertinoRouteTransitionMixin<T> on PageRoute<T> {
148148
super.didChangePrevious(previousRoute);
149149
}
150150

151-
/// The duration of the page transition.
152-
///
153-
/// A relatively rigorous eyeball estimation.
154-
static const Duration kTransitionDuration = Duration(milliseconds: 500);
155-
156151
@override
157-
Duration get transitionDuration => kTransitionDuration;
152+
// A relatively rigorous eyeball estimation.
153+
Duration get transitionDuration => const Duration(milliseconds: 500);
158154

159155
@override
160156
Color? get barrierColor => fullscreenDialog ? null : _kCupertinoPageTransitionBarrierColor;

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,9 +1019,6 @@ class CupertinoPageTransitionsBuilder extends PageTransitionsBuilder {
10191019
/// Constructs a page transition animation that matches the iOS transition.
10201020
const CupertinoPageTransitionsBuilder();
10211021

1022-
@override
1023-
Duration get transitionDuration => CupertinoRouteTransitionMixin.kTransitionDuration;
1024-
10251022
@override
10261023
DelegatedTransitionBuilder? get delegatedTransition =>
10271024
CupertinoPageTransition.delegatedTransition;

packages/flutter/test/material/page_transitions_theme_test.dart

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -286,48 +286,6 @@ void main() {
286286
variant: TargetPlatformVariant.only(TargetPlatform.android),
287287
);
288288

289-
testWidgets(
290-
'CupertinoPageTransitionsBuilder default duration is 500ms',
291-
(WidgetTester tester) async {
292-
final Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{
293-
'/':
294-
(BuildContext context) => Material(
295-
child: TextButton(
296-
child: const Text('push'),
297-
onPressed: () {
298-
Navigator.of(context).pushNamed('/b');
299-
},
300-
),
301-
),
302-
'/b': (BuildContext context) => const Text('page b'),
303-
};
304-
305-
await tester.pumpWidget(
306-
MaterialApp(
307-
theme: ThemeData(
308-
pageTransitionsTheme: const PageTransitionsTheme(
309-
builders: <TargetPlatform, PageTransitionsBuilder>{
310-
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
311-
},
312-
),
313-
),
314-
routes: routes,
315-
),
316-
);
317-
318-
expect(find.byType(CupertinoPageTransition), findsOneWidget);
319-
320-
await tester.tap(find.text('push'));
321-
await tester.pump();
322-
await tester.pump(const Duration(milliseconds: 499));
323-
expect(tester.hasRunningAnimations, isTrue);
324-
325-
await tester.pump(const Duration(milliseconds: 10));
326-
expect(tester.hasRunningAnimations, isFalse);
327-
},
328-
variant: TargetPlatformVariant.only(TargetPlatform.iOS),
329-
);
330-
331289
testWidgets(
332290
'Animation duration changes accordingly when page transition builder changes',
333291
(WidgetTester tester) async {

packages/flutter/test/widgets/heroes_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ Future<void> main() async {
19751975

19761976
await tester.tap(find.text('two'));
19771977
await tester.pump();
1978-
await tester.pump(const Duration(milliseconds: 501));
1978+
await tester.pump(const Duration(milliseconds: 500));
19791979

19801980
expect(find.byKey(firstKey), findsNothing);
19811981
expect(find.byKey(secondKey), isOnstage);
@@ -2016,7 +2016,7 @@ Future<void> main() async {
20162016

20172017
await tester.tap(find.text('two'));
20182018
await tester.pump();
2019-
await tester.pump(const Duration(milliseconds: 501));
2019+
await tester.pump(const Duration(milliseconds: 500));
20202020

20212021
expect(find.byKey(firstKey), findsNothing);
20222022
expect(find.byKey(secondKey), isOnstage);

0 commit comments

Comments
 (0)