Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ahmed Fwela
2021-08-02 02:30:02 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
10a2175eca44852715019cd5a1950a398e6ce5d2
10a2175e
1 parent
963d837a
Added GetRouteAwarePageBuilder
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
1 deletions
lib/get_navigation/src/routes/default_route.dart
lib/get_navigation/src/routes/get_route.dart
lib/get_navigation/src/routes/transitions_type.dart
lib/get_navigation/src/routes/default_route.dart
View file @
10a2175
...
...
@@ -102,7 +102,13 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
}
final
pageToBuild
=
middlewareRunner
.
runOnPageBuildStart
(
page
)!;
return
middlewareRunner
.
runOnPageBuilt
(
pageToBuild
());
Widget
p
;
if
(
pageToBuild
is
GetRouteAwarePageBuilder
)
{
p
=
pageToBuild
(
this
);
}
else
{
p
=
pageToBuild
();
}
return
middlewareRunner
.
runOnPageBuilt
(
p
);
}
@override
...
...
lib/get_navigation/src/routes/get_route.dart
View file @
10a2175
...
...
@@ -182,3 +182,55 @@ class GetPage<T> extends Page<T> {
).
getPageToRoute
<
T
>(
this
,
unknownRoute
);
}
}
class
GetRouteAwarePage
<
T
>
extends
GetPage
<
T
>
{
GetRouteAwarePage
({
required
String
name
,
required
GetRouteAwarePageBuilder
page
,
bool
?
popGesture
,
Map
<
String
,
String
>?
parameters
,
String
?
title
,
Transition
?
transition
,
Curve
curve
=
Curves
.
linear
,
bool
?
participatesInRootNavigator
,
Alignment
?
alignment
,
bool
maintainState
=
true
,
bool
opaque
=
true
,
double
Function
(
BuildContext
context
)?
gestureWidth
,
Bindings
?
binding
,
List
<
Bindings
>
bindings
=
const
[],
CustomTransition
?
customTransition
,
Duration
?
transitionDuration
,
bool
fullscreenDialog
=
false
,
bool
preventDuplicates
=
true
,
Object
?
arguments
,
List
<
GetPage
>
children
=
const
<
GetPage
>[],
List
<
GetMiddleware
>?
middlewares
,
GetPage
?
unknownRoute
,
bool
showCupertinoParallax
=
true
,
})
:
super
(
name:
name
,
page:
page
,
alignment:
alignment
,
arguments:
arguments
,
binding:
binding
,
bindings:
bindings
,
children:
children
,
curve:
curve
,
customTransition:
customTransition
,
fullscreenDialog:
fullscreenDialog
,
gestureWidth:
gestureWidth
,
maintainState:
maintainState
,
middlewares:
middlewares
,
opaque:
opaque
,
parameters:
parameters
,
participatesInRootNavigator:
participatesInRootNavigator
,
popGesture:
popGesture
,
preventDuplicates:
preventDuplicates
,
showCupertinoParallax:
showCupertinoParallax
,
title:
title
,
transition:
transition
,
transitionDuration:
transitionDuration
,
unknownRoute:
unknownRoute
,
);
}
...
...
lib/get_navigation/src/routes/transitions_type.dart
View file @
10a2175
import
'package:flutter/widgets.dart'
;
import
'default_route.dart'
;
enum
Transition
{
fade
,
fadeIn
,
...
...
@@ -19,3 +21,4 @@ enum Transition {
}
typedef
GetPageBuilder
=
Widget
Function
();
typedef
GetRouteAwarePageBuilder
<
T
>
=
Widget
Function
([
GetPageRoute
<
T
>?
route
]);
...
...
Please
register
or
login
to post a comment