我为我的应用程序创建了以下主题:
ThemeData _buildDarkTheme() {
final baseTheme = ThemeData(fontFamily: "Sunflower",);
return baseTheme.copyWith(
brightness: Brightness.dark,
primaryColor: Colors.grey[800],
accentColor: Colors.grey[850]);
}
然后,我将其应用于我的应用程序,如下所示:
class MyApp extends StatelessWidget {
MyApp({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return new MaterialApp(
theme: _buildDarkTheme(),
home: new Scaffold(
appBar: _buildAppBar(),
body: new Container(
color: Theme.of(context).accentColor,
height: double.infinity,
child: new ListView.builder(...
但是,当我try 访问容器内(或其他任何地方)的强调色而不是预期的Colors.Grey[850]时,它默认为蓝色.此外,try 使用自定义字体向日葵字体系列不起作用,但当我改用
new Text("Hello World", style: new TextStyle(fontFamily: "Sunflower"))
字体显示正确.
我是新来的Flutter Flutter 和dart ,所以任何帮助解决这些问题将不胜感激.