Skip to content

Commit

Permalink
Merge pull request #17 from woodwen/master
Browse files Browse the repository at this point in the history
新增属性
  • Loading branch information
woodwen authored Dec 16, 2021
2 parents 27c332c + 8ad905e commit b404197
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions lib/dynamic_widgets/config/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ class DialogConfig {
/// 屏幕背景颜色
late String? barrierColor;

/// 使用第三方弹出框
late bool? useAwesomeDialog;

late bool? useSafeArea;
late bool? useRootNavigator;

Expand All @@ -123,13 +126,15 @@ class DialogConfig {
{required this.type,
required this.barrierDismissible,
this.barrierColor,
this.useAwesomeDialog,
this.useRootNavigator,
this.useSafeArea,
this.builder});

DialogConfig.fromJson(Map<dynamic, dynamic> json) {
type = json['type'];
barrierDismissible = json['barrierDismissible'];
useAwesomeDialog = json['useAwesomeDialog'];
barrierColor = json['barrierColor'];
useRootNavigator = json['useRootNavigator'];
useSafeArea = json['useSafeArea'];
Expand Down
19 changes: 13 additions & 6 deletions lib/dynamic_widgets/padding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ class _BuilderState extends State<_Builder> {

class Config {
late EdgeInsetsGeometry? padding;
late String? visable;

Config.fromJson(Map<dynamic, dynamic> json) {
padding = DynamicWidgetUtils.adapt<EdgeInsets>(json['padding']);
visable = json['visable']?.toString();
}

static Widget toWidget(BuildContext context, _Builder widget) {
Expand All @@ -65,11 +67,15 @@ class Config {
Widget? _child = DynamicWidgetBuilder.buildWidget(widget.config?.child,
context: context, event: widget.event);

return Padding(
key: widget.config?.xKey != null ? Key(widget.config!.xKey!) : null,
padding: props?.padding ?? const EdgeInsets.all(0.0),
child: _child ?? SizedBox(),
);
if (props?.visable == 'false') {
return SizedBox();
} else {
return Padding(
key: widget.config?.xKey != null ? Key(widget.config!.xKey!) : null,
padding: props?.padding ?? const EdgeInsets.all(0.0),
child: _child ?? SizedBox(),
);
}
}

static Map? toJson(Widget? widget, String widgetName,
Expand All @@ -80,7 +86,8 @@ class Config {
'widget': widgetName,
'child': DynamicWidgetBuilder.transformMap(padding.child, buildContext),
'xVar': {
'padding': DynamicWidgetUtils.transform(padding.padding as EdgeInsets?)
'padding': DynamicWidgetUtils.transform(padding.padding as EdgeInsets?),
'visable':'true',
},
'xKey': padding.key.toString()
};
Expand Down

0 comments on commit b404197

Please sign in to comment.