Unverified Commit 0478cbec authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed RadioListTile accentColor dependency (#76906)

parent 8d866d9c
...@@ -26,11 +26,13 @@ import 'theme_data.dart'; ...@@ -26,11 +26,13 @@ import 'theme_data.dart';
/// those of the same name on [ListTile]. /// those of the same name on [ListTile].
/// ///
/// The [selected] property on this widget is similar to the [ListTile.selected] /// The [selected] property on this widget is similar to the [ListTile.selected]
/// property, but the color used is that described by [activeColor], if any, /// property. This tile's [activeColor] is used for the selected item's text color, or
/// defaulting to the accent color of the current [Theme]. No effort is made to /// the theme's [ThemeData.toggleableActiveColor] if [activeColor] is null.
/// coordinate the [selected] state and the [checked] state; to have the list ///
/// tile appear selected when the radio button is the selected radio button, set /// This widget does not coordinate the [selected] state and the
/// [selected] to true when [value] matches [groupValue]. /// [checked] state; to have the list tile appear selected when the
/// radio button is the selected radio button, set [selected] to true
/// when [value] matches [groupValue].
/// ///
/// The radio button is shown on the left by default in left-to-right languages /// The radio button is shown on the left by default in left-to-right languages
/// (i.e. the leading edge). This can be changed using [controlAffinity]. The /// (i.e. the leading edge). This can be changed using [controlAffinity]. The
...@@ -520,7 +522,7 @@ class RadioListTile<T> extends StatelessWidget { ...@@ -520,7 +522,7 @@ class RadioListTile<T> extends StatelessWidget {
} }
return MergeSemantics( return MergeSemantics(
child: ListTileTheme.merge( child: ListTileTheme.merge(
selectedColor: activeColor ?? Theme.of(context).accentColor, selectedColor: activeColor ?? Theme.of(context).toggleableActiveColor,
child: ListTile( child: ListTile(
leading: leading, leading: leading,
title: title, title: title,
......
...@@ -707,4 +707,40 @@ void main() { ...@@ -707,4 +707,40 @@ void main() {
expect(find.byType(Material), paints..path(color: selectedTileColor)); expect(find.byType(Material), paints..path(color: selectedTileColor));
}); });
testWidgets('RadioListTile selected item text Color', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/76906
const Color activeColor = Color(0xff00ff00);
Widget buildFrame({ Color? activeColor, Color? toggleableActiveColor }) {
return MaterialApp(
theme: ThemeData.light().copyWith(
toggleableActiveColor: toggleableActiveColor,
),
home: Scaffold(
body: Center(
child: RadioListTile<bool>(
activeColor: activeColor,
selected: true,
title: const Text('title'),
value: false,
groupValue: true,
onChanged: (bool? newValue) { },
),
),
),
);
}
Color? textColor(String text) {
return tester.renderObject<RenderParagraph>(find.text(text)).text.style?.color;
}
await tester.pumpWidget(buildFrame(toggleableActiveColor: activeColor));
expect(textColor('title'), activeColor);
await tester.pumpWidget(buildFrame(activeColor: activeColor));
expect(textColor('title'), activeColor);
});
} }
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