Open odejinmi opened 1 year ago
+1
If you're using MaterialApp directly, you can use the example in the ReadMe.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => ResponsiveBreakpoints.builder(
child: child!,
breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
],
),
initialRoute: "/",
);
}
}
If you are using MaterialApp.router()
, you can pass ResponsiveBreakpoints to the router's builder method.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerDelegate: NavigationManager.instance.routerDelegate,
routeInformationParser: NavigationManager.instance.routeInformationParser,
builder: (context, child) {
return ResponsiveBreakpoints.builder(child: child!, breakpoints: [
const Breakpoint(start: 0, end: 450, name: MOBILE),
const Breakpoint(start: 451, end: 800, name: TABLET),
const Breakpoint(start: 801, end: 1920, name: DESKTOP),
const Breakpoint(start: 1921, end: double.infinity, name: '4K'),
]);
},
);
}
}
If you're using MaterialApp directly, you can use the example in the ReadMe.
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( builder: (context, child) => ResponsiveBreakpoints.builder( child: child!, breakpoints: [ const Breakpoint(start: 0, end: 450, name: MOBILE), const Breakpoint(start: 451, end: 800, name: TABLET), const Breakpoint(start: 801, end: 1920, name: DESKTOP), const Breakpoint(start: 1921, end: double.infinity, name: '4K'), ], ), initialRoute: "/", ); } }
If you are using
MaterialApp.router()
, you can pass ResponsiveBreakpoints to the router's builder method.class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp.router( routerDelegate: NavigationManager.instance.routerDelegate, routeInformationParser: NavigationManager.instance.routeInformationParser, builder: (context, child) { return ResponsiveBreakpoints.builder(child: child!, breakpoints: [ const Breakpoint(start: 0, end: 450, name: MOBILE), const Breakpoint(start: 451, end: 800, name: TABLET), const Breakpoint(start: 801, end: 1920, name: DESKTOP), const Breakpoint(start: 1921, end: double.infinity, name: '4K'), ]); }, ); } }
not work
How can i use responsive_framework that will effect all my pages without using router method, i wanted to do everything direct from the materialapp