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
dde12499
Unverified
Commit
dde12499
authored
Jun 16, 2020
by
Ayush Bherwani
Committed by
GitHub
Jun 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MergeableMaterial] adds dividerColor property (#59481)
parent
b429ec1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
mergeable_material.dart
packages/flutter/lib/src/material/mergeable_material.dart
+8
-0
mergeable_material_test.dart
packages/flutter/test/material/mergeable_material_test.dart
+37
-0
No files found.
packages/flutter/lib/src/material/mergeable_material.dart
View file @
dde12499
...
...
@@ -107,6 +107,7 @@ class MergeableMaterial extends StatefulWidget {
this
.
elevation
=
2
,
this
.
hasDividers
=
false
,
this
.
children
=
const
<
MergeableMaterialItem
>[],
this
.
dividerColor
,
})
:
super
(
key:
key
);
/// The children of the [MergeableMaterial].
...
...
@@ -128,6 +129,12 @@ class MergeableMaterial extends StatefulWidget {
/// Whether connected pieces of [MaterialSlice] have dividers between them.
final
bool
hasDividers
;
/// Defines color used for dividers if [hasDividers] is true.
///
/// If `dividerColor` is null, then [DividerThemeData.color] is used. If that
/// is null, then [ThemeData.dividerColor] is used.
final
Color
dividerColor
;
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
...
...
@@ -562,6 +569,7 @@ class _MergeableMaterialState extends State<MergeableMaterial> with TickerProvid
final
BorderSide
divider
=
Divider
.
createBorderSide
(
context
,
width:
0.5
,
// TODO(ianh): This probably looks terrible when the dpr isn't a power of two.
color:
widget
.
dividerColor
,
);
if
(
i
==
0
)
{
...
...
packages/flutter/test/material/mergeable_material_test.dart
View file @
dde12499
...
...
@@ -1166,4 +1166,41 @@ void main() {
expect
(
isDivider
(
boxes
[
offset
+
3
],
false
,
true
),
isTrue
);
expect
(
isDivider
(
boxes
[
offset
+
4
],
true
,
false
),
isTrue
);
});
testWidgets
(
'MergeableMaterial respects dividerColor'
,
(
WidgetTester
tester
)
async
{
const
Color
dividerColor
=
Colors
.
red
;
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Scaffold
(
body:
SingleChildScrollView
(
child:
MergeableMaterial
(
hasDividers:
true
,
dividerColor:
dividerColor
,
children:
<
MergeableMaterialItem
>[
MaterialSlice
(
key:
ValueKey
<
String
>(
'A'
),
child:
SizedBox
(
width:
100.0
,
height:
100.0
,
),
),
MaterialSlice
(
key:
ValueKey
<
String
>(
'B'
),
child:
SizedBox
(
width:
100.0
,
height:
100.0
,
),
),
],
),
),
),
),
);
final
DecoratedBox
decoratedBox
=
tester
.
widget
(
find
.
byType
(
DecoratedBox
).
last
);
final
BoxDecoration
decoration
=
decoratedBox
.
decoration
as
BoxDecoration
;
// Since we are getting the last DecoratedBox, it will have a Border.top.
expect
(
decoration
.
border
.
top
.
color
,
dividerColor
);
});
}
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