Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
6a48e663
Unverified
Commit
6a48e663
authored
Apr 26, 2019
by
Dan Field
Committed by
GitHub
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bottom sheet scrolling (#21896)
parent
fdcc8aaf
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1024 additions
and
151 deletions
+1024
-151
bottom_sheet.dart
packages/flutter/lib/src/material/bottom_sheet.dart
+107
-38
debug.dart
packages/flutter/lib/src/material/debug.dart
+34
-0
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+330
-95
draggable_scrollable_sheet.dart
...s/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
+228
-14
modal_bottom_sheet_test.dart
packages/flutter/test/material/modal_bottom_sheet_test.dart
+64
-1
persistent_bottom_sheet_test.dart
...s/flutter/test/material/persistent_bottom_sheet_test.dart
+261
-2
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+0
-1
No files found.
packages/flutter/lib/src/material/bottom_sheet.dart
View file @
6a48e663
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/material/debug.dart
View file @
6a48e663
...
...
@@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
import
'material.dart'
;
import
'material_localizations.dart'
;
import
'scaffold.dart'
show
Scaffold
;
/// Asserts that the given context has a [Material] ancestor.
///
...
...
@@ -127,3 +128,36 @@ bool debugCheckHasMaterialLocalizations(BuildContext context) {
}());
return
true
;
}
/// Asserts that the given context has a [Scaffold] ancestor.
///
/// Used by various widgets to make sure that they are only used in an
/// appropriate context.
///
/// To invoke this function, use the following pattern, typically in the
/// relevant Widget's build method:
///
/// ```dart
/// assert(debugCheckHasScaffold(context));
/// ```
///
/// Does nothing if asserts are disabled. Always returns true.
bool
debugCheckHasScaffold
(
BuildContext
context
)
{
assert
(()
{
if
(
context
.
widget
is
!
Scaffold
&&
context
.
ancestorWidgetOfExactType
(
Scaffold
)
==
null
)
{
final
Element
element
=
context
;
throw
FlutterError
(
'No Scaffold widget found.
\n
'
'
${context.widget.runtimeType}
widgets require a Scaffold widget ancestor.
\n
'
'The Specific widget that could not find a Scaffold ancestor was:
\n
'
'
${context.widget}
\n
'
'The ownership chain for the affected widget is:
\n
'
'
${element.debugGetCreatorChain(10)}
\n
'
'Typically, the Scaffold widget is introduced by the MaterialApp or '
'WidgetsApp widget at the top of your application widget tree.'
);
}
return
true
;
}());
return
true
;
}
packages/flutter/lib/src/material/scaffold.dart
View file @
6a48e663
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/draggable_scrollable_sheet.dart
View file @
6a48e663
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/modal_bottom_sheet_test.dart
View file @
6a48e663
...
...
@@ -38,7 +38,7 @@ void main() {
expect
(
find
.
text
(
'BottomSheet'
),
findsOneWidget
);
expect
(
showBottomSheetThenCalled
,
isFalse
);
// Tap on the bottom sheet itself to dismiss it
// Tap on the bottom sheet itself to dismiss it
.
await
tester
.
tap
(
find
.
text
(
'BottomSheet'
));
await
tester
.
pump
();
// bottom sheet dismiss animation starts
expect
(
showBottomSheetThenCalled
,
isTrue
);
...
...
@@ -169,6 +169,7 @@ void main() {
child:
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
all
(
50.0
),
size:
Size
(
400.0
,
600.0
),
),
child:
Navigator
(
onGenerateRoute:
(
_
)
{
...
...
@@ -249,4 +250,66 @@ void main() {
),
ignoreTransform:
true
,
ignoreRect:
true
,
ignoreId:
true
));
semantics
.
dispose
();
});
testWidgets
(
'modal BottomSheet with scrollController has semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
GlobalKey
<
ScaffoldState
>
scaffoldKey
=
GlobalKey
<
ScaffoldState
>();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
key:
scaffoldKey
,
body:
const
Center
(
child:
Text
(
'body'
))
)
));
showModalBottomSheet
<
void
>(
context:
scaffoldKey
.
currentContext
,
builder:
(
BuildContext
context
)
{
return
DraggableScrollableSheet
(
expand:
false
,
builder:
(
_
,
ScrollController
controller
)
{
return
SingleChildScrollView
(
controller:
controller
,
child:
Container
(
child:
const
Text
(
'BottomSheet'
),
),
);
},
);
},
);
await
tester
.
pump
();
// bottom sheet show animation starts
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
// animation done
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
.
rootChild
(
children:
<
TestSemantics
>[
TestSemantics
(
label:
'Dialog'
,
textDirection:
TextDirection
.
ltr
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
,
SemanticsFlag
.
namesRoute
,
],
children:
<
TestSemantics
>[
TestSemantics
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
hasImplicitScrolling
],
children:
<
TestSemantics
>[
TestSemantics
(
label:
'BottomSheet'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
),
],
),
ignoreTransform:
true
,
ignoreRect:
true
,
ignoreId:
true
));
semantics
.
dispose
();
});
}
packages/flutter/test/material/persistent_bottom_sheet_test.dart
View file @
6a48e663
This diff is collapsed.
Click to expand it.
packages/flutter/test/material/scaffold_test.dart
View file @
6a48e663
...
...
@@ -335,7 +335,6 @@ void main() {
),
),
);
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pump
();
// start animation
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment