jonataslaw
Committed by GitHub

Delete material.dart

1 -import 'package:flutter/cupertino.dart';  
2 -import 'package:flutter/material.dart';  
3 -  
4 -/// A modal route that replaces the entire screen with a platform-adaptive  
5 -/// transition.  
6 -///  
7 -/// For Android, the entrance transition for the page slides the page upwards  
8 -/// and fades it in. The exit transition is the same, but in reverse.  
9 -///  
10 -/// The transition is adaptive to the platform and on iOS, the page slides in  
11 -/// from the right and exits in reverse. The page also shifts to the left in  
12 -/// parallax when another page enters to cover it. (These directions are flipped  
13 -/// in environments with a right-to-left reading direction.)  
14 -///  
15 -/// By default, when a modal route is replaced by another, the previous route  
16 -/// remains in memory. To free all the resources when this is not necessary, set  
17 -/// [maintainState] to false.  
18 -///  
19 -/// The `fullscreenDialog` property specifies whether the incoming page is a  
20 -/// fullscreen modal dialog. On iOS, those pages animate from the bottom to the  
21 -/// top rather than horizontally.  
22 -///  
23 -/// The type `T` specifies the return type of the route which can be supplied as  
24 -/// the route is popped from the stack via [Navigator.pop] by providing the  
25 -/// optional `result` argument.  
26 -///  
27 -/// See also:  
28 -///  
29 -/// * [PageTransitionsTheme], which defines the default page transitions used  
30 -/// by [MaterialPageRoute.buildTransitions].  
31 -class GetRoute<T> extends PageRoute<T> {  
32 - /// Construct a MaterialPageRoute whose contents are defined by [builder].  
33 - ///  
34 - /// The values of [builder], [maintainState], and [fullScreenDialog] must not  
35 - /// be null.  
36 - GetRoute({  
37 - @required this.builder,  
38 - RouteSettings settings,  
39 - this.opaque = true,  
40 - this.maintainState = true,  
41 - bool fullscreenDialog = false,  
42 - }) : assert(builder != null),  
43 - assert(maintainState != null),  
44 - assert(fullscreenDialog != null),  
45 - assert(opaque != null),  
46 - super(settings: settings, fullscreenDialog: fullscreenDialog);  
47 -  
48 - /// Builds the primary contents of the route.  
49 - final WidgetBuilder builder;  
50 -  
51 - @override  
52 - final bool maintainState;  
53 -  
54 - /// Allows you to set opaque to false to prevent route reconstruction.  
55 - @override  
56 - final bool opaque;  
57 -  
58 - @override  
59 - Duration get transitionDuration => const Duration(milliseconds: 300);  
60 -  
61 - @override  
62 - Color get barrierColor => null;  
63 -  
64 - @override  
65 - String get barrierLabel => null;  
66 -  
67 - @override  
68 - bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) {  
69 - return previousRoute is GetRoute || previousRoute is CupertinoPageRoute;  
70 - }  
71 -  
72 - @override  
73 - bool canTransitionTo(TransitionRoute<dynamic> nextRoute) {  
74 - // Don't perform outgoing animation if the next route is a fullscreen dialog.  
75 - return (nextRoute is GetRoute && !nextRoute.fullscreenDialog)  
76 - || (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog);  
77 - }  
78 -  
79 - @override  
80 - Widget buildPage(  
81 - BuildContext context,  
82 - Animation<double> animation,  
83 - Animation<double> secondaryAnimation,  
84 - ) {  
85 - final Widget result = builder(context);  
86 - assert(() {  
87 - if (result == null) {  
88 - throw FlutterError.fromParts(<DiagnosticsNode>[  
89 - ErrorSummary('The builder for route "${settings.name}" returned null.'),  
90 - ErrorDescription('Route builders must never return null.')  
91 - ]);  
92 - }  
93 - return true;  
94 - }());  
95 - return Semantics(  
96 - scopesRoute: true,  
97 - explicitChildNodes: true,  
98 - child: result,  
99 - );  
100 - }  
101 -  
102 - @override  
103 - Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {  
104 - final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme;  
105 - return theme.buildTransitions<T>(this, context, animation, secondaryAnimation, child);  
106 - }  
107 -  
108 - @override  
109 - String get debugLabel => '${super.debugLabel}(${settings.name})';  
110 -}