From 7ba19605189411e38e9cd59a27037a9e410c6308 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Sat, 12 Mar 2016 11:39:27 -0800 Subject: [PATCH] [rename fixit] ThemeData#text -> textTheme Fixes #1278 --- dev/manual_tests/drag_and_drop.dart | 4 +-- .../lib/demo/buttons_demo.dart | 2 +- .../material_gallery/lib/demo/cards_demo.dart | 6 ++-- .../lib/demo/dialog_demo.dart | 2 +- .../lib/demo/fitness_demo.dart | 2 +- .../lib/demo/flexible_space_demo.dart | 4 +-- .../lib/demo/full_screen_dialog_demo.dart | 14 ++++---- .../material_gallery/lib/demo/icons_demo.dart | 2 +- .../lib/demo/progress_indicator_demo.dart | 2 +- .../lib/demo/scrolling_techniques_demo.dart | 4 +-- .../lib/demo/tabs_fab_demo.dart | 2 +- .../lib/demo/tooltip_demo.dart | 6 ++-- .../lib/demo/typography_demo.dart | 4 +-- .../material_gallery/lib/gallery/section.dart | 2 +- examples/stocks/lib/stock_symbol_viewer.dart | 4 +-- packages/flutter/lib/src/material/button.dart | 2 +- .../flutter/lib/src/material/date_picker.dart | 4 +-- packages/flutter/lib/src/material/dialog.dart | 4 +-- .../lib/src/material/drawer_header.dart | 2 +- .../flutter/lib/src/material/drawer_item.dart | 2 +- .../flutter/lib/src/material/dropdown.dart | 2 +- packages/flutter/lib/src/material/input.dart | 12 +++---- .../flutter/lib/src/material/list_item.dart | 6 ++-- .../flutter/lib/src/material/material.dart | 2 +- .../flutter/lib/src/material/popup_menu.dart | 2 +- .../flutter/lib/src/material/snack_bar.dart | 2 +- .../flutter/lib/src/material/theme_data.dart | 18 +++++----- .../flutter/lib/src/material/tooltip.dart | 2 +- .../lib/src/material/two_level_list.dart | 4 +-- .../lib/src/markdown_style.dart | 36 +++++++++---------- 30 files changed, 80 insertions(+), 80 deletions(-) diff --git a/dev/manual_tests/drag_and_drop.dart b/dev/manual_tests/drag_and_drop.dart index 2256a7948b..3d426eebb7 100644 --- a/dev/manual_tests/drag_and_drop.dart +++ b/dev/manual_tests/drag_and_drop.dart @@ -90,7 +90,7 @@ class ExampleDragSource extends StatelessComponent { size *= kHeavyMultiplier; Widget contents = new DefaultTextStyle( - style: Theme.of(context).text.body1.copyWith(textAlign: TextAlign.center), + style: Theme.of(context).textTheme.body1.copyWith(textAlign: TextAlign.center), child: new Dot( color: color, size: size, @@ -174,7 +174,7 @@ class MovableBall extends StatelessComponent { Widget build(BuildContext context) { Widget ball = new DefaultTextStyle( - style: Theme.of(context).text.body1.copyWith( + style: Theme.of(context).textTheme.body1.copyWith( textAlign: TextAlign.center, color: Colors.white ), diff --git a/examples/material_gallery/lib/demo/buttons_demo.dart b/examples/material_gallery/lib/demo/buttons_demo.dart index fc6ee21ebc..ef2292799f 100644 --- a/examples/material_gallery/lib/demo/buttons_demo.dart +++ b/examples/material_gallery/lib/demo/buttons_demo.dart @@ -177,7 +177,7 @@ class _ButtonsDemoState extends State { Widget buildTabView(_ButtonDemo demo) { return new Builder( builder: (BuildContext context) { - final TextStyle textStyle = Theme.of(context).text.caption.copyWith(fontSize: 16.0); + final TextStyle textStyle = Theme.of(context).textTheme.caption.copyWith(fontSize: 16.0); return new Column( alignItems: FlexAlignItems.stretch, children: [ diff --git a/examples/material_gallery/lib/demo/cards_demo.dart b/examples/material_gallery/lib/demo/cards_demo.dart index 3f74e934c4..7f1931dafc 100644 --- a/examples/material_gallery/lib/demo/cards_demo.dart +++ b/examples/material_gallery/lib/demo/cards_demo.dart @@ -45,9 +45,9 @@ class TravelDestinationItem extends StatelessComponent { Widget build(BuildContext context) { ThemeData theme = Theme.of(context); - TextStyle titleStyle = theme.text.headline.copyWith(color: Colors.white); - TextStyle descriptionStyle = theme.text.subhead; - TextStyle buttonStyle = theme.text.button.copyWith(color: theme.primaryColor); + TextStyle titleStyle = theme.textTheme.headline.copyWith(color: Colors.white); + TextStyle descriptionStyle = theme.textTheme.subhead; + TextStyle buttonStyle = theme.textTheme.button.copyWith(color: theme.primaryColor); return new Card( child: new SizedBox( diff --git a/examples/material_gallery/lib/demo/dialog_demo.dart b/examples/material_gallery/lib/demo/dialog_demo.dart index 46ccb73339..d6b20824ae 100644 --- a/examples/material_gallery/lib/demo/dialog_demo.dart +++ b/examples/material_gallery/lib/demo/dialog_demo.dart @@ -76,7 +76,7 @@ class DialogDemoState extends State { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle dialogTextStyle = theme.text.subhead.copyWith(color: theme.text.caption.color); + final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); return new Scaffold( key: scaffoldKey, diff --git a/examples/material_gallery/lib/demo/fitness_demo.dart b/examples/material_gallery/lib/demo/fitness_demo.dart index d15682e832..8adcd66f6b 100644 --- a/examples/material_gallery/lib/demo/fitness_demo.dart +++ b/examples/material_gallery/lib/demo/fitness_demo.dart @@ -103,7 +103,7 @@ class _FitnessDemoContentsState extends State<_FitnessDemoContents> { ), new Padding( padding: new EdgeDims.only(top: 20.0), - child: new Text("JUMPING JACKS", style: Theme.of(context).text.title) + child: new Text("JUMPING JACKS", style: Theme.of(context).textTheme.title) ), new Padding( padding: new EdgeDims.only(top: 20.0, bottom: 20.0), diff --git a/examples/material_gallery/lib/demo/flexible_space_demo.dart b/examples/material_gallery/lib/demo/flexible_space_demo.dart index f8d24c45e7..832e6b442b 100644 --- a/examples/material_gallery/lib/demo/flexible_space_demo.dart +++ b/examples/material_gallery/lib/demo/flexible_space_demo.dart @@ -18,7 +18,7 @@ class _ContactCategory extends StatelessComponent { border: new Border(bottom: new BorderSide(color: Theme.of(context).dividerColor)) ), child: new DefaultTextStyle( - style: Theme.of(context).text.subhead, + style: Theme.of(context).textTheme.subhead, child: new Row( children: [ new SizedBox( @@ -43,7 +43,7 @@ class _ContactItem extends StatelessComponent { Widget build(BuildContext context) { List columnChildren = lines.sublist(0, lines.length - 1).map((String line) => new Text(line)).toList(); - columnChildren.add(new Text(lines.last, style: Theme.of(context).text.caption)); + columnChildren.add(new Text(lines.last, style: Theme.of(context).textTheme.caption)); List rowChildren = [ new Column( diff --git a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart index 3bd48c164b..48c043c540 100644 --- a/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart +++ b/examples/material_gallery/lib/demo/full_screen_dialog_demo.dart @@ -31,7 +31,7 @@ class DateTimeItem extends StatelessComponent { final ThemeData theme = Theme.of(context); return new DefaultTextStyle( - style: theme.text.subhead, + style: theme.textTheme.subhead, child: new Row( children: [ new Flexible( @@ -109,7 +109,7 @@ class FullScreenDialogDemoState extends State { } final ThemeData theme = Theme.of(context); - final TextStyle dialogTextStyle = theme.text.subhead.copyWith(color: theme.text.caption.color); + final TextStyle dialogTextStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); showDialog( context: context, @@ -149,7 +149,7 @@ class FullScreenDialogDemoState extends State { center: new Text('New Event'), right: [ new FlatButton( - child: new Text('SAVE', style: theme.text.body1.copyWith(color: Colors.white)), + child: new Text('SAVE', style: theme.textTheme.body1.copyWith(color: Colors.white)), onPressed: () { Navigator.pop(context, DismissDialogAction.save); } @@ -170,7 +170,7 @@ class FullScreenDialogDemoState extends State { ), child: new Align( alignment: const FractionalOffset(0.0, 1.0), - child: new Text('Event name', style: theme.text.display2) + child: new Text('Event name', style: theme.textTheme.display2) ) ), new Container( @@ -180,14 +180,14 @@ class FullScreenDialogDemoState extends State { ), child: new Align( alignment: const FractionalOffset(0.0, 1.0), - child: new Text('Location', style: theme.text.title.copyWith(color: Colors.black54)) + child: new Text('Location', style: theme.textTheme.title.copyWith(color: Colors.black54)) ) ), new Column( alignItems: FlexAlignItems.stretch, justifyContent: FlexJustifyContent.end, children: [ - new Text('From', style: theme.text.caption), + new Text('From', style: theme.textTheme.caption), new DateTimeItem( dateTime: fromDateTime, onChanged: (DateTime value) { @@ -203,7 +203,7 @@ class FullScreenDialogDemoState extends State { alignItems: FlexAlignItems.stretch, justifyContent: FlexJustifyContent.end, children: [ - new Text('To', style: theme.text.caption), + new Text('To', style: theme.textTheme.caption), new DateTimeItem( dateTime: toDateTime, onChanged: (DateTime value) { diff --git a/examples/material_gallery/lib/demo/icons_demo.dart b/examples/material_gallery/lib/demo/icons_demo.dart index 3146fda5dd..dff4e43506 100644 --- a/examples/material_gallery/lib/demo/icons_demo.dart +++ b/examples/material_gallery/lib/demo/icons_demo.dart @@ -63,7 +63,7 @@ class IconsDemoState extends State { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle textStyle = theme.text.subhead.copyWith(color: theme.text.caption.color); + final TextStyle textStyle = theme.textTheme.subhead.copyWith(color: theme.textTheme.caption.color); return new Scaffold( toolBar: new ToolBar( diff --git a/examples/material_gallery/lib/demo/progress_indicator_demo.dart b/examples/material_gallery/lib/demo/progress_indicator_demo.dart index d6701b99f0..96c8998754 100644 --- a/examples/material_gallery/lib/demo/progress_indicator_demo.dart +++ b/examples/material_gallery/lib/demo/progress_indicator_demo.dart @@ -85,7 +85,7 @@ class _ProgressIndicatorDemoState extends State { return new Scaffold( toolBar: new ToolBar(center: new Text('Progress Indicators')), body: new DefaultTextStyle( - style: Theme.of(context).text.title, + style: Theme.of(context).textTheme.title, child: new GestureDetector( onTap: _handleTap, behavior: HitTestBehavior.opaque, diff --git a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart index 840e5da516..af5061ace5 100644 --- a/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart +++ b/examples/material_gallery/lib/demo/scrolling_techniques_demo.dart @@ -26,7 +26,7 @@ class _BarGraphic extends StatelessComponent { padding: const EdgeDims.symmetric(horizontal: 16.0), decoration: new BoxDecoration(backgroundColor: color), child: new DefaultTextStyle( - style: Theme.of(context).text.body1.copyWith(color: Colors.white), + style: Theme.of(context).textTheme.body1.copyWith(color: Colors.white), child: new Row( justifyContent: FlexJustifyContent.spaceBetween, children: [ @@ -120,7 +120,7 @@ class ScrollingTechniquesDemo extends StatelessComponent { children: [ new Padding( padding: const EdgeDims.symmetric(horizontal: 16.0, vertical: 32.0), - child: new Text(_introText, style: Theme.of(context).text.caption) + child: new Text(_introText, style: Theme.of(context).textTheme.caption) ), new _TechniqueItem( builder: (BuildContext context) => new FlexibleSpaceDemo(), diff --git a/examples/material_gallery/lib/demo/tabs_fab_demo.dart b/examples/material_gallery/lib/demo/tabs_fab_demo.dart index 1f13eddab6..e75545b935 100644 --- a/examples/material_gallery/lib/demo/tabs_fab_demo.dart +++ b/examples/material_gallery/lib/demo/tabs_fab_demo.dart @@ -60,7 +60,7 @@ class _TabsFabDemoState extends State { ), child: new Padding( padding: const EdgeDims.all(32.0), - child: new Text(_explanatoryText, style: Theme.of(context).text.subhead) + child: new Text(_explanatoryText, style: Theme.of(context).textTheme.subhead) ) ); }); diff --git a/examples/material_gallery/lib/demo/tooltip_demo.dart b/examples/material_gallery/lib/demo/tooltip_demo.dart index b79fa9ef7a..4308df065b 100644 --- a/examples/material_gallery/lib/demo/tooltip_demo.dart +++ b/examples/material_gallery/lib/demo/tooltip_demo.dart @@ -21,10 +21,10 @@ class TooltipDemo extends StatelessComponent { return new Column( alignItems: FlexAlignItems.stretch, children: [ - new Text(_introText, style: theme.text.subhead), + new Text(_introText, style: theme.textTheme.subhead), new Row( children: [ - new Text('Long press the ', style: theme.text.subhead), + new Text('Long press the ', style: theme.textTheme.subhead), new Tooltip( message: 'call icon', child: new Icon( @@ -33,7 +33,7 @@ class TooltipDemo extends StatelessComponent { color: theme.primaryColor ) ), - new Text(' icon', style: theme.text.subhead) + new Text(' icon', style: theme.textTheme.subhead) ] ), new Center( diff --git a/examples/material_gallery/lib/demo/typography_demo.dart b/examples/material_gallery/lib/demo/typography_demo.dart index f884400d15..3d89d69add 100644 --- a/examples/material_gallery/lib/demo/typography_demo.dart +++ b/examples/material_gallery/lib/demo/typography_demo.dart @@ -18,7 +18,7 @@ class TextStyleItem extends StatelessComponent { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle nameStyle = theme.text.body1.copyWith(color: theme.text.caption.color); + final TextStyle nameStyle = theme.textTheme.body1.copyWith(color: theme.textTheme.caption.color); return new Padding( padding: const EdgeDims.symmetric(horizontal: 8.0, vertical: 16.0), child: new Row( @@ -39,7 +39,7 @@ class TextStyleItem extends StatelessComponent { class TypographyDemo extends StatelessComponent { Widget build(BuildContext context) { - final TextTheme textTheme = Theme.of(context).text; + final TextTheme textTheme = Theme.of(context).textTheme; final List styleItems = [ new TextStyleItem(name: 'display3', style: textTheme.display3, text: 'Regular 56sp'), new TextStyleItem(name: 'display2', style: textTheme.display2, text: 'Regular 45sp'), diff --git a/examples/material_gallery/lib/gallery/section.dart b/examples/material_gallery/lib/gallery/section.dart index e9cd9b8fb6..01d9b7144e 100644 --- a/examples/material_gallery/lib/gallery/section.dart +++ b/examples/material_gallery/lib/gallery/section.dart @@ -66,7 +66,7 @@ class GallerySection extends StatelessComponent { brightness: Theme.of(context).brightness, primarySwatch: colors ); - final TextStyle titleTextStyle = theme.text.title.copyWith( + final TextStyle titleTextStyle = theme.textTheme.title.copyWith( color: Colors.white ); return new Flexible( diff --git a/examples/stocks/lib/stock_symbol_viewer.dart b/examples/stocks/lib/stock_symbol_viewer.dart index 308247da34..87d0d0858f 100644 --- a/examples/stocks/lib/stock_symbol_viewer.dart +++ b/examples/stocks/lib/stock_symbol_viewer.dart @@ -19,7 +19,7 @@ class StockSymbolView extends StatelessComponent { if (stock.percentChange > 0) changeInPrice = "+" + changeInPrice; - TextStyle headings = Theme.of(context).text.body2; + TextStyle headings = Theme.of(context).textTheme.body2; return new Container( padding: new EdgeDims.all(20.0), child: new Column( @@ -28,7 +28,7 @@ class StockSymbolView extends StatelessComponent { children: [ new Text( '${stock.symbol}', - style: Theme.of(context).text.display2 + style: Theme.of(context).textTheme.display2 ), new Hero( key: new ObjectKey(stock), diff --git a/packages/flutter/lib/src/material/button.dart b/packages/flutter/lib/src/material/button.dart index 0883e9a6aa..658c028299 100644 --- a/packages/flutter/lib/src/material/button.dart +++ b/packages/flutter/lib/src/material/button.dart @@ -123,7 +123,7 @@ abstract class MaterialButtonState extends State { ) ) ); - TextStyle style = Theme.of(context).text.button.copyWith(color: getTextColor(context)); + TextStyle style = Theme.of(context).textTheme.button.copyWith(color: getTextColor(context)); int elevation = this.elevation; Color color = getColor(context); if (elevation > 0 || color != null) { diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart index d12a625399..cfd3096448 100644 --- a/packages/flutter/lib/src/material/date_picker.dart +++ b/packages/flutter/lib/src/material/date_picker.dart @@ -183,7 +183,7 @@ class DayPicker extends StatelessComponent { Widget build(BuildContext context) { ThemeData themeData = Theme.of(context); - TextStyle headerStyle = themeData.text.caption.copyWith(fontWeight: FontWeight.w700); + TextStyle headerStyle = themeData.textTheme.caption.copyWith(fontWeight: FontWeight.w700); TextStyle monthStyle = headerStyle.copyWith(fontSize: 14.0, height: 24.0 / 14.0); TextStyle dayStyle = headerStyle.copyWith(fontWeight: FontWeight.w500); DateFormat dateFormat = new DateFormat(); @@ -376,7 +376,7 @@ class _YearPickerState extends State { static const double _itemExtent = 50.0; List buildItems(BuildContext context, int start, int count) { - TextStyle style = Theme.of(context).text.body1.copyWith(color: Colors.black54); + TextStyle style = Theme.of(context).textTheme.body1.copyWith(color: Colors.black54); List items = new List(); for (int i = start; i < start + count; i++) { int year = config.firstDate.year + i; diff --git a/packages/flutter/lib/src/material/dialog.dart b/packages/flutter/lib/src/material/dialog.dart index 197fa44972..e5cc21abb2 100644 --- a/packages/flutter/lib/src/material/dialog.dart +++ b/packages/flutter/lib/src/material/dialog.dart @@ -65,7 +65,7 @@ class Dialog extends StatelessComponent { dialogBody.add(new Padding( padding: padding, child: new DefaultTextStyle( - style: Theme.of(context).text.title, + style: Theme.of(context).textTheme.title, child: title ) )); @@ -78,7 +78,7 @@ class Dialog extends StatelessComponent { dialogBody.add(new Padding( padding: padding, child: new DefaultTextStyle( - style: Theme.of(context).text.subhead, + style: Theme.of(context).textTheme.subhead, child: content ) )); diff --git a/packages/flutter/lib/src/material/drawer_header.dart b/packages/flutter/lib/src/material/drawer_header.dart index bb265dbb2a..dc98eedc54 100644 --- a/packages/flutter/lib/src/material/drawer_header.dart +++ b/packages/flutter/lib/src/material/drawer_header.dart @@ -38,7 +38,7 @@ class DrawerHeader extends StatelessComponent { new Container( padding: const EdgeDims.symmetric(horizontal: 16.0), child: new DefaultTextStyle( - style: Theme.of(context).text.body2, + style: Theme.of(context).textTheme.body2, child: child ) ) diff --git a/packages/flutter/lib/src/material/drawer_item.dart b/packages/flutter/lib/src/material/drawer_item.dart index 8f91ce7ca4..ce79800a8d 100644 --- a/packages/flutter/lib/src/material/drawer_item.dart +++ b/packages/flutter/lib/src/material/drawer_item.dart @@ -43,7 +43,7 @@ class DrawerItem extends StatelessComponent { } TextStyle _getTextStyle(ThemeData themeData) { - TextStyle result = themeData.text.body2; + TextStyle result = themeData.textTheme.body2; if (selected) { switch (themeData.brightness) { case ThemeBrightness.light: diff --git a/packages/flutter/lib/src/material/dropdown.dart b/packages/flutter/lib/src/material/dropdown.dart index 82c3b8d3c9..fc3a58c665 100644 --- a/packages/flutter/lib/src/material/dropdown.dart +++ b/packages/flutter/lib/src/material/dropdown.dart @@ -212,7 +212,7 @@ class DropDownMenuItem extends StatelessComponent { height: _kMenuItemHeight, padding: const EdgeDims.only(left: 8.0, right: 8.0, top: 6.0), child: new DefaultTextStyle( - style: Theme.of(context).text.subhead, + style: Theme.of(context).textTheme.subhead, child: new Baseline( baseline: _kMenuItemHeight - _kBaselineOffsetFromBottom, child: child diff --git a/packages/flutter/lib/src/material/input.dart b/packages/flutter/lib/src/material/input.dart index a176e058fe..d22cfb6695 100644 --- a/packages/flutter/lib/src/material/input.dart +++ b/packages/flutter/lib/src/material/input.dart @@ -84,7 +84,7 @@ class _InputState extends State { BuildContext focusContext = focusKey.currentContext; bool focused = focusContext != null && Focus.at(focusContext, autofocus: config.autofocus); - TextStyle textStyle = config.style ?? themeData.text.subhead; + TextStyle textStyle = config.style ?? themeData.textTheme.subhead; Color activeColor = themeData.hintColor; if (focused) { switch (themeData.brightness) { @@ -104,10 +104,10 @@ class _InputState extends State { if (config.labelText != null) { TextStyle labelStyle = hasInlineLabel ? - themeData.text.subhead.copyWith(color: themeData.hintColor) : - themeData.text.caption.copyWith(color: activeColor); + themeData.textTheme.subhead.copyWith(color: themeData.hintColor) : + themeData.textTheme.caption.copyWith(color: activeColor); - double topPaddingIncrement = themeData.text.caption.fontSize + (config.isDense ? 4.0 : 8.0); + double topPaddingIncrement = themeData.textTheme.caption.fontSize + (config.isDense ? 4.0 : 8.0); double top = topPadding; if (hasInlineLabel) top += topPaddingIncrement + textStyle.fontSize - labelStyle.fontSize; @@ -124,7 +124,7 @@ class _InputState extends State { } if (config.hintText != null && config.value.text.isEmpty && !hasInlineLabel) { - TextStyle hintStyle = themeData.text.subhead.copyWith(color: themeData.hintColor); + TextStyle hintStyle = themeData.textTheme.subhead.copyWith(color: themeData.hintColor); stackChildren.add(new Positioned( left: 0.0, top: topPadding + textStyle.fontSize - hintStyle.fontSize, @@ -174,7 +174,7 @@ class _InputState extends State { )); if (config.errorText != null && !config.isDense) { - TextStyle errorStyle = themeData.text.caption.copyWith(color: themeData.errorColor); + TextStyle errorStyle = themeData.textTheme.caption.copyWith(color: themeData.errorColor); stackChildren.add(new Positioned( left: 0.0, bottom: 0.0, diff --git a/packages/flutter/lib/src/material/list_item.dart b/packages/flutter/lib/src/material/list_item.dart index f3ec9f23f8..43043d578e 100644 --- a/packages/flutter/lib/src/material/list_item.dart +++ b/packages/flutter/lib/src/material/list_item.dart @@ -69,7 +69,7 @@ class ListItem extends StatelessComponent { TextStyle primaryTextStyle(BuildContext context) { final ThemeData theme = Theme.of(context); - final TextStyle style = theme.text.subhead; + final TextStyle style = theme.textTheme.subhead; if (!enabled) { final Color color = theme.disabledColor; return dense ? style.copyWith(fontSize: 13.0, color: color) : style.copyWith(color: color); @@ -79,8 +79,8 @@ class ListItem extends StatelessComponent { TextStyle secondaryTextStyle(BuildContext context) { final ThemeData theme = Theme.of(context); - final Color color = theme.text.caption.color; - final TextStyle style = theme.text.body1; + final Color color = theme.textTheme.caption.color; + final TextStyle style = theme.textTheme.body1; return dense ? style.copyWith(color: color, fontSize: 12.0) : style.copyWith(color: color); } diff --git a/packages/flutter/lib/src/material/material.dart b/packages/flutter/lib/src/material/material.dart index 4956be5708..45378882cd 100644 --- a/packages/flutter/lib/src/material/material.dart +++ b/packages/flutter/lib/src/material/material.dart @@ -130,7 +130,7 @@ class _MaterialState extends State { Widget contents = config.child; if (contents != null) { contents = new DefaultTextStyle( - style: config.textStyle ?? Theme.of(context).text.body1, + style: config.textStyle ?? Theme.of(context).textTheme.body1, child: contents ); } diff --git a/packages/flutter/lib/src/material/popup_menu.dart b/packages/flutter/lib/src/material/popup_menu.dart index 5ba198dbe0..1ed6293537 100644 --- a/packages/flutter/lib/src/material/popup_menu.dart +++ b/packages/flutter/lib/src/material/popup_menu.dart @@ -75,7 +75,7 @@ class _PopupMenuItemState> extends State { Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - TextStyle style = theme.text.subhead; + TextStyle style = theme.textTheme.subhead; if (!config.enabled) style = style.copyWith(color: theme.disabledColor); diff --git a/packages/flutter/lib/src/material/snack_bar.dart b/packages/flutter/lib/src/material/snack_bar.dart index 20cde5bd9a..19033fe16a 100644 --- a/packages/flutter/lib/src/material/snack_bar.dart +++ b/packages/flutter/lib/src/material/snack_bar.dart @@ -126,7 +126,7 @@ class SnackBar extends StatelessComponent { brightness: ThemeBrightness.dark, accentColor: theme.accentColor, accentColorBrightness: theme.accentColorBrightness, - text: Typography.white + textTheme: Typography.white ), child: new FadeTransition( opacity: fadeAnimation, diff --git a/packages/flutter/lib/src/material/theme_data.dart b/packages/flutter/lib/src/material/theme_data.dart index 139037e626..6490dd1163 100644 --- a/packages/flutter/lib/src/material/theme_data.dart +++ b/packages/flutter/lib/src/material/theme_data.dart @@ -52,7 +52,7 @@ class ThemeData { Color hintColor, double hintOpacity, Color errorColor, - TextTheme text, + TextTheme textTheme, TextTheme primaryTextTheme, IconThemeData primaryIconTheme }) { @@ -77,7 +77,7 @@ class ThemeData { hintColor ??= isDark ? const Color(0x42FFFFFF) : const Color(0x4C000000); hintOpacity ??= hintColor != null ? hintColor.alpha / 0xFF : isDark ? 0.26 : 0.30; errorColor ??= Colors.red[700]; - text ??= isDark ? Typography.white : Typography.black; + textTheme ??= isDark ? Typography.white : Typography.black; primaryTextTheme ??= primaryColorBrightness == ThemeBrightness.dark ? Typography.white : Typography.black; primaryIconTheme ??= primaryColorBrightness == ThemeBrightness.dark ? const IconThemeData(color: Colors.white) : const IconThemeData(color: Colors.black); return new ThemeData.raw( @@ -100,7 +100,7 @@ class ThemeData { hintColor: hintColor, hintOpacity: hintOpacity, errorColor: errorColor, - text: text, + textTheme: textTheme, primaryTextTheme: primaryTextTheme, primaryIconTheme: primaryIconTheme ); @@ -126,7 +126,7 @@ class ThemeData { this.hintColor, this.hintOpacity, this.errorColor, - this.text, + this.textTheme, this.primaryTextTheme, this.primaryIconTheme }) { @@ -149,7 +149,7 @@ class ThemeData { assert(hintColor != null); assert(hintOpacity != null); assert(errorColor != null); - assert(text != null); + assert(textTheme != null); assert(primaryTextTheme != null); assert(primaryIconTheme != null); } @@ -207,7 +207,7 @@ class ThemeData { final Color errorColor; /// Text with a color that contrasts with the card and canvas colors. - final TextTheme text; + final TextTheme textTheme; /// A text theme that contrasts with the primary color. final TextTheme primaryTextTheme; @@ -235,7 +235,7 @@ class ThemeData { hintColor: Color.lerp(begin.hintColor, end.hintColor, t), hintOpacity: lerpDouble(begin.hintOpacity, end.hintOpacity, t), errorColor: Color.lerp(begin.errorColor, end.errorColor, t), - text: TextTheme.lerp(begin.text, end.text, t), + textTheme: TextTheme.lerp(begin.textTheme, end.textTheme, t), primaryTextTheme: TextTheme.lerp(begin.primaryTextTheme, end.primaryTextTheme, t), primaryIconTheme: IconThemeData.lerp(begin.primaryIconTheme, end.primaryIconTheme, t) ); @@ -264,7 +264,7 @@ class ThemeData { (otherData.hintColor == hintColor) && (otherData.hintOpacity == hintOpacity) && (otherData.errorColor == errorColor) && - (otherData.text == text) && + (otherData.textTheme == textTheme) && (otherData.primaryTextTheme == primaryTextTheme) && (otherData.primaryIconTheme == primaryIconTheme); } @@ -290,7 +290,7 @@ class ThemeData { hintColor, hintOpacity, errorColor, - text, + textTheme, primaryTextTheme, primaryIconTheme ) diff --git a/packages/flutter/lib/src/material/tooltip.dart b/packages/flutter/lib/src/material/tooltip.dart index 66292f64db..0de294b0d3 100644 --- a/packages/flutter/lib/src/material/tooltip.dart +++ b/packages/flutter/lib/src/material/tooltip.dart @@ -132,7 +132,7 @@ class _TooltipState extends State { RenderBox box = context.findRenderObject(); Point target = box.localToGlobal(box.size.center(Point.origin)); _entry = new OverlayEntry(builder: (BuildContext context) { - TextStyle textStyle = (config.style ?? Theme.of(context).text.body1).copyWith(color: config.textColor ?? Colors.white); + TextStyle textStyle = (config.style ?? Theme.of(context).textTheme.body1).copyWith(color: config.textColor ?? Colors.white); return new _TooltipOverlay( message: config.message, backgroundColor: config.backgroundColor ?? Colors.grey[700], diff --git a/packages/flutter/lib/src/material/two_level_list.dart b/packages/flutter/lib/src/material/two_level_list.dart index 104521db42..068b0f8722 100644 --- a/packages/flutter/lib/src/material/two_level_list.dart +++ b/packages/flutter/lib/src/material/two_level_list.dart @@ -110,7 +110,7 @@ class _TwoLevelSublistState extends State { onTap: _handleOnTap, left: config.left, center: new DefaultTextStyle( - style: Theme.of(context).text.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)), + style: Theme.of(context).textTheme.subhead.copyWith(color: _headerColor.evaluate(_easeInAnimation)), child: config.center ), right: new RotationTransition( @@ -136,7 +136,7 @@ class _TwoLevelSublistState extends State { final ThemeData theme = Theme.of(context); _borderColor.end = theme.dividerColor; _headerColor - ..begin = theme.text.subhead.color + ..begin = theme.textTheme.subhead.color ..end = theme.accentColor; _iconColor ..begin = theme.unselectedColor diff --git a/packages/flutter_markdown/lib/src/markdown_style.dart b/packages/flutter_markdown/lib/src/markdown_style.dart index d71afce174..b2281b68c0 100644 --- a/packages/flutter_markdown/lib/src/markdown_style.dart +++ b/packages/flutter_markdown/lib/src/markdown_style.dart @@ -12,21 +12,21 @@ class MarkdownStyle extends MarkdownStyleRaw{ /// Creates a [MarkdownStyle] from the [TextStyle]s in the provided [theme]. MarkdownStyle.defaultFromTheme(ThemeData theme) : super( a: new TextStyle(color: Colors.blue[500]), - p: theme.text.body1, + p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey[700], fontFamily: "monospace", - fontSize: theme.text.body1.fontSize * 0.85 + fontSize: theme.textTheme.body1.fontSize * 0.85 ), - h1: theme.text.headline, - h2: theme.text.title, - h3: theme.text.subhead, - h4: theme.text.body2, - h5: theme.text.body2, - h6: theme.text.body2, + h1: theme.textTheme.headline, + h2: theme.textTheme.title, + h3: theme.textTheme.subhead, + h4: theme.textTheme.body2, + h5: theme.textTheme.body2, + h6: theme.textTheme.body2, em: new TextStyle(fontStyle: FontStyle.italic), strong: new TextStyle(fontWeight: FontWeight.bold), - blockquote: theme.text.body1, + blockquote: theme.textTheme.body1, blockSpacing: 8.0, listIndent: 32.0, blockquotePadding: 8.0, @@ -46,21 +46,21 @@ class MarkdownStyle extends MarkdownStyleRaw{ /// [MarkdownStyle.defaultFromTheme]. MarkdownStyle.largeFromTheme(ThemeData theme) : super ( a: new TextStyle(color: Colors.blue[500]), - p: theme.text.body1, + p: theme.textTheme.body1, code: new TextStyle( color: Colors.grey[700], fontFamily: "monospace", - fontSize: theme.text.body1.fontSize * 0.85 + fontSize: theme.textTheme.body1.fontSize * 0.85 ), - h1: theme.text.display3, - h2: theme.text.display2, - h3: theme.text.display1, - h4: theme.text.headline, - h5: theme.text.title, - h6: theme.text.subhead, + h1: theme.textTheme.display3, + h2: theme.textTheme.display2, + h3: theme.textTheme.display1, + h4: theme.textTheme.headline, + h5: theme.textTheme.title, + h6: theme.textTheme.subhead, em: new TextStyle(fontStyle: FontStyle.italic), strong: new TextStyle(fontWeight: FontWeight.bold), - blockquote: theme.text.body1, + blockquote: theme.textTheme.body1, blockSpacing: 8.0, listIndent: 32.0, blockquotePadding: 8.0,