Unverified Commit b91b1644 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Removed CheckboxListTile accentColor dependency (#76908)

parent 0478cbec
......@@ -26,9 +26,10 @@ import 'theme_data.dart';
/// those of the same name on [ListTile].
///
/// The [selected] property on this widget is similar to the [ListTile.selected]
/// property, but the color used is that described by [activeColor], if any,
/// defaulting to the accent color of the current [Theme]. No effort is made to
/// coordinate the [selected] state and the [value] state; to have the list tile
/// property. This tile's [activeColor] is used for the selected item's text color, or
/// the theme's [ThemeData.toggleableActiveColor] if [activeColor] is null.
///
/// This widget does not coordinate the [selected] state and the [value] state; to have the list tile
/// appear selected when the checkbox is checked, pass the same value to both.
///
/// The checkbox is shown on the right by default in left-to-right languages
......@@ -432,7 +433,7 @@ class CheckboxListTile extends StatelessWidget {
}
return MergeSemantics(
child: ListTileTheme.merge(
selectedColor: activeColor ?? Theme.of(context).accentColor,
selectedColor: activeColor ?? Theme.of(context).toggleableActiveColor,
child: ListTile(
leading: leading,
title: title,
......
......@@ -4,6 +4,7 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import '../rendering/mock_canvas.dart';
......@@ -283,4 +284,39 @@ void main() {
expect(find.byType(Material), paints..path(color: selectedTileColor));
});
testWidgets('CheckboxListTile selected item text Color', (WidgetTester tester) async {
// Regression test for https://github.com/flutter/flutter/pull/76908
const Color activeColor = Color(0xff00ff00);
Widget buildFrame({ Color? activeColor, Color? toggleableActiveColor }) {
return MaterialApp(
theme: ThemeData.light().copyWith(
toggleableActiveColor: toggleableActiveColor,
),
home: Scaffold(
body: Center(
child: CheckboxListTile(
activeColor: activeColor,
selected: true,
title: const Text('title'),
value: true,
onChanged: (bool? value) { },
),
),
),
);
}
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