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:26:04 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
623f819a2d96bf8777dcbd74cea72e8837cef573
623f819a
1 parent
f2fed8c4
Change constants name
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
623f819
...
...
@@ -19,15 +19,15 @@ import 'package:flutter/widgets.dart';
import
'../../modal_bottom_sheet.dart'
;
import
'../bottom_sheet_route.dart'
;
const
double
_
behind_widget_visible_heigh
t
=
10
;
const
double
_
kPreviousPageVisibleOffse
t
=
10
;
const
Radius
_default_top_radius
=
Radius
.
circular
(
12
);
const
BoxShadow
_default_box_shadow
=
BoxShadow
(
blurRadius:
10
,
color:
Colors
.
black12
,
spreadRadius:
5
);
const
Radius
_kDefaultTopRadius
=
Radius
.
circular
(
12
);
const
BoxShadow
_kDefaultBoxShadow
=
BoxShadow
(
blurRadius:
10
,
color:
Colors
.
black12
,
spreadRadius:
5
);
/// Cupertino Bottom Sheet Container
///
/// Clip the child widget to rectangle with top rounded corners and adds
/// top padding(+safe area padding). This padding [_
behind_widget_visible_heigh
t]
/// top padding(+safe area padding). This padding [_
kPreviousPageVisibleOffse
t]
/// is the height that will be displayed from previous route.
class
_CupertinoBottomSheetContainer
extends
StatelessWidget
{
final
Widget
child
;
...
...
@@ -47,9 +47,9 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
topSafeAreaPadding
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
topPadding
=
_
behind_widget_visible_heigh
t
+
topSafeAreaPadding
;
final
topPadding
=
_
kPreviousPageVisibleOffse
t
+
topSafeAreaPadding
;
final
_shadow
=
shadow
??
_
default_box_s
hadow
;
final
_shadow
=
shadow
??
_
kDefaultBoxS
hadow
;
BoxShadow
(
blurRadius:
10
,
color:
Colors
.
black12
,
spreadRadius:
5
);
final
_backgroundColor
=
backgroundColor
??
CupertinoTheme
.
of
(
context
).
scaffoldBackgroundColor
;
...
...
@@ -89,7 +89,7 @@ Future<T?> showCupertinoModalBottomSheet<T>({
bool
bounce
=
true
,
bool
?
isDismissible
,
bool
enableDrag
=
true
,
Radius
topRadius
=
_
default_top_r
adius
,
Radius
topRadius
=
_
kDefaultTopR
adius
,
Duration
?
duration
,
RouteSettings
?
settings
,
Color
?
transitionBackgroundColor
,
...
...
@@ -169,9 +169,9 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
Duration
?
duration
,
RouteSettings
?
settings
,
ScrollController
?
scrollController
,
this
.
boxShadow
=
_
default_box_s
hadow
,
this
.
boxShadow
=
_
kDefaultBoxS
hadow
,
this
.
transitionBackgroundColor
,
this
.
topRadius
=
_
default_top_r
adius
,
this
.
topRadius
=
_
kDefaultTopR
adius
,
this
.
previousRouteAnimationCurve
,
})
:
assert
(
expanded
!=
null
),
assert
(
isDismissible
!=
null
),
...
...
@@ -202,7 +202,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
)
{
final
paddingTop
=
MediaQuery
.
of
(
context
).
padding
.
top
;
final
distanceWithScale
=
(
paddingTop
+
_
behind_widget_visible_heigh
t
)
*
0.9
;
(
paddingTop
+
_
kPreviousPageVisibleOffse
t
)
*
0.9
;
final
offsetY
=
secondaryAnimation
.
value
*
(
paddingTop
-
distanceWithScale
);
final
scale
=
1
-
secondaryAnimation
.
value
/
10
;
return
AnimatedBuilder
(
...
...
@@ -331,7 +331,7 @@ class CupertinoScaffold extends StatefulWidget {
const
CupertinoScaffold
({
Key
?
key
,
required
this
.
body
,
this
.
topRadius
=
_
default_top_r
adius
,
this
.
topRadius
=
_
kDefaultTopR
adius
,
this
.
transitionBackgroundColor
=
Colors
.
black
,
})
:
super
(
key:
key
);
...
...
@@ -377,7 +377,7 @@ class CupertinoScaffold extends StatefulWidget {
containerBuilder:
(
context
,
_
,
child
)
=>
_CupertinoBottomSheetContainer
(
child:
child
,
backgroundColor:
backgroundColor
,
topRadius:
topRadius
??
_
default_top_r
adius
,
topRadius:
topRadius
??
_
kDefaultTopR
adius
,
shadow:
shadow
,
),
expanded:
expand
,
...
...
@@ -386,7 +386,7 @@ class CupertinoScaffold extends StatefulWidget {
isDismissible:
isDismissible
??
expand
==
false
?
true
:
false
,
modalBarrierColor:
barrierColor
??
Colors
.
black12
,
enableDrag:
enableDrag
,
topRadius:
topRadius
??
_
default_top_r
adius
,
topRadius:
topRadius
??
_
kDefaultTopR
adius
,
animationCurve:
animationCurve
,
previousRouteAnimationCurve:
previousRouteAnimationCurve
,
duration:
duration
,
...
...
Please
register
or
login
to post a comment