造成原因:苹果手机用户把字体设置成小号字体
关键代码
MediaQuery.of(context).copyWith(textScaleFactor: 1.0, boldText: false)
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
brightness: Brightness.light,
primaryColorBrightness:Brightness.light,
textTheme: TextTheme(display1: TextStyle(fontSize: 30)),
fontFamily: "PingFang SC",
primaryColor: Color(0xfff9f9f9),
),
// home: LoginInfoController(),
home: SplashPage(),
//加上下面这段代码
builder: (BuildContext context, Widget child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0, boldText: false),
child: child
);
},
);
文章讲述了如何在Flutter应用中通过MediaQuery.of(context).copyWith(textScaleFactor:1.0,boldText:false)代码来设置苹果手机用户的字体为小号,同时在MaterialApp中配置TextTheme以影响应用的文本样式。
2529

被折叠的 条评论
为什么被折叠?



