Flutter屏幕适配方案 / Flutter screen adaptation solution
Import package
flutter_screen_adapter:
git:
url: [email protected]:hwh97/flutter_screen_adapter.git
Add builder to MaterialApp
MaterialApp(
builder: (context, child) => screenAdapterBuilder(
child: child,
designSize: const Size(375, 812),
tabletDesignSize: const Size(768, 1024),
),
)
This plugin uses width >= 550 to get tablet or not. Feel free to pr if you have a better way.