Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
modal_bottom_sheet
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
bierbaumtim
2020-05-01 19:35:34 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0254b2f9559ac895d2767adebbe2abd5d9ff838a
0254b2f9
1 parent
a0af6035
expose Curve for routeAnimation and modal animation
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
0254b2f
...
...
@@ -72,6 +72,8 @@ Future<T> showCupertinoModalBottomSheet<T>({
Color
barrierColor
,
bool
expand
=
false
,
AnimationController
secondAnimation
,
Curve
routeAnimationCurve
,
Curve
modalAnimationCurve
,
bool
useRootNavigator
=
false
,
bool
bounce
=
true
,
bool
isDismissible
,
...
...
@@ -107,11 +109,15 @@ Future<T> showCupertinoModalBottomSheet<T>({
isDismissible:
isDismissible
??
expand
==
false
?
true
:
false
,
modalBarrierColor:
barrierColor
??
Colors
.
black12
,
enableDrag:
enableDrag
,
routeAnimationCurve:
routeAnimationCurve
,
modalAnimationCurve:
modalAnimationCurve
,
));
return
result
;
}
class
CupertinoModalBottomSheetRoute
<
T
>
extends
ModalBottomSheetRoute
<
T
>
{
final
Curve
modalAnimationCurve
;
CupertinoModalBottomSheetRoute
({
ScrollWidgetBuilder
builder
,
WidgetWithChildBuilder
containerBuilder
,
...
...
@@ -120,12 +126,14 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
ShapeBorder
shape
,
Clip
clipBehavior
,
AnimationController
secondAnimationController
,
Curve
routeAnimationCurve
,
Color
modalBarrierColor
,
bool
bounce
=
true
,
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
@required
bool
expanded
,
RouteSettings
settings
,
this
.
modalAnimationCurve
,
})
:
assert
(
expanded
!=
null
),
assert
(
isDismissible
!=
null
),
assert
(
enableDrag
!=
null
),
...
...
@@ -140,6 +148,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
enableDrag:
enableDrag
,
expanded:
expanded
,
settings:
settings
,
animationCurve:
routeAnimationCurve
,
);
@override
...
...
@@ -172,18 +181,25 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
Widget
getPreviousRouteTransition
(
BuildContext
context
,
Animation
<
double
>
secondaryAnimation
,
Widget
child
)
{
return
_CupertinoModalTransition
(
secondaryAnimation:
secondaryAnimation
,
body:
child
);
secondaryAnimation:
secondaryAnimation
,
body:
child
,
animationCurve:
modalAnimationCurve
,
);
}
}
class
_CupertinoModalTransition
extends
StatelessWidget
{
final
Animation
<
double
>
secondaryAnimation
;
final
Curve
animationCurve
;
final
Widget
body
;
const
_CupertinoModalTransition
(
{
Key
key
,
@required
this
.
secondaryAnimation
,
@required
this
.
body
})
:
super
(
key:
key
);
const
_CupertinoModalTransition
({
Key
key
,
@required
this
.
secondaryAnimation
,
@required
this
.
body
,
this
.
animationCurve
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -196,7 +212,7 @@ class _CupertinoModalTransition extends StatelessWidget {
final
curvedAnimation
=
CurvedAnimation
(
parent:
secondaryAnimation
,
curve:
Curves
.
easeOut
,
curve:
animationCurve
??
Curves
.
easeOut
,
);
return
AnnotatedRegion
<
SystemUiOverlayStyle
>(
...
...
@@ -261,6 +277,8 @@ class CupertinoScaffold extends StatefulWidget {
static
Future
<
T
>
showCupertinoModalBottomSheet
<
T
>({
@required
BuildContext
context
,
@required
ScrollWidgetBuilder
builder
,
Curve
routeAnimationCurve
,
Curve
modalAnimationCurve
,
Color
backgroundColor
,
Color
barrierColor
,
bool
expand
=
false
,
...
...
@@ -295,6 +313,8 @@ class CupertinoScaffold extends StatefulWidget {
isDismissible:
isDismissible
??
expand
==
false
?
true
:
false
,
modalBarrierColor:
barrierColor
??
Colors
.
black12
,
enableDrag:
enableDrag
,
routeAnimationCurve:
routeAnimationCurve
,
modalAnimationCurve:
modalAnimationCurve
,
));
return
result
;
}
...
...
Please
register
or
login
to post a comment