设置全局的字体样式和使用
1、在main入口文件定义好
theme: ThemeData(
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xff1a1a1a),
),
//primarySwatch: Colors.orange,
splashColor: Colors.transparent,
// 去掉点击选中的水波纹高亮效果
highlightColor: Colors.transparent,
canvasColor: const Color(0xff1a1a1a),
textTheme: TextTheme(
bodyMedium: TextStyle(
// fontFamily: 'Alimama FangYuanTi VF',
decoration: TextDecoration.none,
color: Colors.white,
fontWeight: FontWeight.w800
),
bodySmall: TextStyle(
// fontFamily: 'Alimama FangYuanTi VF',
decoration: TextDecoration.none,
color: Colors.white,
),
)
//colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
//useMaterial3: true,
),
2、在页面中使用
Text('《隐私政策》',style: Theme.of(context).textTheme.bodySmall,),