Skip to content

Commit 16ce090

Browse files
authored
Eliminate direct access of Typography.black/white in manual tests (flutter#6640)
1 parent 58630cc commit 16ce090

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

dev/manual_tests/card_collection.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ class CardCollectionState extends State<CardCollection> {
3232
static const double kCardMargins = 8.0;
3333
static const double kFixedCardHeight = 100.0;
3434

35-
final TextStyle backgroundTextStyle = Typography.white.title;
36-
3735
Map<int, Color> _primaryColor = Colors.deepPurple;
3836
List<CardModel> _cardModels;
3937
DismissDirection _dismissDirection = DismissDirection.horizontal;
@@ -358,6 +356,9 @@ class CardCollectionState extends State<CardCollection> {
358356
if (_dismissDirection == DismissDirection.endToStart)
359357
rightArrowIcon = new Opacity(opacity: 0.1, child: rightArrowIcon);
360358

359+
final ThemeData theme = Theme.of(context);
360+
final TextStyle backgroundTextStyle = theme.primaryTextTheme.title;
361+
361362
// The background Widget appears behind the Dismissable card when the card
362363
// moves to the left or right. The Positioned widget ensures that the
363364
// size of the background,card Stack will be based only on the card. The
@@ -369,7 +370,7 @@ class CardCollectionState extends State<CardCollection> {
369370
child: new Viewport(
370371
child: new Container(
371372
height: cardModel.height,
372-
decoration: new BoxDecoration(backgroundColor: Theme.of(context).primaryColor),
373+
decoration: new BoxDecoration(backgroundColor: theme.primaryColor),
373374
child: new Row(
374375
children: <Widget>[
375376
leftArrowIcon,

dev/manual_tests/drag_and_drop.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class MovableBall extends StatelessWidget {
186186
@override
187187
Widget build(BuildContext context) {
188188
Widget ball = new DefaultTextStyle(
189-
style: Typography.white.body1,
189+
style: Theme.of(context).primaryTextTheme.body1,
190190
textAlign: TextAlign.center,
191191
child: new Dot(
192192
key: kBallKey,

dev/manual_tests/raw_keyboard.dart

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
4141

4242
@override
4343
Widget build(BuildContext context) {
44+
final TextTheme textTheme = Theme.of(context).textTheme;
4445
bool focused = Focus.at(context);
4546
Widget child;
4647
if (!focused) {
@@ -49,12 +50,12 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
4950
Focus.moveTo(config.key);
5051
},
5152
child: new Center(
52-
child: new Text('Tap to focus', style: Typography.black.display1),
53+
child: new Text('Tap to focus', style: textTheme.display1),
5354
),
5455
);
5556
} else if (_event == null) {
5657
child = new Center(
57-
child: new Text('Press a key', style: Typography.black.display1),
58+
child: new Text('Press a key', style: textTheme.display1),
5859
);
5960
} else {
6061
int codePoint;
@@ -67,9 +68,9 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
6768
child = new Column(
6869
mainAxisAlignment: MainAxisAlignment.center,
6970
children: <Widget>[
70-
new Text('${_event.runtimeType}', style: Typography.black.body2),
71-
new Text('codePoint: $codePoint', style: Typography.black.display4),
72-
new Text('keyCode: $keyCode', style: Typography.black.display4),
71+
new Text('${_event.runtimeType}', style: textTheme.body2),
72+
new Text('codePoint: $codePoint', style: textTheme.display4),
73+
new Text('keyCode: $keyCode', style: textTheme.display4),
7374
],
7475
);
7576
}

0 commit comments

Comments
 (0)