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
ff85d97a
Unverified
Commit
ff85d97a
authored
Oct 15, 2020
by
Pedro Massango
Committed by
GitHub
Oct 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose the tileColor property (#67135)
parent
ed2a4809
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
0 deletions
+53
-0
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+5
-0
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+2
-0
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+6
-0
checkbox_list_tile_test.dart
packages/flutter/test/material/checkbox_list_tile_test.dart
+20
-0
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+20
-0
No files found.
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
ff85d97a
...
@@ -262,6 +262,7 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -262,6 +262,7 @@ class CheckboxListTile extends StatelessWidget {
required
this
.
onChanged
,
required
this
.
onChanged
,
this
.
activeColor
,
this
.
activeColor
,
this
.
checkColor
,
this
.
checkColor
,
this
.
tileColor
,
this
.
title
,
this
.
title
,
this
.
subtitle
,
this
.
subtitle
,
this
.
isThreeLine
=
false
,
this
.
isThreeLine
=
false
,
...
@@ -320,6 +321,9 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -320,6 +321,9 @@ class CheckboxListTile extends StatelessWidget {
/// Defaults to Color(0xFFFFFFFF).
/// Defaults to Color(0xFFFFFFFF).
final
Color
?
checkColor
;
final
Color
?
checkColor
;
/// {@macro flutter.material.ListTile.tileColor}
final
Color
?
tileColor
;
/// The primary content of the list tile.
/// The primary content of the list tile.
///
///
/// Typically a [Text] widget.
/// Typically a [Text] widget.
...
@@ -438,6 +442,7 @@ class CheckboxListTile extends StatelessWidget {
...
@@ -438,6 +442,7 @@ class CheckboxListTile extends StatelessWidget {
autofocus:
autofocus
,
autofocus:
autofocus
,
contentPadding:
contentPadding
,
contentPadding:
contentPadding
,
shape:
shape
,
shape:
shape
,
tileColor:
tileColor
,
),
),
),
),
);
);
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
ff85d97a
...
@@ -888,10 +888,12 @@ class ListTile extends StatelessWidget {
...
@@ -888,10 +888,12 @@ class ListTile extends StatelessWidget {
/// {@macro flutter.widgets.Focus.autofocus}
/// {@macro flutter.widgets.Focus.autofocus}
final
bool
autofocus
;
final
bool
autofocus
;
/// {@template flutter.material.ListTile.tileColor}
/// Defines the background color of `ListTile` when [selected] is false.
/// Defines the background color of `ListTile` when [selected] is false.
///
///
/// When the value is null, the `tileColor` is set to [ListTileTheme.tileColor]
/// When the value is null, the `tileColor` is set to [ListTileTheme.tileColor]
/// if it's not null and to [Colors.transparent] if it's null.
/// if it's not null and to [Colors.transparent] if it's null.
/// {@endtemplate}
final
Color
?
tileColor
;
final
Color
?
tileColor
;
/// Defines the background color of `ListTile` when [selected] is true.
/// Defines the background color of `ListTile` when [selected] is true.
...
...
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
ff85d97a
...
@@ -258,6 +258,7 @@ class SwitchListTile extends StatelessWidget {
...
@@ -258,6 +258,7 @@ class SwitchListTile extends StatelessWidget {
Key
?
key
,
Key
?
key
,
required
this
.
value
,
required
this
.
value
,
required
this
.
onChanged
,
required
this
.
onChanged
,
this
.
tileColor
,
this
.
activeColor
,
this
.
activeColor
,
this
.
activeTrackColor
,
this
.
activeTrackColor
,
this
.
inactiveThumbColor
,
this
.
inactiveThumbColor
,
...
@@ -294,6 +295,7 @@ class SwitchListTile extends StatelessWidget {
...
@@ -294,6 +295,7 @@ class SwitchListTile extends StatelessWidget {
Key
?
key
,
Key
?
key
,
required
this
.
value
,
required
this
.
value
,
required
this
.
onChanged
,
required
this
.
onChanged
,
this
.
tileColor
,
this
.
activeColor
,
this
.
activeColor
,
this
.
activeTrackColor
,
this
.
activeTrackColor
,
this
.
inactiveThumbColor
,
this
.
inactiveThumbColor
,
...
@@ -374,6 +376,9 @@ class SwitchListTile extends StatelessWidget {
...
@@ -374,6 +376,9 @@ class SwitchListTile extends StatelessWidget {
/// Ignored if created with [SwitchListTile.adaptive].
/// Ignored if created with [SwitchListTile.adaptive].
final
Color
?
inactiveTrackColor
;
final
Color
?
inactiveTrackColor
;
/// {@macro flutter.material.ListTile.tileColor}
final
Color
?
tileColor
;
/// An image to use on the thumb of this switch when the switch is on.
/// An image to use on the thumb of this switch when the switch is on.
final
ImageProvider
?
activeThumbImage
;
final
ImageProvider
?
activeThumbImage
;
...
@@ -503,6 +508,7 @@ class SwitchListTile extends StatelessWidget {
...
@@ -503,6 +508,7 @@ class SwitchListTile extends StatelessWidget {
selected:
selected
,
selected:
selected
,
autofocus:
autofocus
,
autofocus:
autofocus
,
shape:
shape
,
shape:
shape
,
tileColor:
tileColor
,
),
),
),
),
);
);
...
...
packages/flutter/test/material/checkbox_list_tile_test.dart
View file @
ff85d97a
...
@@ -239,4 +239,24 @@ void main() {
...
@@ -239,4 +239,24 @@ void main() {
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
});
});
testWidgets
(
'CheckboxListTile respects tileColor'
,
(
WidgetTester
tester
)
async
{
const
Color
tileColor
=
Colors
.
black
;
await
tester
.
pumpWidget
(
wrap
(
child:
const
Center
(
child:
CheckboxListTile
(
value:
false
,
onChanged:
null
,
title:
Text
(
'Title'
),
tileColor:
tileColor
,
),
),
),
);
final
ColoredBox
coloredBox
=
tester
.
firstWidget
(
find
.
byType
(
ColoredBox
));
expect
(
coloredBox
.
color
,
equals
(
tileColor
));
});
}
}
packages/flutter/test/material/switch_list_tile_test.dart
View file @
ff85d97a
...
@@ -357,4 +357,24 @@ void main() {
...
@@ -357,4 +357,24 @@ void main() {
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
expect
(
tester
.
widget
<
InkWell
>(
find
.
byType
(
InkWell
)).
customBorder
,
shapeBorder
);
});
});
testWidgets
(
'SwitchListTile respects tileColor'
,
(
WidgetTester
tester
)
async
{
const
Color
tileColor
=
Colors
.
red
;
await
tester
.
pumpWidget
(
wrap
(
child:
const
Center
(
child:
SwitchListTile
(
value:
false
,
onChanged:
null
,
title:
Text
(
'Title'
),
tileColor:
tileColor
,
),
),
),
);
final
ColoredBox
coloredBox
=
tester
.
firstWidget
(
find
.
byType
(
ColoredBox
));
expect
(
coloredBox
.
color
,
tileColor
);
});
}
}
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