diff --git a/lib/util/defalut_widget_creater.dart b/lib/util/defalut_widget_creater.dart new file mode 100644 index 0000000..53b894d --- /dev/null +++ b/lib/util/defalut_widget_creater.dart @@ -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 createWidgets( + Map model, + ) { + return [ + creater(model), + ]; + } +} diff --git a/lib/util/widget_creater.dart b/lib/util/widget_creater.dart index dc25e40..346024b 100644 --- a/lib/util/widget_creater.dart +++ b/lib/util/widget_creater.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; +typedef Widget CreateWidget(Map model); + abstract class WidgetCreater { List createWidgets(Map model); diff --git a/lib/util/widget_factory.dart b/lib/util/widget_factory.dart index a264d8f..efe3cd0 100644 --- a/lib/util/widget_factory.dart +++ b/lib/util/widget_factory.dart @@ -30,7 +30,6 @@ class WidgetFactory { String name, { // 组件名 Map model, - WidgetType type, // 组件显示类型,普通/骨架 bool isSliver, // 是否加载sliver组件 }) { WidgetCreater creater; diff --git a/lib/zhiying_comm.dart b/lib/zhiying_comm.dart index 2d57c24..0a94d75 100644 --- a/lib/zhiying_comm.dart +++ b/lib/zhiying_comm.dart @@ -4,6 +4,7 @@ library zhiying_comm; export 'pages/empty_page.dart'; export 'util/widget_creater.dart'; +export 'util/defalut_widget_creater.dart'; // utils export 'util/color.dart'; @@ -18,7 +19,6 @@ export 'util/log/let_log.dart'; // 屏幕适配 export 'package:flutter_screenutil/flutter_screenutil.dart'; - export 'util/enum_util.dart'; export 'util/encode_util.dart';