【发布时间】:2020-03-11 12:44:47
【问题描述】:
这是我当前的 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,
),
),
)
);
}
}
【问题讨论】:
-
@RavinderKumar 我对 StackOverFlow 还是很陌生。我不知道为什么它不被接受。
-
@RavinderKumar 但是您的代码有效,无论如何我再次接受了您的回答。顺便谢谢!
-
不客气:)