My app theme fontFamily is not changing anything. If I input it in a Text widget, it works like it should.
My pubspec.yaml is set up like this
fonts:
- family: Gilroy
fonts:
- asset: fonts/Gilroy-Light.otf
- asset: fonts/Gilroy-ExtraBold.otf
weight: 700
And my MaterialApp is
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(
const MyApp(),
);
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => MediaManager()),
],
child: StreamProvider<User?>.value(
value: Authentication().userStream,
initialData: null,
child: MaterialApp(
title: 'MyApp',
theme: ThemeData(
fontFamily: 'Gilroy',
scaffoldBackgroundColor: Colors.black,
textTheme: Theme.of(context).textTheme.apply(
bodyColor: Colors.white,
displayColor: Colors.white,
),
),
I tried to flutter clean
, uninstalling the app, restarting the emulator and I don't have another MaterialApp
set up. Text("Hello World", style: TextStyle(fontFamily: "Gilroy")
works fine and there are no errors generated.
CodePudding user response:
textTheme: Theme.of(context).textTheme.apply(
fontFamily: fontFamily,
bodyColor: Colors.white,
displayColor: Colors.white,
),