From 15c1dfe7386cb241d96149700ad75e120125f0d6 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Thu, 10 Sep 2020 15:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=84=E4=BB=B6=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=9E=84=E9=80=A0=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/defalut_widget_creater.dart | 17 +++++++++++++++++ lib/util/widget_creater.dart | 2 ++ lib/util/widget_factory.dart | 1 - lib/zhiying_comm.dart | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 lib/util/defalut_widget_creater.dart 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';