Im trying to set textTheme
on Text using style
parameter of Text()
like below:
Text('Hello Flutter',style: Theme.of(context).textTheme.bodyMedium)
but it is not working and this is the result:
but when i don't set style
it will work:
The problem is, i want to set bodyMedium
on my Text(style: )
but it did not work.
This is the whole code:
Widget build(BuildContext context) {
final TextStyle defaultTextStyle = TextStyle(fontFamily: 'IranYekan');
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
textTheme: TextTheme(
bodyMedium: defaultTextStyle.copyWith(fontWeight: FontWeight.w900, fontSize: 50),
bodySmall: defaultTextStyle.copyWith(fontSize: 40),
),
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: Scaffold(
body: Center(
child: Text('Hello Flutter',style: Theme.of(context).textTheme.bodyMedium)),
),
),
);
}
What is the problem? how can i solve this?