flutter - 不推荐使用 textTheme 颤动的警告
问题描述
我正在使用颤振 2.5。我编写了以下代码,这给了我不推荐使用的**textTheme**
属性警告。
return MaterialApp(
// home: homePage(),
themeMode: ThemeMode.light,
theme: ThemeData(
primarySwatch: Colors.purple,
fontFamily: GoogleFonts.lato().fontFamily,
appBarTheme: AppBarTheme(color: Colors.white,
elevation: 0,
iconTheme: IconThemeData(color: Colors.black),
textTheme: Theme.of(context).textTheme
)
),
darkTheme:
ThemeData(brightness: Brightness.dark, primarySwatch: Colors.red),
debugShowCheckedModeBanner: false,
initialRoute: MyRoutes.homeRoutes,
routes: {
"/": (context) => LoginPage(),
MyRoutes.homeRoutes: (context) => homePage(),
MyRoutes.loginRoutes: (context) => LoginPage(),
},
);
解决方案
在 Flutter 1.13.8 中,TextTheme 的某些属性已被弃用并更改为另一个名称。也许您正在使用旧的文本样式属性:
您可以在此处找到新属性的列表
推荐阅读
- java - Java嵌套类:从外部类实例化内部类
- django - django 管理员不发送 html 电子邮件,而是使用纯文本格式
- javascript - 在“公共”文件夹中找不到到“js”的路由...使用“视图”?
- excel - 根据规定的标题列表(Excel-VBA)的条件格式/测试标题
- android - 如何在 kotlin 中添加有关令牌已过期的代码?
- visual-studio - 将 TFS 工作区移动到新机器
- r - R中的负向后正则表达式
- javascript - 如何使用 d3.js 通过鼠标悬停显示 XY 图表的 x 和 y 坐标
- python - Pytorch RuntimeError:张量a(4)的大小必须与非单维0的张量b(3)的大小相匹配
- python - 在 Python 中使用 lxml 针对 Schematron 验证带有命名空间的 XML