get_navigation_interface.dart
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import 'package:flutter/widgets.dart';
import '../../../get_instance/src/bindings_interface.dart';
import '../routes/get_route.dart';
import '../routes/transitions_type.dart';
/// Enables the user to customize the intended pop behavior
///
/// Goes to either the previous _activePages entry or the previous page entry
///
/// e.g. if the user navigates to these pages
/// 1) /home
/// 2) /home/products/1234
///
/// when popping on [History] mode, it will emulate a browser back button.
///
/// so the new _activePages stack will be:
/// 1) /home
///
/// when popping on [Page] mode, it will only remove the last part of the route
/// so the new _activePages stack will be:
/// 1) /home
/// 2) /home/products
///
/// another pop will change the _activePages stack to:
/// 1) /home
enum PopMode {
history,
page,
}
/// Enables the user to customize the behavior when pushing multiple routes that
/// shouldn't be duplicates
enum PreventDuplicateHandlingMode {
/// Removes the _activePages entries until it reaches the old route
popUntilOriginalRoute,
/// Simply don't push the new route
doNothing,
/// Recommended - Moves the old route entry to the front
///
/// With this mode, you guarantee there will be only one
/// route entry for each location
reorderRoutes,
recreate,
}
mixin IGetNavigation {
Future<T?> to<T>(
Widget Function() page, {
bool? opaque,
Transition? transition,
Curve? curve,
Duration? duration,
String? id,
String? routeName,
bool fullscreenDialog = false,
dynamic arguments,
List<BindingsInterface> bindings = const [],
bool preventDuplicates = true,
bool? popGesture,
bool showCupertinoParallax = true,
double Function(BuildContext context)? gestureWidth,
});
Future<void> popModeUntil(
String fullRoute, {
PopMode popMode = PopMode.history,
});
Future<T?> off<T>(
Widget Function() page, {
bool? opaque,
Transition? transition,
Curve? curve,
Duration? duration,
String? id,
String? routeName,
bool fullscreenDialog = false,
dynamic arguments,
List<BindingsInterface> bindings = const [],
bool preventDuplicates = true,
bool? popGesture,
bool showCupertinoParallax = true,
double Function(BuildContext context)? gestureWidth,
});
Future<T?>? offAll<T>(
Widget Function() page, {
bool Function(GetPage route)? predicate,
bool opaque = true,
bool? popGesture,
String? id,
String? routeName,
dynamic arguments,
List<BindingsInterface> bindings = const [],
bool fullscreenDialog = false,
Transition? transition,
Curve? curve,
Duration? duration,
bool showCupertinoParallax = true,
double Function(BuildContext context)? gestureWidth,
});
Future<T?> toNamed<T>(
String page, {
dynamic arguments,
String? id,
bool preventDuplicates = true,
Map<String, String>? parameters,
});
Future<T?> offNamed<T>(
String page, {
dynamic arguments,
String? id,
Map<String, String>? parameters,
});
Future<T?>? offAllNamed<T>(
String newRouteName, {
// bool Function(GetPage route)? predicate,
dynamic arguments,
String? id,
Map<String, String>? parameters,
});
Future<T?>? offNamedUntil<T>(
String page, {
bool Function(GetPage route)? predicate,
dynamic arguments,
String? id,
Map<String, String>? parameters,
});
Future<T?> toNamedAndOffUntil<T>(
String page,
bool Function(GetPage) predicate, [
Object? data,
]);
Future<T?> offUntil<T>(
Widget Function() page,
bool Function(GetPage) predicate, [
Object? arguments,
]);
void removeRoute<T>(String name);
void back<T>([T? result]);
Future<R?> backAndtoNamed<T, R>(String page, {T? result, Object? arguments});
void backUntil(bool Function(GetPage) predicate);
void goToUnknownPage([bool clearPages = true]);
}