Here's my current code of my main.dart. I tried putting 'theme: ThemeData(fontFamily: 'Bebas Neue Regular')' under the title: Text('SMARTID'), as I want to change the Appbar text which is SMARTID, but it doesn't seem to work.
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,
),
),
)
);
}
}
Do it like,
appBar: AppBar(
elevation: 0,
backgroundColor: Color(0xff05B068),
title: Text('SMARTID',style: TextStyle(fontFamily: 'YOUR_FONT_FAMILY')),
centerTitle: true,
),
EDIT: Do not forget to create fonts folder like this image,
Then open your pubspec.yaml and declare fonts like this,
DO not forget to get packages
In addition, you also can declare the textStyle directly in your ThemeData, if you want to apply iny our entire app. Like this:
final ThemeData themeData = ThemeData(
...
appBarTheme: AppBarTheme(
titleTextStyle: TextStyle(
fontWeight: FontWeight.bold,
),
),
...
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With