且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何设置特定容器中所有文本的颜色?

更新时间:2023-01-27 20:31:53

仅将某些 TextStyle 属性应用于应用程序的子树。您可以使用 DefaultTextStyle

To apply certain TextStyle properties only to a subtree of your app. You can use DefaultTextStyle

DefaultTextStyle(
  child: Container(child: /* your subtree */),
  style: TextStyle(color: Colors.red),
),