@@ -0,0 +1,17 @@ | |||||
import 'package:flutter/material.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class DefaultWidgetCreater extends WidgetCreater { | |||||
final CreateWidget creater; | |||||
DefaultWidgetCreater(this.creater); | |||||
@override | |||||
List<Widget> createWidgets( | |||||
Map<String, dynamic> model, | |||||
) { | |||||
return [ | |||||
creater(model), | |||||
]; | |||||
} | |||||
} |
@@ -1,5 +1,7 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
typedef Widget CreateWidget(Map<String, dynamic> model); | |||||
abstract class WidgetCreater { | abstract class WidgetCreater { | ||||
List<Widget> createWidgets(Map<String, dynamic> model); | List<Widget> createWidgets(Map<String, dynamic> model); | ||||
@@ -30,7 +30,6 @@ class WidgetFactory { | |||||
String name, { | String name, { | ||||
// 组件名 | // 组件名 | ||||
Map<String, dynamic> model, | Map<String, dynamic> model, | ||||
WidgetType type, // 组件显示类型,普通/骨架 | |||||
bool isSliver, // 是否加载sliver组件 | bool isSliver, // 是否加载sliver组件 | ||||
}) { | }) { | ||||
WidgetCreater creater; | WidgetCreater creater; | ||||
@@ -4,6 +4,7 @@ library zhiying_comm; | |||||
export 'pages/empty_page.dart'; | export 'pages/empty_page.dart'; | ||||
export 'util/widget_creater.dart'; | export 'util/widget_creater.dart'; | ||||
export 'util/defalut_widget_creater.dart'; | |||||
// utils | // utils | ||||
export 'util/color.dart'; | export 'util/color.dart'; | ||||
@@ -18,7 +19,6 @@ export 'util/log/let_log.dart'; | |||||
// 屏幕适配 | // 屏幕适配 | ||||
export 'package:flutter_screenutil/flutter_screenutil.dart'; | export 'package:flutter_screenutil/flutter_screenutil.dart'; | ||||
export 'util/enum_util.dart'; | export 'util/enum_util.dart'; | ||||
export 'util/encode_util.dart'; | export 'util/encode_util.dart'; | ||||