Unverified Commit ff85d97a authored by Pedro Massango's avatar Pedro Massango Committed by GitHub

Expose the tileColor property (#67135)

parent ed2a4809
...@@ -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,
), ),
), ),
); );
......
...@@ -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.
......
...@@ -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,
), ),
), ),
); );
......
...@@ -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));
});
} }
...@@ -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);
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment