Ver código fonte

添加组件默认构造器

tags/0.0.1
Weller 4 anos atrás
pai
commit
15c1dfe738
4 arquivos alterados com 20 adições e 2 exclusões
  1. +17
    -0
      lib/util/defalut_widget_creater.dart
  2. +2
    -0
      lib/util/widget_creater.dart
  3. +0
    -1
      lib/util/widget_factory.dart
  4. +1
    -1
      lib/zhiying_comm.dart

+ 17
- 0
lib/util/defalut_widget_creater.dart Ver arquivo

@@ -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),
];
}
}

+ 2
- 0
lib/util/widget_creater.dart Ver arquivo

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';

typedef Widget CreateWidget(Map<String, dynamic> model);

abstract class WidgetCreater {
List<Widget> createWidgets(Map<String, dynamic> model);



+ 0
- 1
lib/util/widget_factory.dart Ver arquivo

@@ -30,7 +30,6 @@ class WidgetFactory {
String name, {
// 组件名
Map<String, dynamic> model,
WidgetType type, // 组件显示类型,普通/骨架
bool isSliver, // 是否加载sliver组件
}) {
WidgetCreater creater;


+ 1
- 1
lib/zhiying_comm.dart Ver arquivo

@@ -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';



Carregando…
Cancelar
Salvar