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
Jonny Borges
2021-07-25 12:31:17 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
32a93f45a0862ccd0731a9e01012ff7fdc3ce78d
32a93f45
1 parent
4fa5f608
added: user can define cupertino parallex effect
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
28 deletions
lib/get_navigation/src/extension_navigation.dart
lib/get_navigation/src/routes/default_route.dart
lib/get_navigation/src/routes/get_route.dart
lib/get_navigation/src/routes/get_transition_mixin.dart
lib/get_navigation/src/routes/route_middleware.dart
lib/get_navigation/src/extension_navigation.dart
View file @
32a93f4
...
...
@@ -544,7 +544,7 @@ extension GetNavigation on GetInterface {
Bindings
?
binding
,
bool
preventDuplicates
=
true
,
bool
?
popGesture
,
double
gestureWidth
=
20
,
double
Function
(
BuildContext
context
)?
gestureWidth
,
})
{
var
routeName
=
"/
${page.runtimeType.toString()}
"
;
if
(
preventDuplicates
&&
routeName
==
currentRoute
)
{
...
...
@@ -914,7 +914,7 @@ you can only use widgets and widget functions here''';
bool
fullscreenDialog
=
false
,
bool
preventDuplicates
=
true
,
Duration
?
duration
,
double
gestureWidth
=
20
,
double
Function
(
BuildContext
context
)?
gestureWidth
,
})
{
var
routeName
=
"/
${page.runtimeType.toString()}
"
;
if
(
preventDuplicates
&&
routeName
==
currentRoute
)
{
...
...
@@ -977,7 +977,7 @@ you can only use widgets and widget functions here''';
Transition
?
transition
,
Curve
?
curve
,
Duration
?
duration
,
double
gestureWidth
=
20
,
double
Function
(
BuildContext
context
)?
gestureWidth
,
})
{
var
routeName
=
"/
${page.runtimeType.toString()}
"
;
...
...
lib/get_navigation/src/routes/default_route.dart
View file @
32a93f4
...
...
@@ -16,7 +16,7 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
this
.
transitionDuration
=
const
Duration
(
milliseconds:
300
),
this
.
opaque
=
true
,
this
.
parameter
,
this
.
gestureWidth
=
20.0
,
this
.
gestureWidth
,
this
.
curve
,
this
.
alignment
,
this
.
transition
,
...
...
@@ -29,6 +29,7 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
this
.
routeName
,
this
.
page
,
this
.
title
,
this
.
showCupertinoParallax
=
true
,
this
.
barrierLabel
,
this
.
maintainState
=
true
,
bool
fullscreenDialog
=
false
,
...
...
@@ -47,6 +48,9 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
final
List
<
Bindings
>?
bindings
;
@override
final
bool
showCupertinoParallax
;
@override
final
bool
opaque
;
final
bool
?
popGesture
;
...
...
@@ -109,5 +113,5 @@ class GetPageRoute<T> extends PageRoute<T> with GetPageRouteTransitionMixin<T> {
String
get
debugLabel
=>
'
${super.debugLabel}
(
${settings.name}
)'
;
@override
final
double
gestureWidth
;
final
double
Function
(
BuildContext
context
)?
gestureWidth
;
}
...
...
lib/get_navigation/src/routes/get_route.dart
View file @
32a93f4
...
...
@@ -38,7 +38,7 @@ class GetPage<T> extends Page<T> {
final
Alignment
?
alignment
;
final
bool
maintainState
;
final
bool
opaque
;
final
double
gestureWidth
;
final
double
Function
(
BuildContext
context
)?
gestureWidth
;
final
Bindings
?
binding
;
final
List
<
Bindings
>
bindings
;
final
CustomTransition
?
customTransition
;
...
...
@@ -61,13 +61,14 @@ class GetPage<T> extends Page<T> {
final
List
<
GetMiddleware
>?
middlewares
;
final
PathDecoded
path
;
final
GetPage
?
unknownRoute
;
final
bool
showCupertinoParallax
;
GetPage
({
required
this
.
name
,
required
this
.
page
,
this
.
title
,
this
.
participatesInRootNavigator
,
this
.
gestureWidth
=
20
,
this
.
gestureWidth
,
// RouteSettings settings,
this
.
maintainState
=
true
,
this
.
curve
=
Curves
.
linear
,
...
...
@@ -85,6 +86,7 @@ class GetPage<T> extends Page<T> {
this
.
middlewares
,
this
.
unknownRoute
,
this
.
arguments
,
this
.
showCupertinoParallax
=
true
,
this
.
preventDuplicates
=
true
,
})
:
path
=
_nameToRegex
(
name
),
super
(
...
...
@@ -136,9 +138,10 @@ class GetPage<T> extends Page<T> {
GetPage
?
unknownRoute
,
List
<
GetMiddleware
>?
middlewares
,
bool
?
preventDuplicates
,
double
?
gestureWidth
,
final
double
Function
(
BuildContext
context
)
?
gestureWidth
,
bool
?
participatesInRootNavigator
,
Object
?
arguments
,
bool
?
showCupertinoParallax
,
})
{
return
GetPage
(
participatesInRootNavigator:
...
...
@@ -164,6 +167,8 @@ class GetPage<T> extends Page<T> {
middlewares:
middlewares
??
this
.
middlewares
,
gestureWidth:
gestureWidth
??
this
.
gestureWidth
,
arguments:
arguments
??
this
.
arguments
,
showCupertinoParallax:
showCupertinoParallax
??
this
.
showCupertinoParallax
,
);
}
...
...
lib/get_navigation/src/routes/get_transition_mixin.dart
View file @
32a93f4
...
...
@@ -10,7 +10,7 @@ import '../../../get.dart';
import
'default_transitions.dart'
;
import
'transitions_type.dart'
;
//
const double _kBackGestureWidth = 20.0;
const
double
_kBackGestureWidth
=
20.0
;
const
double
_kMinFlingVelocity
=
1.0
;
// Screen widths per second.
// An eyeballed value for the maximum time it takes
...
...
@@ -36,7 +36,7 @@ mixin GetPageRouteTransitionMixin<T> on PageRoute<T> {
/// {@endtemplate}
String
?
get
title
;
double
get
gestureWidth
;
double
Function
(
BuildContext
context
)?
get
gestureWidth
;
ValueNotifier
<
String
?>?
_previousTitle
;
...
...
@@ -86,12 +86,16 @@ Cannot read the previousTitle for a route that has not yet been installed''',
@override
String
?
get
barrierLabel
=>
null
;
bool
get
showCupertinoParallax
;
@override
bool
canTransitionTo
(
TransitionRoute
<
dynamic
>
nextRoute
)
{
// Don't perform outgoing animation if the next route is a
// fullscreen dialog.
return
nextRoute
is
CupertinoRouteTransitionMixin
&&
!
nextRoute
.
fullscreenDialog
;
return
nextRoute
is
GetPageRouteTransitionMixin
&&
!
nextRoute
.
fullscreenDialog
&&
nextRoute
.
showCupertinoParallax
;
}
/// True if an iOS-style back swipe pop gesture is currently
...
...
@@ -231,7 +235,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -253,7 +258,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -268,7 +274,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -283,7 +290,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -292,7 +300,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
case
Transition
.
noTransition
:
return
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -307,7 +316,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -322,7 +332,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -337,7 +348,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -352,7 +364,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -367,7 +380,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -379,7 +393,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryRouteAnimation:
secondaryAnimation
,
linearTransition:
linearTransition
,
child:
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
,
...
...
@@ -395,7 +410,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -409,7 +425,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -423,7 +440,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -437,7 +455,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
@@ -456,7 +475,8 @@ Cannot read the previousTitle for a route that has not yet been installed''',
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
,
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
...
...
lib/get_navigation/src/routes/route_middleware.dart
View file @
32a93f4
...
...
@@ -207,6 +207,7 @@ class PageRedirect {
:
settings
,
curve:
_r
.
curve
,
opaque:
_r
.
opaque
,
showCupertinoParallax:
_r
.
showCupertinoParallax
,
gestureWidth:
_r
.
gestureWidth
,
customTransition:
_r
.
customTransition
,
binding:
_r
.
binding
,
...
...
@@ -234,6 +235,7 @@ class PageRedirect {
routeName:
_r
.
name
,
settings:
_r
,
curve:
_r
.
curve
,
showCupertinoParallax:
_r
.
showCupertinoParallax
,
gestureWidth:
_r
.
gestureWidth
,
opaque:
_r
.
opaque
,
customTransition:
_r
.
customTransition
,
...
...
Please
register
or
login
to post a comment