Unverified Commit 9a8b4602 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

change ThemeData.primaryColor to PrimarySwatch instead of PrimarySwatch[500] (#15265)

* change ThemeData.primaryColor to PrimarySwatch instead of PrimarySwatch[500]

* fix mismatched color in stock test case
parent 9a3b6c3b
...@@ -73,7 +73,7 @@ void main() { ...@@ -73,7 +73,7 @@ void main() {
expect(find.text('Account Balance'), findsOneWidget); expect(find.text('Account Balance'), findsOneWidget);
// check the colour of the icon - light mode // check the colour of the icon - light mode
checkIconColor(tester, 'Stock List', Colors.purple.shade500); // theme primary color checkIconColor(tester, 'Stock List', Colors.purple); // theme primary color
checkIconColor(tester, 'Account Balance', Colors.black26); // disabled checkIconColor(tester, 'Account Balance', Colors.black26); // disabled
checkIconColor(tester, 'About', Colors.black45); // enabled checkIconColor(tester, 'About', Colors.black45); // enabled
......
...@@ -118,7 +118,7 @@ class ThemeData extends Diagnosticable { ...@@ -118,7 +118,7 @@ class ThemeData extends Diagnosticable {
brightness ??= Brightness.light; brightness ??= Brightness.light;
final bool isDark = brightness == Brightness.dark; final bool isDark = brightness == Brightness.dark;
primarySwatch ??= Colors.blue; primarySwatch ??= Colors.blue;
primaryColor ??= isDark ? Colors.grey[900] : primarySwatch[500]; primaryColor ??= isDark ? Colors.grey[900] : primarySwatch;
primaryColorBrightness ??= estimateBrightnessForColor(primaryColor); primaryColorBrightness ??= estimateBrightnessForColor(primaryColor);
primaryColorLight ??= isDark ? Colors.grey[500] : primarySwatch[100]; primaryColorLight ??= isDark ? Colors.grey[500] : primarySwatch[100];
primaryColorDark ??= isDark ? Colors.black : primarySwatch[700]; primaryColorDark ??= isDark ? Colors.black : primarySwatch[700];
......
...@@ -15,7 +15,7 @@ void main() { ...@@ -15,7 +15,7 @@ void main() {
home: const Placeholder(), home: const Placeholder(),
builder: (BuildContext context, Widget child) { builder: (BuildContext context, Widget child) {
log.add('build'); log.add('build');
expect(Theme.of(context).primaryColor, Colors.green.shade500); expect(Theme.of(context).primaryColor, Colors.green);
expect(Directionality.of(context), TextDirection.ltr); expect(Directionality.of(context), TextDirection.ltr);
expect(child, const isInstanceOf<Navigator>()); expect(child, const isInstanceOf<Navigator>());
return const Placeholder(); return const Placeholder();
...@@ -47,7 +47,7 @@ void main() { ...@@ -47,7 +47,7 @@ void main() {
home: new Builder( home: new Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
log.add('build'); log.add('build');
expect(Theme.of(context).primaryColor, Colors.yellow.shade500); expect(Theme.of(context).primaryColor, Colors.yellow);
expect(Directionality.of(context), TextDirection.rtl); expect(Directionality.of(context), TextDirection.rtl);
return const Placeholder(); return const Placeholder();
}, },
......
...@@ -236,7 +236,7 @@ void main() { ...@@ -236,7 +236,7 @@ void main() {
DecoratedBox widget = tester.firstWidget(find.byType(DecoratedBox)); DecoratedBox widget = tester.firstWidget(find.byType(DecoratedBox));
BoxDecoration decoration = widget.decoration; BoxDecoration decoration = widget.decoration;
expect(decoration.color, equals(Colors.blue[500])); expect(decoration.color, equals(Colors.blue));
setState(() { setState(() {
themeData = new ThemeData(primarySwatch: Colors.green); themeData = new ThemeData(primarySwatch: Colors.green);
...@@ -246,7 +246,7 @@ void main() { ...@@ -246,7 +246,7 @@ void main() {
widget = tester.firstWidget(find.byType(DecoratedBox)); widget = tester.firstWidget(find.byType(DecoratedBox));
decoration = widget.decoration; decoration = widget.decoration;
expect(decoration.color, equals(Colors.green[500])); expect(decoration.color, equals(Colors.green));
}); });
testWidgets('ListView padding', (WidgetTester tester) async { testWidgets('ListView padding', (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