You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| splitScreenMode | bool | false | support for split screen |
52
-
| minTextAdapt | bool | false | Whether to adapt the text according to the minimum of width and height |
53
-
| context | BuildContext | null | Get physical device data if not provided, by MediaQuery.of(context) |
54
-
| useInheritedMediaQuery | bool | false | Recommended use `false` avoid rebuild very frequently <br/><br/> ~~Set this to true for Flutter 3.10 to avoid keyboard overlay on TextField~~|
| designSize | Size | Size(360,690) | The size of the device screen in the design draft, in dp |
46
+
| builder | Function | null | Return widget that uses the library in a property (ex: MaterialApp's theme) |
47
+
| child | Widget | null | A part of builder that its dependencies/properties don't use the library |
48
+
| rebuildFactor | Function |*default*| Function that take old and new screen metrics and returns whether to rebuild or not when changes. |
49
+
| splitScreenMode | bool | false | support for split screen |
50
+
| minTextAdapt | bool | false | Whether to adapt the text according to the minimum of width and height |
51
+
| context | BuildContext | null | Get physical device data if not provided, by MediaQuery.of(context) |
52
+
| fontSizeResolver | Function |*default*| Function that specify how font size should be adapted. Default is that font size scale with width of screen. |
53
+
| reponsiveWidgets | Iterable<String> | null | List/Set of widget names that should be included in rebuilding tree. (See [How flutter_screenutil marks a widget needs build](#rebuild-list)) |
55
54
56
55
**Note : You must either provide builder, child or both.**
57
56
57
+
### Rebuild list
58
+
Starting from version 5.9.0, ScreenUtilInit won't rebuild the whole widget tree, instead it will mark widget needs build only if:
59
+
- Widget is not a flutter widget (widgets are available in [Flutter Docs](https://docs.flutter.dev/reference/widgets))
60
+
- Widget does not start with underscore (`_`)
61
+
- Widget does not declare `SU` mixin
62
+
-`reponsiveWidgets` does not contains widget name
63
+
64
+
If you have a widget that uses the library and doesn't meet these options you can either add `SU` mixin or add widget name in responsiveWidgets list.
65
+
58
66
### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
59
67
60
68
Please set the size of the design draft before use, the width and height of the design draft.
61
69
62
-
#### The first way (You must use it once in your app)
70
+
#### The first way (You should use it once in your app)
63
71
64
72
```dart
65
73
void main() => runApp(MyApp());
@@ -74,7 +82,8 @@ class MyApp extends StatelessWidget {
74
82
designSize: const Size(360, 690),
75
83
minTextAdapt: true,
76
84
splitScreenMode: true,
77
-
builder: (context , child) {
85
+
// Use builder only if you need to use library outside ScreenUtilInit context
86
+
builder: (_ , child) {
78
87
return MaterialApp(
79
88
debugShowCheckedModeBanner: false,
80
89
title: 'First Method',
@@ -169,6 +178,8 @@ class _HomePageState extends State<HomePage> {
169
178
}
170
179
```
171
180
181
+
**Note: calling ScreenUtil.init second time, any non-provided parameter will not be replaced with default value. Use ScreenUtil.configure instead**
0 commit comments