I'm trying to set the font size of the text in my app through the themeData using media Query.
eg. if screen size is smaller the x, font size should be x.
is this even possible to achieve? and if so, how would I go about it?
here is my MyApp code in my main.dart:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: Colors.black,
textTheme: TextTheme(
bodyText1: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'SourceSansPro',
),
),
),
debugShowCheckedModeBanner: false,
initialRoute: '/second',
routes: {
'/': (context) => pageone(),
'/first': (context) => pagetwo(),
'/second': (context) => pagethree(),
});
}
}
When I try and use var screenSize = MediaQuery.of(context).size; as a variable into MyApp, i'm getting an error on context.
thanks so much and any help would be greatly appreciated.