admin管理员组文章数量:1404922
i wanna use custom textTheme inside the ThemeData but this custom text will not be apply to all Text widget for instance : Text inside the ListTile will get style from inherit Widget which is not what i wanna , and also i don't wannt to restyle my ListTile but how to make the custom textTheme apply all the Text inside the app without any calling Theme.of(context).textTheme.bodyMedium,
textTheme: const TextTheme(
bodyMedium: TextStyle(fontSize: 14.0, color: Colors.red),
),
in below example
Column(
children: [
ListTile(
trailing: Icon(Icons.more_vert),
title: const Text('You have pushed the button this many times:'),
),
const Text('You have pushed the button this many times:'),
Icon(Icons.more_vert),
],
),
in this code only the plain text will get the red color but inside the ListTile i have to call the Theme.of(context).textTheme.bodyMedium, property to ListTile get the effect from the textTheme is there any solution to implement effect to entire Text in the app ?? i don't want to call theme property and i don't wanna use DefaultTextStyle
i wanna use custom textTheme inside the ThemeData but this custom text will not be apply to all Text widget for instance : Text inside the ListTile will get style from inherit Widget which is not what i wanna , and also i don't wannt to restyle my ListTile but how to make the custom textTheme apply all the Text inside the app without any calling Theme.of(context).textTheme.bodyMedium,
textTheme: const TextTheme(
bodyMedium: TextStyle(fontSize: 14.0, color: Colors.red),
),
in below example
Column(
children: [
ListTile(
trailing: Icon(Icons.more_vert),
title: const Text('You have pushed the button this many times:'),
),
const Text('You have pushed the button this many times:'),
Icon(Icons.more_vert),
],
),
in this code only the plain text will get the red color but inside the ListTile i have to call the Theme.of(context).textTheme.bodyMedium, property to ListTile get the effect from the textTheme is there any solution to implement effect to entire Text in the app ?? i don't want to call theme property and i don't wanna use DefaultTextStyle
Share Improve this question asked Mar 9 at 6:11 rebaz jabarrebaz jabar 71 silver badge3 bronze badges2 Answers
Reset to default 1ListTile
's title text uses TextTheme.bodyLarge
or TextTheme.titleMedium
by default. But you only customized TextTheme.bodyMedium
. To customize all the Texts in the app, you should set all the properties in TextTheme
.
You can find the default text style for ListTile
here.
ListTile.titleTextStyle
ListTile.subtitleTextStyle
TextTheme cannot apply to all text widget cause text widget need a text style while textTheme contains multiple text style.
To change text style for all text in little, use listTileTheme. Use DefaultTextStyle widget to change the style of all defendant Text widget.
This tread throws more light on it.
本文标签: fluttertextTheme will not apply for all Text widgetStack Overflow
版权声明:本文标题:flutter - textTheme will not apply for all Text widget - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744876666a2629953.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论