From 16ce090fde2d547771bc4be31ef2fb7be3e5a8f1 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Tue, 1 Nov 2016 20:34:36 -0700 Subject: [PATCH] Eliminate direct access of Typography.black/white in manual tests (#6640) --- dev/manual_tests/card_collection.dart | 7 ++++--- dev/manual_tests/drag_and_drop.dart | 2 +- dev/manual_tests/raw_keyboard.dart | 11 ++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/dev/manual_tests/card_collection.dart b/dev/manual_tests/card_collection.dart index 1245a5c3974..40aef97f797 100644 --- a/dev/manual_tests/card_collection.dart +++ b/dev/manual_tests/card_collection.dart @@ -32,8 +32,6 @@ class CardCollectionState extends State { static const double kCardMargins = 8.0; static const double kFixedCardHeight = 100.0; - final TextStyle backgroundTextStyle = Typography.white.title; - Map _primaryColor = Colors.deepPurple; List _cardModels; DismissDirection _dismissDirection = DismissDirection.horizontal; @@ -358,6 +356,9 @@ class CardCollectionState extends State { if (_dismissDirection == DismissDirection.endToStart) rightArrowIcon = new Opacity(opacity: 0.1, child: rightArrowIcon); + final ThemeData theme = Theme.of(context); + final TextStyle backgroundTextStyle = theme.primaryTextTheme.title; + // The background Widget appears behind the Dismissable card when the card // moves to the left or right. The Positioned widget ensures that the // size of the background,card Stack will be based only on the card. The @@ -369,7 +370,7 @@ class CardCollectionState extends State { child: new Viewport( child: new Container( height: cardModel.height, - decoration: new BoxDecoration(backgroundColor: Theme.of(context).primaryColor), + decoration: new BoxDecoration(backgroundColor: theme.primaryColor), child: new Row( children: [ leftArrowIcon, diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart index 2e6ac394252..c96dc718829 100644 --- a/dev/manual_tests/drag_and_drop.dart +++ b/dev/manual_tests/drag_and_drop.dart @@ -186,7 +186,7 @@ class MovableBall extends StatelessWidget { @override Widget build(BuildContext context) { Widget ball = new DefaultTextStyle( - style: Typography.white.body1, + style: Theme.of(context).primaryTextTheme.body1, textAlign: TextAlign.center, child: new Dot( key: kBallKey, diff --git a/dev/manual_tests/raw_keyboard.dart b/dev/manual_tests/raw_keyboard.dart index 1d7dfddb7ac..cfa6284c40d 100644 --- a/dev/manual_tests/raw_keyboard.dart +++ b/dev/manual_tests/raw_keyboard.dart @@ -41,6 +41,7 @@ class _HardwareKeyDemoState extends State { @override Widget build(BuildContext context) { + final TextTheme textTheme = Theme.of(context).textTheme; bool focused = Focus.at(context); Widget child; if (!focused) { @@ -49,12 +50,12 @@ class _HardwareKeyDemoState extends State { Focus.moveTo(config.key); }, child: new Center( - child: new Text('Tap to focus', style: Typography.black.display1), + child: new Text('Tap to focus', style: textTheme.display1), ), ); } else if (_event == null) { child = new Center( - child: new Text('Press a key', style: Typography.black.display1), + child: new Text('Press a key', style: textTheme.display1), ); } else { int codePoint; @@ -67,9 +68,9 @@ class _HardwareKeyDemoState extends State { child = new Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - new Text('${_event.runtimeType}', style: Typography.black.body2), - new Text('codePoint: $codePoint', style: Typography.black.display4), - new Text('keyCode: $keyCode', style: Typography.black.display4), + new Text('${_event.runtimeType}', style: textTheme.body2), + new Text('codePoint: $codePoint', style: textTheme.display4), + new Text('keyCode: $keyCode', style: textTheme.display4), ], ); }