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

Revert "Removed accentColor dependency from ExpansionTile (#77933)" (#79053)

parent 3c73185c
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'color_scheme.dart';
import 'colors.dart'; import 'colors.dart';
import 'icons.dart'; import 'icons.dart';
import 'list_tile.dart'; import 'list_tile.dart';
...@@ -290,14 +289,13 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider ...@@ -290,14 +289,13 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
@override @override
void didChangeDependencies() { void didChangeDependencies() {
final ThemeData theme = Theme.of(context); final ThemeData theme = Theme.of(context);
final ColorScheme colorScheme = theme.colorScheme;
_borderColorTween.end = theme.dividerColor; _borderColorTween.end = theme.dividerColor;
_headerColorTween _headerColorTween
..begin = widget.collapsedTextColor ?? theme.textTheme.subtitle1!.color ..begin = widget.collapsedTextColor ?? theme.textTheme.subtitle1!.color
..end = widget.textColor ?? colorScheme.secondary; ..end = widget.textColor ?? theme.accentColor;
_iconColorTween _iconColorTween
..begin = widget.collapsedIconColor ?? theme.unselectedWidgetColor ..begin = widget.collapsedIconColor ?? theme.unselectedWidgetColor
..end = widget.iconColor ?? colorScheme.secondary; ..end = widget.iconColor ?? theme.accentColor;
_backgroundColorTween _backgroundColorTween
..begin = widget.collapsedBackgroundColor ..begin = widget.collapsedBackgroundColor
..end = widget.backgroundColor; ..end = widget.backgroundColor;
......
...@@ -43,7 +43,7 @@ class TestTextState extends State<TestText> { ...@@ -43,7 +43,7 @@ class TestTextState extends State<TestText> {
void main() { void main() {
const Color _dividerColor = Color(0x1f333333); const Color _dividerColor = Color(0x1f333333);
const Color _foregroundColor = Colors.blueAccent; const Color _accentColor = Colors.blueAccent;
const Color _unselectedWidgetColor = Colors.black54; const Color _unselectedWidgetColor = Colors.black54;
const Color _headerColor = Colors.black45; const Color _headerColor = Colors.black45;
...@@ -163,7 +163,7 @@ void main() { ...@@ -163,7 +163,7 @@ void main() {
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSwatch().copyWith(secondary: _foregroundColor), accentColor: _accentColor,
unselectedWidgetColor: _unselectedWidgetColor, unselectedWidgetColor: _unselectedWidgetColor,
textTheme: const TextTheme(subtitle1: TextStyle(color: _headerColor)), textTheme: const TextTheme(subtitle1: TextStyle(color: _headerColor)),
), ),
...@@ -195,9 +195,9 @@ void main() { ...@@ -195,9 +195,9 @@ void main() {
Color iconColor(Key key) => tester.state<TestIconState>(find.byKey(key)).iconTheme.color!; Color iconColor(Key key) => tester.state<TestIconState>(find.byKey(key)).iconTheme.color!;
Color textColor(Key key) => tester.state<TestTextState>(find.byKey(key)).textStyle.color!; Color textColor(Key key) => tester.state<TestTextState>(find.byKey(key)).textStyle.color!;
expect(textColor(expandedTitleKey), _foregroundColor); expect(textColor(expandedTitleKey), _accentColor);
expect(textColor(collapsedTitleKey), _headerColor); expect(textColor(collapsedTitleKey), _headerColor);
expect(iconColor(expandedIconKey), _foregroundColor); expect(iconColor(expandedIconKey), _accentColor);
expect(iconColor(collapsedIconKey), _unselectedWidgetColor); expect(iconColor(collapsedIconKey), _unselectedWidgetColor);
// Tap both tiles to change their state: collapse and extend respectively // Tap both tiles to change their state: collapse and extend respectively
...@@ -208,9 +208,9 @@ void main() { ...@@ -208,9 +208,9 @@ void main() {
await tester.pump(const Duration(seconds: 1)); await tester.pump(const Duration(seconds: 1));
expect(textColor(expandedTitleKey), _headerColor); expect(textColor(expandedTitleKey), _headerColor);
expect(textColor(collapsedTitleKey), _foregroundColor); expect(textColor(collapsedTitleKey), _accentColor);
expect(iconColor(expandedIconKey), _unselectedWidgetColor); expect(iconColor(expandedIconKey), _unselectedWidgetColor);
expect(iconColor(collapsedIconKey), _foregroundColor); expect(iconColor(collapsedIconKey), _accentColor);
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS })); }, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.iOS, TargetPlatform.macOS }));
testWidgets('ExpansionTile subtitle', (WidgetTester tester) async { testWidgets('ExpansionTile subtitle', (WidgetTester tester) async {
......
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