Skip to content

Commit 6df296c

Browse files
committed
base widget fixed
1 parent f6fc8b8 commit 6df296c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/core/base/view/base_widget.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,19 @@ class BaseView<T extends Store> extends StatefulWidget {
77
final Function(T model) onModelReady;
88
final VoidCallback onDispose;
99

10-
const BaseView(
11-
{Key key,
12-
@required this.viewModel,
13-
@required this.onPageBuilder,
14-
this.onModelReady,
15-
this.onDispose})
10+
const BaseView({Key key, @required this.viewModel, @required this.onPageBuilder, this.onModelReady, this.onDispose})
1611
: super(key: key);
1712

1813
@override
19-
_BaseViewState createState() => _BaseViewState();
14+
_BaseViewState<T> createState() => _BaseViewState<T>();
2015
}
2116

22-
class _BaseViewState extends State<BaseView> {
17+
class _BaseViewState<T extends Store> extends State<BaseView<T>> {
18+
T model;
2319
@override
2420
void initState() {
21+
widget.onModelReady(model);
2522
super.initState();
26-
if (widget.onModelReady != null) widget.onModelReady(widget.viewModel);
2723
}
2824

2925
@override

0 commit comments

Comments
 (0)