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
v7lin
2021-12-16 15:19:26 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2dda5ea28553242abb0e3e50279cf96e4b9d5ba1
2dda5ea2
1 parent
b7538fad
fix: android edge to edge
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
8 deletions
example/lib/modals/circular_modal.dart
lib/src/bottom_sheets/bar_bottom_sheet.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
example/lib/modals/circular_modal.dart
View file @
2dda5ea
...
...
@@ -7,14 +7,15 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
class
AvatarBottomSheet
extends
StatelessWidget
{
final
Widget
child
;
final
Animation
<
double
>
animation
;
final
SystemUiOverlayStyle
?
overlayStyle
;
const
AvatarBottomSheet
({
Key
?
key
,
required
this
.
child
,
required
this
.
animation
})
const
AvatarBottomSheet
({
Key
?
key
,
required
this
.
child
,
required
this
.
animation
,
this
.
overlayStyle
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
AnnotatedRegion
<
SystemUiOverlayStyle
>(
value:
SystemUiOverlayStyle
.
light
,
value:
overlayStyle
??
SystemUiOverlayStyle
.
light
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
@@ -81,6 +82,7 @@ Future<T?> showAvatarModalBottomSheet<T>({
bool
isDismissible
=
true
,
bool
enableDrag
=
true
,
Duration
?
duration
,
SystemUiOverlayStyle
?
overlayStyle
,
})
async
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
...
...
@@ -90,6 +92,7 @@ Future<T?> showAvatarModalBottomSheet<T>({
containerBuilder:
(
_
,
animation
,
child
)
=>
AvatarBottomSheet
(
child:
child
,
animation:
animation
,
overlayStyle:
overlayStyle
,
),
bounce:
bounce
,
secondAnimationController:
secondAnimation
,
...
...
lib/src/bottom_sheets/bar_bottom_sheet.dart
View file @
2dda5ea
...
...
@@ -14,6 +14,7 @@ class BarBottomSheet extends StatelessWidget {
final
Clip
?
clipBehavior
;
final
double
?
elevation
;
final
ShapeBorder
?
shape
;
final
SystemUiOverlayStyle
?
overlayStyle
;
const
BarBottomSheet
({
Key
?
key
,
...
...
@@ -22,12 +23,13 @@ class BarBottomSheet extends StatelessWidget {
this
.
clipBehavior
,
this
.
shape
,
this
.
elevation
,
this
.
overlayStyle
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
AnnotatedRegion
<
SystemUiOverlayStyle
>(
value:
SystemUiOverlayStyle
.
light
,
value:
overlayStyle
??
SystemUiOverlayStyle
.
light
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -88,6 +90,7 @@ Future<T?> showBarModalBottomSheet<T>({
bool
enableDrag
=
true
,
Widget
?
topControl
,
Duration
?
duration
,
SystemUiOverlayStyle
?
overlayStyle
,
})
async
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
...
...
@@ -102,6 +105,7 @@ Future<T?> showBarModalBottomSheet<T>({
clipBehavior:
clipBehavior
,
shape:
shape
,
elevation:
elevation
,
overlayStyle:
overlayStyle
,
),
secondAnimationController:
secondAnimation
,
expanded:
expand
,
...
...
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
2dda5ea
...
...
@@ -91,6 +91,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
RouteSettings
?
settings
,
Color
?
transitionBackgroundColor
,
BoxShadow
?
shadow
,
SystemUiOverlayStyle
?
overlayStyle
,
})
async
{
assert
(
debugCheckHasMediaQuery
(
context
));
final
hasMaterialLocalizations
=
...
...
@@ -126,7 +127,8 @@ Future<T?> showCupertinoModalBottomSheet<T>({
previousRouteAnimationCurve:
previousRouteAnimationCurve
,
duration:
duration
,
settings:
settings
,
transitionBackgroundColor:
transitionBackgroundColor
??
Colors
.
black
),
transitionBackgroundColor:
transitionBackgroundColor
??
Colors
.
black
,
overlayStyle:
overlayStyle
),
);
return
result
;
}
...
...
@@ -142,6 +144,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
// Background color behind all routes
// Black by default
final
Color
?
transitionBackgroundColor
;
final
SystemUiOverlayStyle
?
overlayStyle
;
CupertinoModalBottomSheetRoute
({
required
WidgetBuilder
builder
,
...
...
@@ -165,6 +168,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
this
.
transitionBackgroundColor
,
this
.
topRadius
=
_kDefaultTopRadius
,
this
.
previousRouteAnimationCurve
,
this
.
overlayStyle
,
})
:
super
(
closeProgressThreshold:
closeProgressThreshold
,
scrollController:
scrollController
,
...
...
@@ -217,6 +221,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
animationCurve:
previousRouteAnimationCurve
,
topRadius:
topRadius
,
backgroundColor:
transitionBackgroundColor
??
Colors
.
black
,
overlayStyle:
overlayStyle
,
);
}
}
...
...
@@ -227,6 +232,7 @@ class _CupertinoModalTransition extends StatelessWidget {
final
Curve
?
animationCurve
;
final
Color
backgroundColor
;
final
BoxShadow
?
boxShadow
;
final
SystemUiOverlayStyle
?
overlayStyle
;
final
Widget
body
;
...
...
@@ -238,6 +244,7 @@ class _CupertinoModalTransition extends StatelessWidget {
this
.
backgroundColor
=
Colors
.
black
,
this
.
animationCurve
,
this
.
boxShadow
,
this
.
overlayStyle
,
})
:
super
(
key:
key
);
@override
...
...
@@ -255,10 +262,7 @@ class _CupertinoModalTransition extends StatelessWidget {
);
return
AnnotatedRegion
<
SystemUiOverlayStyle
>(
value:
SystemUiOverlayStyle
(
statusBarIconBrightness:
Brightness
.
light
,
statusBarBrightness:
Brightness
.
dark
,
),
value:
overlayStyle
??
SystemUiOverlayStyle
.
light
,
child:
AnimatedBuilder
(
animation:
curvedAnimation
,
child:
body
,
...
...
@@ -319,12 +323,14 @@ class CupertinoScaffold extends StatefulWidget {
final
Widget
body
;
final
Radius
topRadius
;
final
Color
transitionBackgroundColor
;
final
SystemUiOverlayStyle
?
overlayStyle
;
const
CupertinoScaffold
({
Key
?
key
,
required
this
.
body
,
this
.
topRadius
=
_kDefaultTopRadius
,
this
.
transitionBackgroundColor
=
Colors
.
black
,
this
.
overlayStyle
,
})
:
super
(
key:
key
);
@override
...
...
@@ -346,6 +352,7 @@ class CupertinoScaffold extends StatefulWidget {
Duration
?
duration
,
RouteSettings
?
settings
,
BoxShadow
?
shadow
,
SystemUiOverlayStyle
?
overlayStyle
,
})
async
{
assert
(
debugCheckHasMediaQuery
(
context
));
final
isCupertinoApp
=
...
...
@@ -378,6 +385,7 @@ class CupertinoScaffold extends StatefulWidget {
previousRouteAnimationCurve:
previousRouteAnimationCurve
,
duration:
duration
,
settings:
settings
,
overlayStyle:
overlayStyle
,
));
return
result
;
}
...
...
@@ -409,6 +417,7 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold>
body:
widget
.
body
,
topRadius:
widget
.
topRadius
,
backgroundColor:
widget
.
transitionBackgroundColor
,
overlayStyle:
widget
.
overlayStyle
,
),
);
}
...
...
Please
register
or
login
to post a comment