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 14:48:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b7538fad90a9b651057aee35f1bca8fb5d3fdb26
b7538fad
1 parent
ab1dc56e
1. fix: android edge to edge
2. clean: dart analysis
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
12 additions
and
78 deletions
example/lib/modals/circular_modal.dart
example/lib/modals/floating_modal.dart
example/lib/modals/modal_fit.dart
example/lib/modals/modal_with_nested_scroll.dart
example/lib/web_frame.dart
lib/src/bottom_sheet.dart
lib/src/bottom_sheet_route.dart
lib/src/bottom_sheets/bar_bottom_sheet.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
lib/src/bottom_sheets/material_bottom_sheet.dart
lib/src/material_with_modal_page_route.dart
lib/src/utils/bottom_sheet_suspended_curve.dart
lib/src/utils/modal_scroll_controller.dart
lib/src/utils/scroll_to_top_status_bar.dart
example/lib/modals/circular_modal.dart
View file @
b7538fa
...
...
@@ -2,7 +2,6 @@ import 'dart:math';
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:modal_bottom_sheet/modal_bottom_sheet.dart'
;
class
AvatarBottomSheet
extends
StatelessWidget
{
...
...
@@ -83,12 +82,6 @@ Future<T?> showAvatarModalBottomSheet<T>({
bool
enableDrag
=
true
,
Duration
?
duration
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
isDismissible
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
result
=
await
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)
...
...
example/lib/modals/floating_modal.dart
View file @
b7538fa
import
'package:flutter/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:modal_bottom_sheet/modal_bottom_sheet.dart'
;
class
FloatingModal
extends
StatelessWidget
{
...
...
example/lib/modals/modal_fit.dart
View file @
b7538fa
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
class
ModalFit
extends
StatelessWidget
{
...
...
example/lib/modals/modal_with_nested_scroll.dart
View file @
b7538fa
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:modal_bottom_sheet/modal_bottom_sheet.dart'
;
...
...
example/lib/web_frame.dart
View file @
b7538fa
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
class
WebFrame
extends
StatelessWidget
{
...
...
lib/src/bottom_sheet.dart
View file @
b7538fa
...
...
@@ -3,12 +3,8 @@
// found in the LICENSE file.
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/scheduler.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:modal_bottom_sheet/src/utils/scroll_to_top_status_bar.dart'
;
import
'package:modal_bottom_sheet/src/utils/bottom_sheet_suspended_curve.dart'
;
...
...
@@ -49,10 +45,7 @@ class ModalBottomSheet extends StatefulWidget {
required
this
.
expanded
,
required
this
.
onClosing
,
required
this
.
child
,
})
:
assert
(
enableDrag
!=
null
),
assert
(
onClosing
!=
null
),
assert
(
child
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
/// The closeProgressThreshold parameter
/// specifies when the bottom sheet will be dismissed when user drags it.
...
...
lib/src/bottom_sheet_route.dart
View file @
b7538fa
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:modal_bottom_sheet/src/utils/modal_scroll_controller.dart'
;
import
'../modal_bottom_sheet.dart'
;
...
...
@@ -19,9 +16,7 @@ class _ModalBottomSheet<T> extends StatefulWidget {
this
.
expanded
=
false
,
this
.
enableDrag
=
true
,
this
.
animationCurve
,
})
:
assert
(
expanded
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
key:
key
);
})
:
super
(
key:
key
);
final
double
?
closeProgressThreshold
;
final
ModalBottomSheetRoute
<
T
>
route
;
...
...
@@ -143,10 +138,7 @@ class ModalBottomSheetRoute<T> extends PopupRoute<T> {
this
.
animationCurve
,
this
.
duration
,
RouteSettings
?
settings
,
})
:
assert
(
expanded
!=
null
),
assert
(
isDismissible
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
settings:
settings
);
})
:
super
(
settings:
settings
);
final
double
?
closeProgressThreshold
;
final
WidgetWithChildBuilder
?
containerBuilder
;
...
...
@@ -246,13 +238,6 @@ Future<T?> showCustomModalBottomSheet<T>({
bool
enableDrag
=
true
,
Duration
?
duration
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
containerWidget
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
isDismissible
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
hasMaterialLocalizations
=
...
...
lib/src/bottom_sheets/bar_bottom_sheet.dart
View file @
b7538fa
...
...
@@ -89,12 +89,6 @@ Future<T?> showBarModalBottomSheet<T>({
Widget
?
topControl
,
Duration
?
duration
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
isDismissible
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
result
=
await
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)
...
...
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
b7538fa
...
...
@@ -5,8 +5,6 @@
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
show
CupertinoTheme
,
CupertinoApp
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
show
Colors
,
...
...
@@ -17,7 +15,6 @@ import 'package:flutter/services.dart';
import
'package:flutter/widgets.dart'
;
import
'../../modal_bottom_sheet.dart'
;
import
'../bottom_sheet_route.dart'
;
const
double
_kPreviousPageVisibleOffset
=
10
;
...
...
@@ -95,11 +92,6 @@ Future<T?> showCupertinoModalBottomSheet<T>({
Color
?
transitionBackgroundColor
,
BoxShadow
?
shadow
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
final
hasMaterialLocalizations
=
Localizations
.
of
<
MaterialLocalizations
>(
context
,
MaterialLocalizations
)
!=
...
...
@@ -173,10 +165,7 @@ class CupertinoModalBottomSheetRoute<T> extends ModalBottomSheetRoute<T> {
this
.
transitionBackgroundColor
,
this
.
topRadius
=
_kDefaultTopRadius
,
this
.
previousRouteAnimationCurve
,
})
:
assert
(
expanded
!=
null
),
assert
(
isDismissible
!=
null
),
assert
(
enableDrag
!=
null
),
super
(
})
:
super
(
closeProgressThreshold:
closeProgressThreshold
,
scrollController:
scrollController
,
containerBuilder:
containerBuilder
,
...
...
@@ -266,7 +255,10 @@ class _CupertinoModalTransition extends StatelessWidget {
);
return
AnnotatedRegion
<
SystemUiOverlayStyle
>(
value:
SystemUiOverlayStyle
.
light
,
value:
SystemUiOverlayStyle
(
statusBarIconBrightness:
Brightness
.
light
,
statusBarBrightness:
Brightness
.
dark
,
),
child:
AnimatedBuilder
(
animation:
curvedAnimation
,
child:
body
,
...
...
@@ -355,11 +347,6 @@ class CupertinoScaffold extends StatefulWidget {
RouteSettings
?
settings
,
BoxShadow
?
shadow
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
final
isCupertinoApp
=
context
.
findAncestorWidgetOfExactType
<
CupertinoApp
>()
!=
null
;
...
...
@@ -400,8 +387,6 @@ class _CupertinoScaffoldState extends State<CupertinoScaffold>
with
TickerProviderStateMixin
{
late
AnimationController
animationController
;
SystemUiOverlayStyle
?
lastStyle
;
@override
void
initState
()
{
animationController
=
...
...
lib/src/bottom_sheets/material_bottom_sheet.dart
View file @
b7538fa
...
...
@@ -21,12 +21,6 @@ Future<T?> showMaterialModalBottomSheet<T>({
bool
enableDrag
=
true
,
Duration
?
duration
,
})
async
{
assert
(
context
!=
null
);
assert
(
builder
!=
null
);
assert
(
expand
!=
null
);
assert
(
useRootNavigator
!=
null
);
assert
(
isDismissible
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
result
=
await
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)
...
...
lib/src/material_with_modal_page_route.dart
View file @
b7538fa
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'../modal_bottom_sheet.dart'
;
...
...
@@ -15,10 +14,7 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> {
RouteSettings
?
settings
,
bool
maintainState
=
true
,
bool
fullscreenDialog
=
false
,
})
:
assert
(
builder
!=
null
),
assert
(
maintainState
!=
null
),
assert
(
fullscreenDialog
!=
null
),
super
(
})
:
super
(
settings:
settings
,
fullscreenDialog:
fullscreenDialog
,
builder:
builder
,
...
...
lib/src/utils/bottom_sheet_suspended_curve.dart
View file @
b7538fa
...
...
@@ -30,8 +30,7 @@ class BottomSheetSuspendedCurve extends Curve {
const
BottomSheetSuspendedCurve
(
this
.
startingPoint
,
{
this
.
curve
=
Curves
.
easeOutCubic
,
})
:
assert
(
startingPoint
!=
null
),
assert
(
curve
!=
null
);
});
/// The progress value at which [curve] should begin.
///
...
...
lib/src/utils/modal_scroll_controller.dart
View file @
b7538fa
...
...
@@ -16,8 +16,7 @@ class ModalScrollController extends InheritedWidget {
Key
?
key
,
required
this
.
controller
,
required
Widget
child
,
})
:
assert
(
controller
!=
null
),
super
(
})
:
super
(
key:
key
,
child:
PrimaryScrollController
(
controller:
controller
,
...
...
lib/src/utils/scroll_to_top_status_bar.dart
View file @
b7538fa
...
...
@@ -50,7 +50,7 @@ class _ScrollToTopStatusBarState extends State<ScrollToTopStatusBarHandler> {
void
_handleStatusBarTap
(
BuildContext
context
)
{
final
controller
=
widget
.
scrollController
;
if
(
controller
!=
null
&&
controller
.
hasClients
)
{
if
(
controller
.
hasClients
)
{
controller
.
animateTo
(
0.0
,
duration:
const
Duration
(
milliseconds:
300
),
...
...
Please
register
or
login
to post a comment