iampawan / 30DaysOfFlutter

Learn Flutter in 30 Days
410 stars 324 forks source link

Please solve my Doubt #15

Open prabaljainn opened 3 years ago

prabaljainn commented 3 years ago

I am having problem in this file.

textTheme: Theme.of(context).textTheme,

can't understand this line

https://github.com/iampawan/30DaysOfFlutter/blob/02f7ca0a43705d89ef9836eebec74ece6e331d93/lib/widgets/themes.dart

TakshPanchal commented 3 years ago

@prabaljainn basically from this method Theme.of(context) you can get the theme if you have defined earlier on MaterialApp.

HafijurRahmanEjaro commented 2 years ago

getting this issue please help: The getter 'textTheme' isn't defined for the type 'BuildContext'. Try importing the library that defines 'textTheme', correcting the name to the name of an existing getter, or defining a getter or field named 'textTheme'.

textTheme: Theme.of(context).textTheme.copyWith( headline6: context.textTheme.headline6.copyWith(color: Colors.white), // on this line textTheme ), ));

MuhammadAliNadeem commented 1 year ago

Exception has occurred. LateError (LateInitializationError: Field '_catalog@26243600' has not been initialized.) any suggestions?

malik-vishu commented 1 year ago

getting this issue please help: The getter 'textTheme' isn't defined for the type 'BuildContext'. Try importing the library that defines 'textTheme', correcting the name to the name of an existing getter, or defining a getter or field named 'textTheme'.

textTheme: Theme.of(context).textTheme.copyWith( headline6: context.textTheme.headline6.copyWith(color: Colors.white), // on this line textTheme ), ));

I think it is because the textTheme property is removed from the AppBarTheme constructor in later versions of flutter