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 18:45:16 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a0af6035974170ec648d8bf0189cef9c46f475bf
a0af6035
1 parent
f3ab7d4f
expose curve of the animation for material
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
4 deletions
lib/src/bottom_sheet.dart
lib/src/bottom_sheet_route.dart
lib/src/bottom_sheets/bar_bottom_sheet.dart
lib/src/bottom_sheets/material_bottom_sheet.dart
lib/src/bottom_sheet.dart
View file @
a0af603
...
...
@@ -38,6 +38,7 @@ class ModalBottomSheet extends StatefulWidget {
const
ModalBottomSheet
({
Key
key
,
this
.
animationController
,
this
.
animationCurve
,
this
.
enableDrag
=
true
,
this
.
containerBuilder
,
this
.
bounce
=
true
,
...
...
@@ -58,6 +59,11 @@ class ModalBottomSheet extends StatefulWidget {
/// is not just a passive observer.
final
AnimationController
animationController
;
/// The curve used by the animation showing and dismissing the bottom sheet.
///
/// If no curve is provided it falls back to `Curves.easeOutSine`.
final
Curve
animationCurve
;
/// Allows the bottom sheet to go beyond the top bound of the content,
/// but then bounce the content back to the edge of
/// the top bound.
...
...
@@ -276,7 +282,7 @@ class _ModalBottomSheetState extends State<ModalBottomSheet>
Widget
build
(
BuildContext
context
)
{
final
bounceAnimation
=
CurvedAnimation
(
parent:
_bounceDragController
,
curve:
Curves
.
easeOutSine
,
curve:
widget
.
animationCurve
??
Curves
.
easeOutSine
,
);
var
child
=
widget
.
builder
(
context
,
_scrollController
);
...
...
lib/src/bottom_sheet_route.dart
View file @
a0af603
...
...
@@ -17,6 +17,7 @@ class _ModalBottomSheet<T> extends StatefulWidget {
this
.
scrollController
,
this
.
expanded
=
false
,
this
.
enableDrag
=
true
,
this
.
animationCurve
,
})
:
assert
(
expanded
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
key:
key
);
...
...
@@ -26,6 +27,7 @@ class _ModalBottomSheet<T> extends StatefulWidget {
final
bool
bounce
;
final
bool
enableDrag
;
final
AnimationController
secondAnimationController
;
final
Curve
animationCurve
;
final
ScrollController
scrollController
;
@override
...
...
@@ -97,6 +99,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
builder:
widget
.
route
.
builder
,
enableDrag:
widget
.
enableDrag
,
bounce:
widget
.
bounce
,
animationCurve:
widget
.
animationCurve
,
),
);
},
...
...
@@ -116,6 +119,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
this
.
enableDrag
=
true
,
@required
this
.
expanded
,
this
.
bounce
=
false
,
this
.
animationCurve
,
RouteSettings
settings
,
})
:
assert
(
expanded
!=
null
),
assert
(
isDismissible
!=
null
),
...
...
@@ -132,6 +136,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
final
ScrollController
scrollController
;
final
AnimationController
secondAnimationController
;
final
Curve
animationCurve
;
@override
Duration
get
transitionDuration
=>
_bottomSheetDuration
;
...
...
@@ -172,6 +177,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
scrollController:
scrollController
,
bounce:
bounce
,
enableDrag:
enableDrag
,
animationCurve:
animationCurve
,
),
);
return
bottomSheet
;
...
...
@@ -195,8 +201,8 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
}
/// Shows a modal material design bottom sheet.
Future
<
T
>
showCustomModalBottomSheet
<
T
>(
{
@required
BuildContext
context
,
Future
<
T
>
showCustomModalBottomSheet
<
T
>({
@required
BuildContext
context
,
@required
ScrollWidgetBuilder
builder
,
@required
WidgetWithChildBuilder
containerWidget
,
Color
backgroundColor
,
...
...
@@ -207,10 +213,12 @@ Future<T> showCustomModalBottomSheet<T>(
bool
bounce
=
false
,
bool
expand
=
false
,
AnimationController
secondAnimation
,
Curve
animationCurve
,
bool
useRootNavigator
=
false
,
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
ScrollController
scrollController
})
async
{
ScrollController
scrollController
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
containerWidget
!=
null
);
...
...
@@ -231,6 +239,7 @@ Future<T> showCustomModalBottomSheet<T>(
isDismissible:
isDismissible
,
modalBarrierColor:
barrierColor
,
enableDrag:
enableDrag
,
animationCurve:
animationCurve
,
));
return
result
;
}
...
...
lib/src/bottom_sheets/bar_bottom_sheet.dart
View file @
a0af603
...
...
@@ -66,6 +66,7 @@ Future<T> showBarModalBottomSheet<T>({
bool
bounce
=
true
,
bool
expand
=
false
,
AnimationController
secondAnimation
,
Curve
animationCurve
,
bool
useRootNavigator
=
false
,
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
...
...
@@ -91,6 +92,7 @@ Future<T> showBarModalBottomSheet<T>({
isDismissible:
isDismissible
,
modalBarrierColor:
barrierColor
,
enableDrag:
enableDrag
,
animationCurve:
animationCurve
,
));
return
result
;
}
...
...
lib/src/bottom_sheets/material_bottom_sheet.dart
View file @
a0af603
...
...
@@ -14,6 +14,7 @@ Future<T> showMaterialModalBottomSheet<T>({
bool
bounce
=
false
,
bool
expand
=
false
,
AnimationController
secondAnimation
,
Curve
animationCurve
,
bool
useRootNavigator
=
false
,
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
...
...
@@ -44,6 +45,7 @@ Future<T> showMaterialModalBottomSheet<T>({
isDismissible:
isDismissible
,
modalBarrierColor:
barrierColor
,
enableDrag:
enableDrag
,
animationCurve:
animationCurve
,
));
return
result
;
}
...
...
Please
register
or
login
to post a comment