april_flutter_screen_adapter

Last updated:

0 purchases

april_flutter_screen_adapter Image
april_flutter_screen_adapter Images
Add to Cart

Description:

april flutter screen adapter

Usage #

1、 Initialize by ScreenAdapter.

void main() {
// over here !!!
ScreenAdapter.ensureInitialized(designWidth: 400);
runApp(const MyApp());
}
copied to clipboard

2、Transform MediaQueryData by ScreenAdapter.

Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
// over here !!!
builder: ScreenAdapter.compatBuilder,
);
}
copied to clipboard
or
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
// over here !!!
builder: (context, child) => MediaQuery(
data: ScreenAdapter.compatMediaQueryData(context),
child: child ?? const SizedBox.shrink(),
),
);
}
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.