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
d8bb880d
Commit
d8bb880d
authored
May 01, 2019
by
Diego Velásquez López
Committed by
Hans Muller
May 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added `scrimColor` property in Scaffold widget (#31025)
parent
7690bb47
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
1 deletion
+45
-1
AUTHORS
AUTHORS
+1
-0
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+8
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+8
-0
drawer_test.dart
packages/flutter/test/material/drawer_test.dart
+28
-0
No files found.
AUTHORS
View file @
d8bb880d
...
@@ -39,3 +39,4 @@ Marco Scannadinari <m@scannadinari.co.uk>
...
@@ -39,3 +39,4 @@ Marco Scannadinari <m@scannadinari.co.uk>
Frederik Schweiger <mail@flschweiger.net>
Frederik Schweiger <mail@flschweiger.net>
Martin Staadecker <machstg@gmail.com>
Martin Staadecker <machstg@gmail.com>
Igor Katsuba <katsuba.igor@gmail.com>
Igor Katsuba <katsuba.igor@gmail.com>
Diego Velásquez <diego.velasquez.lopez@gmail.com>
\ No newline at end of file
packages/flutter/lib/src/material/drawer.dart
View file @
d8bb880d
...
@@ -181,6 +181,7 @@ class DrawerController extends StatefulWidget {
...
@@ -181,6 +181,7 @@ class DrawerController extends StatefulWidget {
@required
this
.
alignment
,
@required
this
.
alignment
,
this
.
drawerCallback
,
this
.
drawerCallback
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
scrimColor
=
Colors
.
black54
,
})
:
assert
(
child
!=
null
),
})
:
assert
(
child
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(
alignment
!=
null
),
assert
(
alignment
!=
null
),
...
@@ -220,6 +221,11 @@ class DrawerController extends StatefulWidget {
...
@@ -220,6 +221,11 @@ class DrawerController extends StatefulWidget {
/// {@endtemplate}
/// {@endtemplate}
final
DragStartBehavior
dragStartBehavior
;
final
DragStartBehavior
dragStartBehavior
;
/// The color to use for the scrim that obscures primary content while a drawer is open.
///
/// By default, the color is [Colors.black54]
final
Color
scrimColor
;
@override
@override
DrawerControllerState
createState
()
=>
DrawerControllerState
();
DrawerControllerState
createState
()
=>
DrawerControllerState
();
}
}
...
@@ -231,6 +237,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -231,6 +237,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_color
=
ColorTween
(
begin:
Colors
.
transparent
,
end:
widget
.
scrimColor
);
_controller
=
AnimationController
(
duration:
_kBaseSettleDuration
,
vsync:
this
)
_controller
=
AnimationController
(
duration:
_kBaseSettleDuration
,
vsync:
this
)
..
addListener
(
_animationChanged
)
..
addListener
(
_animationChanged
)
..
addStatusListener
(
_animationStatusChanged
);
..
addStatusListener
(
_animationStatusChanged
);
...
@@ -379,7 +386,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
...
@@ -379,7 +386,7 @@ class DrawerControllerState extends State<DrawerController> with SingleTickerPro
widget
.
drawerCallback
(
false
);
widget
.
drawerCallback
(
false
);
}
}
final
ColorTween
_color
=
ColorTween
(
begin:
Colors
.
transparent
,
end:
Colors
.
black54
)
;
ColorTween
_color
;
final
GlobalKey
_gestureDetectorKey
=
GlobalKey
();
final
GlobalKey
_gestureDetectorKey
=
GlobalKey
();
AlignmentDirectional
get
_drawerOuterAlignment
{
AlignmentDirectional
get
_drawerOuterAlignment
{
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
d8bb880d
...
@@ -904,6 +904,7 @@ class Scaffold extends StatefulWidget {
...
@@ -904,6 +904,7 @@ class Scaffold extends StatefulWidget {
this
.
primary
=
true
,
this
.
primary
=
true
,
this
.
drawerDragStartBehavior
=
DragStartBehavior
.
start
,
this
.
drawerDragStartBehavior
=
DragStartBehavior
.
start
,
this
.
extendBody
=
false
,
this
.
extendBody
=
false
,
this
.
drawerScrimColor
=
Colors
.
black54
,
})
:
assert
(
primary
!=
null
),
})
:
assert
(
primary
!=
null
),
assert
(
extendBody
!=
null
),
assert
(
extendBody
!=
null
),
assert
(
drawerDragStartBehavior
!=
null
),
assert
(
drawerDragStartBehavior
!=
null
),
...
@@ -994,6 +995,11 @@ class Scaffold extends StatefulWidget {
...
@@ -994,6 +995,11 @@ class Scaffold extends StatefulWidget {
/// Typically a [Drawer].
/// Typically a [Drawer].
final
Widget
endDrawer
;
final
Widget
endDrawer
;
/// The color to use for the scrim that obscures primary content while a drawer is open.
///
/// By default, the color is [Colors.black54]
final
Color
drawerScrimColor
;
/// The color of the [Material] widget that underlies the entire Scaffold.
/// The color of the [Material] widget that underlies the entire Scaffold.
///
///
/// The theme's [ThemeData.scaffoldBackgroundColor] by default.
/// The theme's [ThemeData.scaffoldBackgroundColor] by default.
...
@@ -1906,6 +1912,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -1906,6 +1912,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
child:
widget
.
endDrawer
,
child:
widget
.
endDrawer
,
drawerCallback:
_endDrawerOpenedCallback
,
drawerCallback:
_endDrawerOpenedCallback
,
dragStartBehavior:
widget
.
drawerDragStartBehavior
,
dragStartBehavior:
widget
.
drawerDragStartBehavior
,
scrimColor:
widget
.
drawerScrimColor
,
),
),
_ScaffoldSlot
.
endDrawer
,
_ScaffoldSlot
.
endDrawer
,
// remove the side padding from the side we're not touching
// remove the side padding from the side we're not touching
...
@@ -1928,6 +1935,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -1928,6 +1935,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
child:
widget
.
drawer
,
child:
widget
.
drawer
,
drawerCallback:
_drawerOpenedCallback
,
drawerCallback:
_drawerOpenedCallback
,
dragStartBehavior:
widget
.
drawerDragStartBehavior
,
dragStartBehavior:
widget
.
drawerDragStartBehavior
,
scrimColor:
widget
.
drawerScrimColor
,
),
),
_ScaffoldSlot
.
drawer
,
_ScaffoldSlot
.
drawer
,
// remove the side padding from the side we're not touching
// remove the side padding from the side we're not touching
...
...
packages/flutter/test/material/drawer_test.dart
View file @
d8bb880d
...
@@ -106,4 +106,32 @@ void main() {
...
@@ -106,4 +106,32 @@ void main() {
semantics
.
dispose
();
semantics
.
dispose
();
});
});
testWidgets
(
'Drawer scrimDrawerColor test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
drawerScrimColor:
const
Color
(
0xFF323232
),
drawer:
Drawer
(),
),
),
);
final
ScaffoldState
state
=
tester
.
firstState
(
find
.
byType
(
Scaffold
));
state
.
openDrawer
();
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
final
Container
container
=
tester
.
widget
<
Container
>(
find
.
descendant
(
of:
find
.
byType
(
Scaffold
),
matching:
find
.
byType
(
Container
),
).
first
,
);
final
BoxDecoration
decoration
=
container
.
decoration
;
expect
(
decoration
.
color
,
const
Color
(
0xFF323232
));
expect
(
decoration
.
shape
,
BoxShape
.
rectangle
);
});
}
}
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