Skip to content

Commit 58630cc

Browse files
authored
Derive colors demo TextStyle from theme (flutter#6632)
1 parent 751539c commit 58630cc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/flutter_gallery/lib/demo/colors_demo.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ class ColorSwatchTabView extends StatelessWidget {
7979
}
8080

8181
final ColorSwatch swatch;
82-
final TextStyle blackTextStyle = Typography.black.body1;
83-
final TextStyle whiteTextStyle = Typography.white.body1;
84-
8582
@override
8683
Widget build(BuildContext context) {
84+
final TextTheme textTheme = Theme.of(context).textTheme;
85+
final TextStyle whiteTextStyle = textTheme.body1.copyWith(color: Colors.white);
86+
final TextStyle blackTextStyle = textTheme.body1.copyWith(color: Colors.black);
8787
List<Widget> colorItems = swatch.colors.keys.map((int index) {
8888
return new DefaultTextStyle(
8989
style: index > swatch.threshold ? whiteTextStyle : blackTextStyle,

0 commit comments

Comments
 (0)