[Icons] Updating default icon theme values. (#20840)

Closes #3188
This commit is contained in:
Will Larche
2018-09-04 19:26:52 -04:00
committed by GitHub
parent 70eefd1e9c
commit 2ef7cd649c
5 changed files with 27 additions and 7 deletions

View File

@@ -74,7 +74,7 @@ void main() {
// check the colour of the icon - light mode
checkIconColor(tester, 'Stock List', Colors.purple); // theme primary color
checkIconColor(tester, 'Account Balance', Colors.black26); // disabled
checkIconColor(tester, 'Account Balance', Colors.black38); // disabled
checkIconColor(tester, 'About', Colors.black45); // enabled
// switch to dark mode

View File

@@ -411,11 +411,11 @@ class MaterialButton extends StatelessWidget {
case ButtonTextTheme.normal:
return enabled
? (themeIsDark ? Colors.white : Colors.black87)
: (themeIsDark ? Colors.white30 : Colors.black26);
: theme.disabledColor;
case ButtonTextTheme.accent:
return enabled
? theme.accentColor
: (themeIsDark ? Colors.white30 : Colors.black26);
: theme.disabledColor;
case ButtonTextTheme.primary:
return enabled
? (fillIsDark ? Colors.white : Colors.black)

View File

@@ -167,7 +167,7 @@ class ThemeData extends Diagnosticable {
splashFactory ??= InkSplash.splashFactory;
selectedRowColor ??= Colors.grey[100];
unselectedWidgetColor ??= isDark ? Colors.white70 : Colors.black54;
disabledColor ??= isDark ? Colors.white30 : Colors.black26;
disabledColor ??= isDark ? Colors.white30 : Colors.black38;
buttonColor ??= isDark ? primarySwatch[600] : Colors.grey[300];
buttonTheme ??= const ButtonThemeData();
// Spec doesn't specify a dark theme secondaryHeaderColor, this is a guess.
@@ -182,9 +182,9 @@ class ThemeData extends Diagnosticable {
hintColor ??= isDark ? const Color(0x80FFFFFF) : const Color(0x8A000000);
errorColor ??= Colors.red[700];
inputDecorationTheme ??= const InputDecorationTheme();
iconTheme ??= isDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
primaryIconTheme ??= primaryIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
accentIconTheme ??= accentIsDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black);
iconTheme ??= isDark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black87);
platform ??= defaultTargetPlatform;
final Typography typography = new Typography(platform: platform);
final TextTheme defaultTextTheme = isDark ? typography.white : typography.black;

View File

@@ -310,7 +310,27 @@ void main() {
);
});
testWidgets('Disabled MaterialButton has same semantic size as enabled and exposes disabled semantics', (WidgetTester tester) async {
testWidgets('Disabled MaterialButton has correct default text color', (WidgetTester tester) async {
const String testText = 'Disabled';
const Widget buttonWidget = Directionality(
textDirection: TextDirection.ltr,
child: Material(
child: Center(
child: MaterialButton(
onPressed: null,
child: Text(testText), // button is disabled
),
),
),
);
await tester.pumpWidget(buttonWidget);
final RichText text = tester.widget<RichText>(find.byType(RichText));
expect(text.text.style.color, Colors.black38);
});
testWidgets('Disabled MaterialButton has same semantic size as enabled and exposes disabled semantics', (WidgetTester tester) async {
final SemanticsTester semantics = new SemanticsTester(tester);
final Rect expectedButtonSize = new Rect.fromLTRB(0.0, 0.0, 116.0, 48.0);

View File

@@ -37,7 +37,7 @@ void main() {
);
final IconTheme iconTheme = tester.firstWidget(find.byType(IconTheme).last);
expect(iconTheme.data.color, equals(Colors.black26));
expect(iconTheme.data.color, equals(Colors.black38));
});
testWidgets('ExpandIcon test isExpanded does not trigger callback', (WidgetTester tester) async {