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
docs: update README to reflect autoDisposeIndexes feature
- Updated documentation to replace `forceReloadIndexes` with `autoDisposeIndexes`.
- Added explanation of the `autoDisposeIndexes` feature under the Features section.
- Updated example code to include `autoDisposeIndexes` usage.
- Improved parameter descriptions and provided real-world use case examples.
Copy file name to clipboardexpand all lines: README.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ A package that extends IndexedStack to allow for lazy loading and provides enhan
7
7
8
8
## Motivation
9
9
10
-
If you use the IndexedStack with bottom navigation, all the widgets specified in the children of the IndexedStack will be built.
10
+
If you use the IndexedStack with bottom navigation, all the widgets specified in the children of the IndexedStack will be built.
11
11
12
-
Moreover, if the widget requires API requests or database access, or has a complex UI, the IndexedStack build time will be significant.
12
+
Moreover, if the widget requires API requests or database access, or has a complex UI, the IndexedStack build time will be significant.
13
13
14
-
Therefore, we created an extended IndexedStack that builds the required widget only when it is needed, and returns the pre-built widget when it is needed again. With the newly added features, you can now also force specific child widgets to reload or manage widget updates dynamically.
14
+
Therefore, we created an extended IndexedStack that builds the required widget only when it is needed and returns the pre-built widget when it is needed again.
15
15
16
16
## Features
17
17
***Lazy Loading**: The main feature of `LazyLoadIndexedStack` is to build children widgets only when they are needed, reducing initial load time.
18
18
***Preloading**: With the `preloadIndexes` parameter, you can specify indexes of children that should be built in advance, even if they are not currently visible. This is useful for preloading widgets that are likely to be needed soon.
19
-
***Forced Reloading**: Using the `forceReloadIndexes` parameter, you can specify which child widgets should be forcibly rebuilt when needed. This is helpful for dynamic data loading or resetting specific widgets.
19
+
***Auto Disposal**: The `autoDisposeIndexes` parameter allows specific children to be automatically disposed of when they are no longer visible. When these children are accessed again, they will be rebuilt from scratch. This is useful for cases where widgets hold significant state or require resetting when revisited.
20
20
21
21
## Usage
22
-
You can use `LazyLoadIndexedStack` in the same way as `IndexedStack`, with additional options for preloading and forced reloading.
22
+
You can use `LazyLoadIndexedStack` in the same way as `IndexedStack`, with additional options for preloading and auto dispose.
23
23
24
24
### Basic Example
25
25
```dart
@@ -38,11 +38,11 @@ class _MainPageState extends State<MainPage> {
38
38
body: LazyLoadIndexedStack(
39
39
index: _index,
40
40
preloadIndexes: const [3],
41
-
forceReloadIndexes: const [1, 2], // Force reload for index 1 and 2
0 commit comments