responsive_framework 0.1.9 responsive_framework: ^0.1.9 copied to clipboard
Easily make Flutter apps responsive. Automatically adapt UI to different screen sizes. Responsiveness made simple.
import 'package:flutter/material.dart';
import 'package:minimal/pages/pages.dart';
import 'package:minimal/routes.dart';
import 'package:responsive_framework/responsive_framework.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
builder: (context, child) => ResponsiveWrapper.builder(
BouncingScrollWrapper.builder(context, child!),
maxWidth: 1200,
minWidth: 450,
defaultScale: true,
breakpoints: [
const ResponsiveBreakpoint.resize(450, name: MOBILE),
const ResponsiveBreakpoint.autoScale(800, name: TABLET),
const ResponsiveBreakpoint.autoScale(1000, name: TABLET),
const ResponsiveBreakpoint.resize(1200, name: DESKTOP),
const ResponsiveBreakpoint.autoScale(2460, name: "4K"),
],
background: Container(color: const Color(0xFFF5F5F5))),
initialRoute: Routes.home,
onGenerateRoute: (RouteSettings settings) {
return Routes.fadeThrough(settings, (context) {
switch (settings.name) {
case Routes.home:
return const ListPage();
case Routes.post:
return const PostPage();
case Routes.style:
return const TypographyPage();
default:
return const SizedBox.shrink();
}
});
},
debugShowCheckedModeBanner: false,
);
}
}