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-12-13 11:32:19 -0300
Browse Files
Options
Browse Files
Download
Plain Diff
Committed by
GitHub
2021-12-13 11:32:19 -0300
Commit
ddec87b54be01b2d3f594d4e35335ed5964d6fbb
ddec87b5
2 parents
7c5083f0
98622251
Merge pull request #2050 from jonataslaw/4.5.1
Circular reveal
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
0 deletions
lib/get_navigation/src/routes/circular_reveal_clipper.dart
lib/get_navigation/src/routes/default_transitions.dart
lib/get_navigation/src/routes/get_transition_mixin.dart
lib/get_navigation/src/routes/circular_reveal_clipper.dart
0 → 100644
View file @
ddec87b
import
'dart:math'
show
sqrt
,
max
;
import
'dart:ui'
show
lerpDouble
;
import
'package:flutter/material.dart'
;
class
CircularRevealClipper
extends
CustomClipper
<
Path
>
{
final
double
fraction
;
final
Alignment
?
centerAlignment
;
final
Offset
?
centerOffset
;
final
double
?
minRadius
;
final
double
?
maxRadius
;
CircularRevealClipper
({
required
this
.
fraction
,
this
.
centerAlignment
,
this
.
centerOffset
,
this
.
minRadius
,
this
.
maxRadius
,
});
@override
Path
getClip
(
Size
size
)
{
final
Offset
center
=
this
.
centerAlignment
?.
alongSize
(
size
)
??
this
.
centerOffset
??
Offset
(
size
.
width
/
2
,
size
.
height
/
2
);
final
minRadius
=
this
.
minRadius
??
0
;
final
maxRadius
=
this
.
maxRadius
??
calcMaxRadius
(
size
,
center
);
return
Path
()
..
addOval
(
Rect
.
fromCircle
(
center:
center
,
radius:
lerpDouble
(
minRadius
,
maxRadius
,
fraction
)!,
),
);
}
@override
bool
shouldReclip
(
CustomClipper
<
Path
>
oldClipper
)
=>
true
;
static
double
calcMaxRadius
(
Size
size
,
Offset
center
)
{
final
w
=
max
(
center
.
dx
,
size
.
width
-
center
.
dx
);
final
h
=
max
(
center
.
dy
,
size
.
height
-
center
.
dy
);
return
sqrt
(
w
*
w
+
h
*
h
);
}
}
...
...
lib/get_navigation/src/routes/default_transitions.dart
View file @
ddec87b
...
...
@@ -184,3 +184,26 @@ class SizeTransitions {
);
}
}
class
CircularRevealTransition
{
Widget
buildTransitions
(
BuildContext
context
,
Curve
?
curve
,
Alignment
?
alignment
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
,
Widget
child
)
{
return
ClipPath
(
clipper:
CircularRevealClipper
(
fraction:
animation
.
value
,
centerAlignment:
Alignment
.
center
,
centerOffset:
Offset
.
zero
,
minRadius:
0
,
maxRadius:
800
,
),
child:
child
,
);
}
}
...
...
lib/get_navigation/src/routes/get_transition_mixin.dart
View file @
ddec87b
...
...
@@ -619,6 +619,22 @@ Cannot read the previousTitle for a route that has not yet been installed''',
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
:
child
);
case
Transition
.
ciruclarReveal
:
return
CircularRevealTransition
().
buildTransitions
(
context
,
route
.
curve
,
route
.
alignment
,
animation
,
secondaryAnimation
,
route
.
popGesture
??
Get
.
defaultPopGesture
?
CupertinoBackGestureDetector
<
T
>(
gestureWidth:
route
.
gestureWidth
?.
call
(
context
)
??
_kBackGestureWidth
,
enabledCallback:
()
=>
_isPopGestureEnabled
<
T
>(
route
),
onStartPopGesture:
()
=>
_startPopGesture
<
T
>(
route
),
child:
child
)
:
child
);
default
:
if
(
Get
.
customTransition
!=
null
)
{
...
...
Please
register
or
login
to post a comment