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
tb2761
2020-04-10 17:42:12 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
30373acbd747dad055b37c9b79b1befa9a064568
30373acb
1 parent
c5f1d1e1
fix: assertion of missing MaterialLocalizations when using CupertinoApp
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
10 deletions
lib/src/bottom_sheet_route.dart
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
lib/src/bottom_sheet_route.dart
View file @
30373ac
...
...
@@ -32,18 +32,23 @@ class _ModalBottomSheet<T> extends StatefulWidget {
}
class
_ModalBottomSheetState
<
T
>
extends
State
<
_ModalBottomSheet
<
T
>>
{
String
_getRouteLabel
(
MaterialLocalizations
localizations
)
{
String
_getRouteLabel
()
{
if
(
Theme
.
of
(
context
,
shadowThemeOnly:
true
)
==
null
)
{
return
''
;
}
else
{
final
platform
=
Theme
.
of
(
context
).
platform
;
switch
(
platform
)
{
case
TargetPlatform
.
iOS
:
return
''
;
case
TargetPlatform
.
android
:
case
TargetPlatform
.
fuchsia
:
return
localizations
.
dialogLabel
;
assert
(
debugCheckHasMaterialLocalizations
(
context
));
return
MaterialLocalizations
.
of
(
context
).
dialogLabel
;
break
;
}
return
null
;
}
}
@override
void
initState
()
{
...
...
@@ -64,9 +69,6 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMaterialLocalizations
(
context
));
final
localizations
=
MaterialLocalizations
.
of
(
context
);
final
routeLabel
=
_getRouteLabel
(
localizations
);
return
AnimatedBuilder
(
animation:
widget
.
route
.
_animationController
,
...
...
@@ -76,7 +78,7 @@ class _ModalBottomSheetState<T> extends State<_ModalBottomSheet<T>> {
return
Semantics
(
scopesRoute:
true
,
namesRoute:
true
,
label:
routeLabel
,
label:
_getRouteLabel
()
,
explicitChildNodes:
true
,
child:
ModalBottomSheet
(
expanded:
widget
.
route
.
expanded
,
...
...
lib/src/bottom_sheets/cupertino_bottom_sheet.dart
View file @
30373ac
...
...
@@ -4,10 +4,15 @@
import
'dart:async'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/cupertino.dart'
show
CupertinoTheme
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
show
Colors
,
Theme
,
MaterialLocalizations
,
debugCheckHasMaterialLocalizations
;
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
@@ -78,7 +83,13 @@ Future<T> showCupertinoModalBottomSheet<T>({
assert
(
useRootNavigator
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
final
isCupertinoApp
=
Theme
.
of
(
context
,
shadowThemeOnly:
true
)
==
null
;
String
barrierLabel
=
''
;
if
(!
isCupertinoApp
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
barrierLabel
=
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
;
}
final
result
=
await
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)
.
push
(
CupertinoModalBottomSheetRoute
<
T
>(
builder:
builder
,
...
...
@@ -88,7 +99,7 @@ Future<T> showCupertinoModalBottomSheet<T>({
),
secondAnimationController:
secondAnimation
,
expanded:
expand
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismiss
Label
,
barrierLabel:
barrier
Label
,
elevation:
elevation
,
bounce:
bounce
,
shape:
shape
,
...
...
@@ -264,7 +275,13 @@ class CupertinoScaffold extends StatefulWidget {
assert
(
useRootNavigator
!=
null
);
assert
(
enableDrag
!=
null
);
assert
(
debugCheckHasMediaQuery
(
context
));
assert
(
debugCheckHasMediaQuery
(
context
));
final
isCupertinoApp
=
Theme
.
of
(
context
,
shadowThemeOnly:
true
)
==
null
;
String
barrierLabel
=
''
;
if
(!
isCupertinoApp
)
{
assert
(
debugCheckHasMaterialLocalizations
(
context
));
barrierLabel
=
MaterialLocalizations
.
of
(
context
).
modalBarrierDismissLabel
;
}
final
result
=
await
Navigator
.
of
(
context
,
rootNavigator:
useRootNavigator
)
.
push
(
CupertinoModalBottomSheetRoute
<
T
>(
builder:
builder
,
...
...
@@ -274,7 +291,7 @@ class CupertinoScaffold extends StatefulWidget {
backgroundColor:
backgroundColor
,
),
expanded:
expand
,
barrierLabel:
MaterialLocalizations
.
of
(
context
).
modalBarrierDismiss
Label
,
barrierLabel:
barrier
Label
,
bounce:
bounce
,
isDismissible:
isDismissible
??
expand
==
false
?
true
:
false
,
modalBarrierColor:
barrierColor
??
Colors
.
black12
,
...
...
Please
register
or
login
to post a comment