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
Jaime Blasco
2021-01-02 21:24:39 +0100
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
f2fed8c494befb6d87ce72f6213498e2a8cc8f88
f2fed8c4
2 parents
98280ace
bbe4bf14
Merge branch 'master' of
https://github.com/jamesblasco/modal_bottom_sheet
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
lib/src/bottom_sheet_route.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
lib/src/bottom_sheet_route.dart
View file @
f2fed8c
...
...
@@ -97,6 +97,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
label:
_getRouteLabel
(),
explicitChildNodes:
true
,
child:
ModalBottomSheet
(
closeProgressThreshold:
widget
.
closeProgressThreshold
,
expanded:
widget
.
route
.
expanded
,
containerBuilder:
widget
.
route
.
containerBuilder
,
animationController:
widget
.
route
.
_animationController
!,
...
...
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
f2fed8c
...
...
@@ -22,6 +22,7 @@ import '../bottom_sheet_route.dart';
const
double
_behind_widget_visible_height
=
10
;
const
Radius
_default_top_radius
=
Radius
.
circular
(
12
);
const
BoxShadow
_default_box_shadow
=
BoxShadow
(
blurRadius:
10
,
color:
Colors
.
black12
,
spreadRadius:
5
);
/// Cupertino Bottom Sheet Container
///
...
...
@@ -32,20 +33,23 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
final
Widget
child
;
final
Color
?
backgroundColor
;
final
Radius
topRadius
;
final
BoxShadow
?
shadow
;
const
_CupertinoBottomSheetContainer
({
Key
?
key
,
required
this
.
child
,
this
.
backgroundColor
,
required
this
.
topRadius
,
this
.
shadow
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
final
topSafeAreaPadding
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
topPadding
=
_behind_widget_visible_height
+
topSafeAreaPadding
;
final
shadow
=
final
_shadow
=
shadow
??
_default_box_shadow
;
BoxShadow
(
blurRadius:
10
,
color:
Colors
.
black12
,
spreadRadius:
5
);
final
_backgroundColor
=
backgroundColor
??
CupertinoTheme
.
of
(
context
).
scaffoldBackgroundColor
;
...
...
@@ -55,7 +59,7 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
borderRadius:
BorderRadius
.
vertical
(
top:
topRadius
),
child:
Container
(
decoration:
BoxDecoration
(
color:
_backgroundColor
,
boxShadow:
[
shadow
]),
BoxDecoration
(
color:
_backgroundColor
,
boxShadow:
[
_
shadow
]),
width:
double
.
infinity
,
child:
MediaQuery
.
removePadding
(
context:
context
,
...
...
@@ -89,6 +93,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
Duration
?
duration
,
RouteSettings
?
settings
,
Color
?
transitionBackgroundColor
,
BoxShadow
?
shadow
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
...
...
@@ -111,6 +116,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
child:
child
,
backgroundColor:
backgroundColor
,
topRadius:
topRadius
,
shadow:
shadow
,
),
secondAnimationController:
secondAnimation
,
expanded:
expand
,
...
...
@@ -135,8 +141,12 @@ Future<T?> showCupertinoModalBottomSheet<T>({
class
CupertinoModalBottomSheetRoute
<
T
>
extends
ModalBottomSheetRoute
<
T
>
{
final
Radius
topRadius
;
final
Curve
?
previousRouteAnimationCurve
;
final
BoxShadow
?
boxShadow
;
// Background color behind all routes
// Black by default
final
Color
?
transitionBackgroundColor
;
...
...
@@ -159,6 +169,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
Duration
?
duration
,
RouteSettings
?
settings
,
ScrollController
?
scrollController
,
this
.
boxShadow
=
_default_box_shadow
,
this
.
transitionBackgroundColor
,
this
.
topRadius
=
_default_top_radius
,
this
.
previousRouteAnimationCurve
,
...
...
@@ -226,6 +237,7 @@ class _CupertinoModalTransition extends StatelessWidget {
final
Radius
topRadius
;
final
Curve
?
animationCurve
;
final
Color
backgroundColor
;
final
BoxShadow
?
boxShadow
;
final
Widget
body
;
...
...
@@ -236,6 +248,7 @@ class _CupertinoModalTransition extends StatelessWidget {
required
this
.
topRadius
,
this
.
backgroundColor
=
Colors
.
black
,
this
.
animationCurve
,
this
.
boxShadow
,
})
:
super
(
key:
key
);
@override
...
...
@@ -340,6 +353,7 @@ class CupertinoScaffold extends StatefulWidget {
bool
enableDrag
=
true
,
Duration
?
duration
,
RouteSettings
?
settings
,
BoxShadow
?
shadow
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
...
...
@@ -363,7 +377,8 @@ class CupertinoScaffold extends StatefulWidget {
containerBuilder:
(
context
,
_
,
child
)
=>
_CupertinoBottomSheetContainer
(
child:
child
,
backgroundColor:
backgroundColor
,
topRadius:
_default_top_radius
,
topRadius:
topRadius
??
_default_top_radius
,
shadow:
shadow
,
),
expanded:
expand
,
barrierLabel:
barrierLabel
,
...
...
Please
register
or
login
to post a comment