@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
3
3
// ignore: depend_on_referenced_packages
4
4
import 'package:flutter_web_plugins/url_strategy.dart' ;
5
5
import 'package:minimal/pages/pages.dart' ;
6
- import 'package:minimal/routes .dart' ;
6
+ import 'package:minimal/utils/no_animation_page_transitions_builder .dart' ;
7
7
import 'package:responsive_framework/responsive_framework.dart' ;
8
8
9
9
void main () {
@@ -44,6 +44,16 @@ class MyApp extends StatelessWidget {
44
44
final Uri uri = Uri .parse (settings.name ?? '/' );
45
45
return buildPage (path: uri.path, queryParams: uri.queryParameters);
46
46
},
47
+ theme: ThemeData (
48
+ pageTransitionsTheme: PageTransitionsTheme (
49
+ builders: {
50
+ TargetPlatform .fuchsia: NoAnimationPageTransitionsBuilder (),
51
+ TargetPlatform .linux: NoAnimationPageTransitionsBuilder (),
52
+ TargetPlatform .macOS: NoAnimationPageTransitionsBuilder (),
53
+ TargetPlatform .windows: NoAnimationPageTransitionsBuilder (),
54
+ },
55
+ ),
56
+ ),
47
57
debugShowCheckedModeBanner: false ,
48
58
);
49
59
}
@@ -52,25 +62,26 @@ class MyApp extends StatelessWidget {
52
62
// Navigate using the page name, `Navigator.pushNamed(context, ListPage.name)`.
53
63
Route <dynamic > buildPage (
54
64
{required String path, Map <String , String > queryParams = const {}}) {
55
- return Routes .noAnimation (
56
- settings: RouteSettings (
57
- name: (path.startsWith ('/' ) == false ) ? '/$path ' : path),
58
- builder: (context) {
59
- String pathName =
60
- path != '/' && path.startsWith ('/' ) ? path.substring (1 ) : path;
61
- return switch (pathName) {
62
- '/' || ListPage .name => const ListPage (),
63
- PostPage .name =>
64
- // Breakpoints can be nested.
65
- // Here's an example of custom "per-page" breakpoints.
66
- const ResponsiveBreakpoints (breakpoints: [
67
- Breakpoint (start: 0 , end: 480 , name: MOBILE ),
68
- Breakpoint (start: 481 , end: 1200 , name: TABLET ),
69
- Breakpoint (start: 1201 , end: double .infinity, name: DESKTOP ),
70
- ], child: PostPage ()),
71
- TypographyPage .name => const TypographyPage (),
72
- _ => const SizedBox .shrink (),
73
- };
74
- });
65
+ return PageRouteBuilder (
66
+ settings: RouteSettings (
67
+ name: (path.startsWith ('/' ) == false ) ? '/$path ' : path),
68
+ pageBuilder: (context, animation, secondaryAnimation) {
69
+ String pathName =
70
+ path != '/' && path.startsWith ('/' ) ? path.substring (1 ) : path;
71
+ return switch (pathName) {
72
+ '/' || ListPage .name => const ListPage (),
73
+ PostPage .name =>
74
+ // Breakpoints can be nested.
75
+ // Here's an example of custom "per-page" breakpoints.
76
+ const ResponsiveBreakpoints (breakpoints: [
77
+ Breakpoint (start: 0 , end: 480 , name: MOBILE ),
78
+ Breakpoint (start: 481 , end: 1200 , name: TABLET ),
79
+ Breakpoint (start: 1201 , end: double .infinity, name: DESKTOP ),
80
+ ], child: PostPage ()),
81
+ TypographyPage .name => const TypographyPage (),
82
+ _ => const SizedBox .shrink (),
83
+ };
84
+ },
85
+ );
75
86
}
76
87
}
0 commit comments