公司开发,app使用时,系统设置字体样式,app内跟着变化,样式变乱的解决方法。
来啰来啰!
话不多说,上代码
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Container(color: Colors.white),
builder: (context, widget) {
return MediaQuery(
//设置文字大小不随系统设置改变
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: widget,
);
},
);
}
旨在分享