主页归档友联关于我Flutter2020-12-08Flutter开发Linux程序中文乱码解决 盲猜由于字体缺失导致乱码,于是我把字体加过去 下载微软雅黑字体,也可以直接从 Windows 里复制一个 pubspec.yaml 配置12345flutter: fonts: - family: cn fonts: - asset: fonts/msyh.ttc main.dart 配置12345678910111213141516171819void main() { runApp(MyApp());}class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', debugShowCheckedModeBanner: false, theme: ThemeData( primarySwatch: Colors.blue, // 配置字体 fontFamily: 'cn' ), home: HomePage(), ); }}