flutter - Flutter:如何更改 Appbar 文本的字体?
问题描述
这是我当前的 main.dart 代码。我尝试将'主题:ThemeData(fontFamily:'Bebas Neue Regular')'放在标题下:Text('SMARTID'),因为我想更改为SMARTID的Appbar文本,但它似乎不起作用。
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
debugShowCheckedModeBanner: false,
));
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Smart ID',
home: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/background.png"), fit: BoxFit.cover)),
child: Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0,
backgroundColor: Color(0xff05B068),
title: Text('SMARTID'),
theme: ThemeData(fontFamily: 'Bebas Neue Regular'),
centerTitle: true,
),
),
)
);
}
}
解决方案
推荐阅读
- excel - 用在不同单元格中找到的数据替换单元格
- c++ - MSVC 是否有任何解决方法为此代码产生“内部编译器错误”?
- c# - 带有 Winform 的 Cefsharp:当用户将焦点更改到另一个节点时,永远不会调用 OnFocusedNodeChanged
- reactjs - 反应输入清除占位符
- c - C中变量声明和定义之间的区别。内存何时分配?
- python - 如何使用 NLP 和实体识别从文本中正确提取设施和设施等实体?
- layout - Google 页面速度洞察和 CLS
- sql - 蜂巢查询中“”处缺少 EOF“”
- git - 如何通过自动代码样式更改查看合并请求?
- java - 删除图像后 PDFBox 错误 - 此页面存在错误。Acrobat 可能无法正确显示页面