I am curently learning Flutter on the Maximilian Udemy Course, and when I reached the section when I have to use the textTheme property of the AppBarTheme class, it's telling me that it's deprecated. What should I replace it with. Here is what im trying to do:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Personal Expenses',
theme: ThemeData(
primarySwatch: Colors.purple,
accentColor: Colors.amber,
fontFamily: 'Quicksand',
appBarTheme: AppBarTheme(
textTheme: ThemeData.light().textTheme.copyWith(
headline6: TextStyle(
fontFamily: 'OpenSans',
fontSize: 20,
),
),
),
),
home: MyHomePage(),
);
}
}
Use colorScheme
instead of accentColor
and titleTextStyle
and toolbarTextStyle
instead of textTheme
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: Colors.amber,
),
theme: ThemeData(
primarySwatch: Colors.purple,
colorScheme: Theme.of(context).colorScheme.copyWith(
secondary: Colors.amber,
),
fontFamily: 'Quicksand',
appBarTheme: AppBarTheme(
titleTextStyle: TextStyle(),
toolbarTextStyle: TextStyle(),
),
),
home: MyHomePage(),
More about using themes