I want to make my flutter application responsive, and using navigation which is responsive [beamer] works on both web & mobile
how Widget tree is looking
- MaterialApp
- ScreenUtils
- MaterialApp
problem I am facing is mediaquery requires materialApp widget above please check below code Responsive.isDesktop(context) = MediaQuery checks
class Layer extends StatelessWidget {
Layer({Key? key}) : super(key: key);
final routerDelegate = BeamerDelegate(
locationBuilder: RoutesLocationBuilder(
routes: {
// Return either Widgets or BeamPages if more customization is needed
'/': (context, state, data) => Onboarding(),
'/auth': (context, state, data) => const BeamPage(
popToNamed: '/',
type: BeamPageType.slideRightTransition,
child: Authentication(),
),
'/home': (context, state, data) => const BeamPage(
popToNamed: '/',
type: BeamPageType.scaleTransition,
child: Home(),
),
),
);
responsiveChecks(context) {
if (Responsive.isDesktop(context) == true) {
return const Size(1440, 1024);
} else if (Responsive.isTablet(context) == true) {
return const Size(1024, 1366);
} else {
return const Size(360, 800);
}
}
Size size = Size(1440, 1024);
@override
Widget build(BuildContext context) {
return Material(
child: ScreenUtilInit(
minTextAdapt: true,
designSize: responsiveChecks(context),
builder: (BuildContext context, child) => AdaptiveTheme(
initial: AdaptiveThemeMode.light,
builder: (theme, darkTheme) => MaterialApp.router(
debugShowMaterialGrid: false,
debugShowCheckedModeBanner: false,
supportedLocales: Localization.localizations.toLocaleList(),
title: 'Jewellery Store',
theme: theme,
routeInformationParser: BeamerParser(),
routerDelegate: routerDelegate,
useInheritedMediaQuery: true,
builder: (BuildContext context, a){
return Home();
},
),
),
),
);
}
}