Skip to content

Commit 98a3cdd

Browse files
Update README.md
1 parent cd4811f commit 98a3cdd

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

README.md

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,36 @@ dependencies:
3838
import 'package:flutter_screenutil/flutter_screenutil.dart';
3939
```
4040

41-
### Property
42-
43-
| Property | Type | Default Value | Description |
44-
| --------------- |--------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
45-
| deviceSize | Size | null | The size of the physical device |
46-
| designSize | Size | Size(360,690) | The size of the device screen in the design draft, in dp |
47-
| builder | Function | null | Return widget that uses the library in a property (ex: MaterialApp's theme) |
48-
| child | Widget | null | A part of builder that its dependencies/properties don't use the library |
49-
| rebuildFactor | Function | *default* | Returns whether to rebuild or not when screen metrics changes. |
50-
| orientation | Orientation | portrait | screen orientation |
51-
| 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~~ |
41+
### Properties
42+
43+
| Property | Type | Default Value | Description |
44+
| ---------------- |--------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
45+
| 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)) |
5554

5655
**Note : You must either provide builder, child or both.**
5756

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+
5866
### Initialize and set the fit size and font size to scale according to the system's "font size" accessibility option
5967

6068
Please set the size of the design draft before use, the width and height of the design draft.
6169

62-
#### The first way (You must use it once in your app)
70+
#### The first way (You should use it once in your app)
6371

6472
```dart
6573
void main() => runApp(MyApp());
@@ -74,7 +82,8 @@ class MyApp extends StatelessWidget {
7482
designSize: const Size(360, 690),
7583
minTextAdapt: true,
7684
splitScreenMode: true,
77-
builder: (context , child) {
85+
// Use builder only if you need to use library outside ScreenUtilInit context
86+
builder: (_ , child) {
7887
return MaterialApp(
7988
debugShowCheckedModeBanner: false,
8089
title: 'First Method',
@@ -169,6 +178,8 @@ class _HomePageState extends State<HomePage> {
169178
}
170179
```
171180

181+
**Note: calling ScreenUtil.init second time, any non-provided parameter will not be replaced with default value. Use ScreenUtil.configure instead**
182+
172183
### API
173184

174185
#### Pass the dp size of the design draft

0 commit comments

Comments
 (0)