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
a63ed4e3
Unverified
Commit
a63ed4e3
authored
Oct 31, 2018
by
jslavitz
Committed by
GitHub
Oct 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scaffold drawer fix (#23689)
* Adds drawer state query functions
parent
8de86d41
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
1 deletion
+69
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+16
-0
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+53
-1
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
a63ed4e3
...
...
@@ -1045,6 +1045,22 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
bool
_drawerOpened
=
false
;
bool
_endDrawerOpened
=
false
;
/// Whether the [Scaffold.drawer] is opened.
///
/// See also:
///
/// * [ScaffoldState.openDrawer], which opens the [Scaffold.drawer] of a
/// [Scaffold].
bool
get
isDrawerOpen
=>
_drawerOpened
;
/// Whether the [Scaffold.endDrawer] is opened.
///
/// See also:
///
/// * [ScaffoldState.openEndDrawer], which opens the [Scaffold.endDrawer] of
/// a [Scaffold].
bool
get
isEndDrawerOpen
=>
_endDrawerOpened
;
void
_drawerOpenedCallback
(
bool
isOpened
)
{
setState
(()
{
_drawerOpened
=
isOpened
;
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
a63ed4e3
...
...
@@ -998,8 +998,60 @@ void main() {
semantics
.
dispose
();
});
testWidgets
(
'Dual Drawer Opening'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Drawer state query correctly'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
SafeArea
(
left:
false
,
top:
true
,
right:
false
,
bottom:
false
,
child:
Scaffold
(
endDrawer:
const
Drawer
(
child:
Text
(
'endDrawer'
),
),
drawer:
const
Drawer
(
child:
Text
(
'drawer'
),
),
body:
const
Text
(
'scaffold body'
),
appBar:
AppBar
(
centerTitle:
true
,
title:
const
Text
(
'Title'
)
),
),
),
),
);
final
ScaffoldState
scaffoldState
=
tester
.
state
(
find
.
byType
(
Scaffold
));
final
Finder
drawerOpenButton
=
find
.
byType
(
IconButton
).
first
;
final
Finder
endDrawerOpenButton
=
find
.
byType
(
IconButton
).
last
;
await
tester
.
tap
(
drawerOpenButton
);
await
tester
.
pumpAndSettle
();
expect
(
true
,
scaffoldState
.
isDrawerOpen
);
await
tester
.
tap
(
endDrawerOpenButton
);
await
tester
.
pumpAndSettle
();
expect
(
false
,
scaffoldState
.
isDrawerOpen
);
await
tester
.
tap
(
endDrawerOpenButton
);
await
tester
.
pumpAndSettle
();
expect
(
true
,
scaffoldState
.
isEndDrawerOpen
);
await
tester
.
tap
(
drawerOpenButton
);
await
tester
.
pumpAndSettle
();
expect
(
false
,
scaffoldState
.
isEndDrawerOpen
);
scaffoldState
.
openDrawer
();
expect
(
true
,
scaffoldState
.
isDrawerOpen
);
await
tester
.
tap
(
drawerOpenButton
);
await
tester
.
pumpAndSettle
();
scaffoldState
.
openEndDrawer
();
expect
(
true
,
scaffoldState
.
isEndDrawerOpen
);
});
testWidgets
(
'Dual Drawer Opening'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
SafeArea
(
...
...
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