我正在尝试设置我的字体MaterialApp。由于我使用的是深色主题,我想只使用copyWith然后更改fontFamily. 但是,copyWith没有更改fontFamily.
MaterialApp(
theme: ThemeData.dark().copyWith(
fontFamily: 'MyFontFamily',
),
Run Code Online (Sandbox Code Playgroud)
未定义命名参数“fontFamily”。
如何保留深色主题并更改字体系列?(同样的问题ThemeData.light()。)
我找到了解决方案并在下面发布。