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
Ravi Parmar
2021-11-02 23:00:12 +0530
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2021-11-02 23:00:12 +0530
Commit
b2783ab2def33f9d84db16e3028db9e7ae628586
b2783ab2
1 parent
dfea3859
Created CircularRevealClipper
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
lib/get_navigation/src/routes/circular_reveal_clipper.dart
lib/get_navigation/src/routes/circular_reveal_clipper.dart
0 → 100644
View file @
b2783ab
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
);
}
}
...
...
Please
register
or
login
to post a comment