From bc5ad1e9628a348ecd2516800781de9cab53f341 Mon Sep 17 00:00:00 2001 From: Pawit Aiemvaravutigul Date: Thu, 19 Nov 2020 14:21:26 +0700 Subject: [PATCH 1/8] Fix ClipRRect widget Type --- lib/dynamic_widget/basic/cliprrect_widget_parser.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_widget/basic/cliprrect_widget_parser.dart b/lib/dynamic_widget/basic/cliprrect_widget_parser.dart index 345c40f..fddde19 100644 --- a/lib/dynamic_widget/basic/cliprrect_widget_parser.dart +++ b/lib/dynamic_widget/basic/cliprrect_widget_parser.dart @@ -41,5 +41,5 @@ class ClipRRectWidgetParser extends WidgetParser { } @override - Type get widgetType => ClipRect; + Type get widgetType => ClipRRect; } From dbde152616da108eed53d03f9c74b610feb391c4 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 19 Nov 2020 16:19:11 +0700 Subject: [PATCH 2/8] fix parser stack overflow --- lib/dynamic_widget/basic/expanded_widget_parser.dart | 2 +- lib/dynamic_widget/basic/fittedbox_widget_parser.dart | 2 +- lib/dynamic_widget/basic/padding_widget_parser.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/dynamic_widget/basic/expanded_widget_parser.dart b/lib/dynamic_widget/basic/expanded_widget_parser.dart index d728326..38d6cff 100644 --- a/lib/dynamic_widget/basic/expanded_widget_parser.dart +++ b/lib/dynamic_widget/basic/expanded_widget_parser.dart @@ -21,7 +21,7 @@ class ExpandedWidgetParser extends WidgetParser { return { "type": widgetName, "flex": realWidget.flex, - "child": DynamicWidgetBuilder.export(realWidget, buildContext) + "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } diff --git a/lib/dynamic_widget/basic/fittedbox_widget_parser.dart b/lib/dynamic_widget/basic/fittedbox_widget_parser.dart index e231fd0..3f21a15 100644 --- a/lib/dynamic_widget/basic/fittedbox_widget_parser.dart +++ b/lib/dynamic_widget/basic/fittedbox_widget_parser.dart @@ -26,7 +26,7 @@ class FittedBoxWidgetParser extends WidgetParser { "type": widgetName, "alignment": realWidget.alignment != null? exportAlignment(realWidget.alignment):null, "fit": realWidget.fit!=null? exportBoxFit(realWidget.fit):BoxFit.contain, - "child": DynamicWidgetBuilder.export(realWidget, buildContext) + "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } diff --git a/lib/dynamic_widget/basic/padding_widget_parser.dart b/lib/dynamic_widget/basic/padding_widget_parser.dart index 7299ec9..9875988 100644 --- a/lib/dynamic_widget/basic/padding_widget_parser.dart +++ b/lib/dynamic_widget/basic/padding_widget_parser.dart @@ -25,7 +25,7 @@ class PaddingWidgetParser extends WidgetParser { return { "type": widgetName, "padding": padding!=null? "${padding.left},${padding.top},${padding.right},${padding.bottom}":null, - "child": DynamicWidgetBuilder.export(realWidget, buildContext) + "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } From f20b81e94a5c083b386cac4b34917b23dc5f4680 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 19 Nov 2020 16:29:21 +0700 Subject: [PATCH 3/8] fix parser borderRadius --- lib/dynamic_widget/basic/cliprrect_widget_parser.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dynamic_widget/basic/cliprrect_widget_parser.dart b/lib/dynamic_widget/basic/cliprrect_widget_parser.dart index fddde19..549adca 100644 --- a/lib/dynamic_widget/basic/cliprrect_widget_parser.dart +++ b/lib/dynamic_widget/basic/cliprrect_widget_parser.dart @@ -33,11 +33,11 @@ class ClipRRectWidgetParser extends WidgetParser { var borderRadius = realWidget.borderRadius; return { "type": widgetName, - "borderRadius": "${borderRadius.topLeft},${borderRadius.topRight},${borderRadius.bottomLeft},${borderRadius.bottomRight}", + "borderRadius": + "${borderRadius.topLeft.x},${borderRadius.topRight.x},${borderRadius.bottomLeft.x},${borderRadius.bottomRight.x}", "clipBehavior": exportClipBehavior(realWidget.clipBehavior), "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; - } @override From 66456f0c8e16bdbb839502b239943d75653b7860 Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 19 Nov 2020 16:54:02 +0700 Subject: [PATCH 4/8] default alignment should be null --- lib/dynamic_widget/utils.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_widget/utils.dart b/lib/dynamic_widget/utils.dart index bef67a3..56ed176 100644 --- a/lib/dynamic_widget/utils.dart +++ b/lib/dynamic_widget/utils.dart @@ -268,7 +268,7 @@ Map exportTextStyle(TextStyle textStyle){ } Alignment parseAlignment(String alignmentString) { - Alignment alignment = Alignment.topLeft; + Alignment alignment; switch (alignmentString) { case 'topLeft': alignment = Alignment.topLeft; From 670208124509fdbec64492f0943188187a6049dc Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 19 Nov 2020 17:01:59 +0700 Subject: [PATCH 5/8] add container height --- .../basic/container_widget_parser.dart | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/dynamic_widget/basic/container_widget_parser.dart b/lib/dynamic_widget/basic/container_widget_parser.dart index c419eb4..7525d72 100644 --- a/lib/dynamic_widget/basic/container_widget_parser.dart +++ b/lib/dynamic_widget/basic/container_widget_parser.dart @@ -51,14 +51,27 @@ class ContainerWidgetParser extends WidgetParser { var realWidget = widget as Container; var padding = realWidget.padding as EdgeInsets; var margin = realWidget.margin as EdgeInsets; + var constraints = realWidget.constraints; return { "type": widgetName, - "alignment": realWidget.alignment !=null ? exportAlignment(realWidget.alignment) : null, - "padding" : padding!=null? "${padding.left},${padding.top},${padding.right},${padding.bottom}":null, - "color": realWidget.color!=null ? realWidget.color.value.toRadixString(16) : null, - "margin": margin != null? "${margin.left},${margin.top},${margin.right},${margin.bottom}":null, - //TODO: Container don't expose the width and height properties, so I don't know - // how to export width and height properties. + "alignment": realWidget.alignment != null + ? exportAlignment(realWidget.alignment) + : null, + "padding": padding != null + ? "${padding.left},${padding.top},${padding.right},${padding.bottom}" + : null, + "color": realWidget.color != null + ? realWidget.color.value.toRadixString(16) + : null, + "margin": margin != null + ? "${margin.left},${margin.top},${margin.right},${margin.bottom}" + : null, + "width": constraints.minWidth == constraints.maxWidth + ? constraints.minWidth + : null, + "height": constraints.minHeight == constraints.maxHeight + ? constraints.minHeight + : null, "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } From 6bbc1b9f36beb5b96d7d3405f8a5ca5fb622b27c Mon Sep 17 00:00:00 2001 From: Roy Date: Thu, 19 Nov 2020 17:15:36 +0700 Subject: [PATCH 6/8] fix check null constraints in container --- .../basic/container_widget_parser.dart | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/dynamic_widget/basic/container_widget_parser.dart b/lib/dynamic_widget/basic/container_widget_parser.dart index 7525d72..f223aa6 100644 --- a/lib/dynamic_widget/basic/container_widget_parser.dart +++ b/lib/dynamic_widget/basic/container_widget_parser.dart @@ -66,12 +66,14 @@ class ContainerWidgetParser extends WidgetParser { "margin": margin != null ? "${margin.left},${margin.top},${margin.right},${margin.bottom}" : null, - "width": constraints.minWidth == constraints.maxWidth - ? constraints.minWidth - : null, - "height": constraints.minHeight == constraints.maxHeight - ? constraints.minHeight - : null, + "width": + constraints != null && constraints.minWidth == constraints.maxWidth + ? constraints.minWidth + : null, + "height": + constraints != null && constraints.minHeight == constraints.maxHeight + ? constraints.minHeight + : null, "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } From 71bf2edc448e7a00518d88e9f434b7e14eb129ff Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 20 Nov 2020 12:24:43 +0700 Subject: [PATCH 7/8] force fully cast type number to double --- README.md | 4 +- WIDGETS.md | 698 +++++++++--------- .../basic/align_widget_parser.dart | 4 +- .../basic/aspectratio_widget_parser.dart | 2 +- .../basic/baseline_widget_parser.dart | 8 +- .../basic/button_widget_parser.dart | 35 +- .../basic/center_widget_parser.dart | 4 +- .../basic/container_widget_parser.dart | 4 +- .../basic/icon_widget_parser.dart | 10 +- .../basic/image_widget_parser.dart | 12 +- .../basic/opacity_widget_parser.dart | 2 +- .../basic/placeholder_widget_parser.dart | 6 +- .../stack_positioned_widgets_parser.dart | 12 +- .../basic/text_widget_parser.dart | 2 +- .../basic/wrap_widget_parser.dart | 4 +- .../scrolling/gridview_widget_parser.dart | 8 +- .../scrolling/listview_widget_parser.dart | 4 +- lib/dynamic_widget/utils.dart | 14 +- 18 files changed, 443 insertions(+), 390 deletions(-) diff --git a/README.md b/README.md index d8d31d7..1d5bc34 100644 --- a/README.md +++ b/README.md @@ -122,11 +122,11 @@ class RaisedButtonParser extends WidgetParser { ? parseHexColor(map['disabledColor']) : null, disabledElevation: - map.containsKey('disabledElevation') ? map['disabledElevation'] : 0.0, + map.containsKey('disabledElevation') ? map['disabledElevation']?.toDouble() : 0.0, disabledTextColor: map.containsKey('disabledTextColor') ? parseHexColor(map['disabledTextColor']) : null, - elevation: map.containsKey('elevation') ? map['elevation'] : 0.0, + elevation: map.containsKey('elevation') ? map['elevation']?.toDouble() : 0.0, padding: map.containsKey('padding') ? parseEdgeInsetsGeometry(map['padding']) : null, diff --git a/WIDGETS.md b/WIDGETS.md index 95f3c28..55c90ec 100644 --- a/WIDGETS.md +++ b/WIDGETS.md @@ -1,472 +1,506 @@ # Dynamic Widget Manual + > Dynamic Widget Manual ## Table of contents -* [Container Widget](#container-widget) -* [Text Widget](#text-widget) -* [TextSpan](#textspan) -* [TextStyle](#textstyle) -* [RaisedButton Widget](#raisedbutton-widget) -* [Row Widget](#row-widget) -* [Column Widget](#column-widget) -* [AssetImage Widget](#assetimage-widget) -* [NetworkImage Widget](#networkimage-widget) -* [FileImage Widget](#fileimage-widget) -* [Placeholder Widget](#placeholder-widget) -* [GridView Widget](#gridview-widget) -* [ListView Widget](#listview-widget) -* [PageView Widget](#pageview-widget) -* [Expanded Widget](#expanded-widget) -* [Padding Widget](#padding-widget) -* [Center Widget](#center-widget) -* [Align Widget](#align-widget) -* [AspectRatio Widget](#aspectratio-widget) -* [FittedBox Widget](#fittedbox-widget) -* [Baseline Widget](#baseline-widget) -* [Stack Widget](#stack-widget) -* [Positioned Widget](#positioned-widget) -* [IndexedStack Widget](#indexedstack-widget) -* [ExpandedSizedBox Widget](#expandedsizedbox-widget) -* [SizedBox Widget](#sizedbox-widget) -* [Opacity Widget](#opacity-widget) -* [Wrap Widget](#wrap-widget) -* [ClipRRect Widget](#cliprrect-widget) -* [SafeArea Widget](#safearea-widget) -* [ListTile Widget](#listtile-widget) -* [SelectableText Widget](#selectabletext-widget) -* [Icon Widget](#icon-widget) -* [DropCapText Widget](#dropcaptext-widget) + +- [Container Widget](#container-widget) +- [Text Widget](#text-widget) +- [TextSpan](#textspan) +- [TextStyle](#textstyle) +- [RaisedButton Widget](#raisedbutton-widget) +- [Row Widget](#row-widget) +- [Column Widget](#column-widget) +- [AssetImage Widget](#assetimage-widget) +- [NetworkImage Widget](#networkimage-widget) +- [FileImage Widget](#fileimage-widget) +- [Placeholder Widget](#placeholder-widget) +- [GridView Widget](#gridview-widget) +- [ListView Widget](#listview-widget) +- [PageView Widget](#pageview-widget) +- [Expanded Widget](#expanded-widget) +- [Padding Widget](#padding-widget) +- [Center Widget](#center-widget) +- [Align Widget](#align-widget) +- [AspectRatio Widget](#aspectratio-widget) +- [FittedBox Widget](#fittedbox-widget) +- [Baseline Widget](#baseline-widget) +- [Stack Widget](#stack-widget) +- [Positioned Widget](#positioned-widget) +- [IndexedStack Widget](#indexedstack-widget) +- [ExpandedSizedBox Widget](#expandedsizedbox-widget) +- [SizedBox Widget](#sizedbox-widget) +- [Opacity Widget](#opacity-widget) +- [Wrap Widget](#wrap-widget) +- [ClipRRect Widget](#cliprrect-widget) +- [SafeArea Widget](#safearea-widget) +- [ListTile Widget](#listtile-widget) +- [SelectableText Widget](#selectabletext-widget) +- [Icon Widget](#icon-widget) +- [DropCapText Widget](#dropcaptext-widget) ## Container Widget + Container widget, here to see flutter [Container widget](https://docs.flutter.io/flutter/widgets/Container-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alignment|Align the [child] within the container|String|One of the following string:
topLeft
topCenter
topRight
centerLeft
center
centerRight
bottomLeft
bottomCenter
bottomRight|"topLeft"| -| margin|Empty space to surround the [decoration] and [child].|String|left,top,right,bottom|"8,10,12,8"| -| padding|Empty space to inscribe inside the [decoration]. The [child], if any, isplaced inside this padding.|String|left,top,right,bottom|"8,10,12,8"| -| color|Container background color|String| "#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| width|Container width|double| |200| -| height|Container height|double| |200| -| constraints|Container constraints|BoxConstraints| {"minWidth":100, "maxWidth": 100, "minHeight": 100, "maxHeight": 100}
9999999999 would be the value of **double.infinity** |200| -| child|The [child] contained by the container.|Widget| | | -| click_event|Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. |String| |"route://productDetail?goods_id=123"| +| property | definition | type | value | sample | +| ----------- | ---------------------------------------------------------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| alignment | Align the [child] within the container | String | One of the following string:
topLeft
topCenter
topRight
centerLeft
center
centerRight
bottomLeft
bottomCenter
bottomRight | "topLeft" | +| margin | Empty space to surround the [decoration] and [child]. | String | left,top,right,bottom | "8,10,12,8" | +| padding | Empty space to inscribe inside the [decoration]. The [child], if any, isplaced inside this padding. | String | left,top,right,bottom | "8,10,12,8" | +| color | Container background color | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| width | Container width | double | | 200 | +| height | Container height | double | | 200 | +| constraints | Container constraints | BoxConstraints | {"minWidth":100, "maxWidth": 100, "minHeight": 100, "maxHeight": 100}
9999999999 would be the value of **double.infinity** | 200 | +| child | The [child] contained by the container. | Widget | | | +| click_event | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. | String | | "route://productDetail?goods_id=123" | ## Text Widget + Text widget, here to see flutter [Text widget](https://docs.flutter.io/flutter/widgets/Text-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| data|The text to display|String| |"I am a text"| -| textAlign|How the text should be aligned horizontally.|String|One of the following string:
left (default)
right
center
justify
start
end|"left"| -| overflow|How visual overflow should be handled.|String|One of the following string:
ellipsis (default)
clip
fade|"ellipsis"| -| maxLines|An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. |int| |3| -| semanticsLabel|An alternative semantics label for this text.|String| || -| softWrap|Whether the text should break at soft line breaks.|bool| |true| -| textDirection|The directionality of the text.|String| One of the following string:
ltr (default)
rtl |"ltr"| -| textScaleFactor|The number of font pixels for each logical pixel.|double| | | -| textSpan|The text to display as a TextSpan. |TextSpan| | | +| property | definition | type | value | sample | +| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------- | ------------- | +| data | The text to display | String | | "I am a text" | +| textAlign | How the text should be aligned horizontally. | String | One of the following string:
left (default)
right
center
justify
start
end | "left" | +| overflow | How visual overflow should be handled. | String | One of the following string:
ellipsis (default)
clip
fade | "ellipsis" | +| maxLines | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. | int | | 3 | +| semanticsLabel | An alternative semantics label for this text. | String | | | +| softWrap | Whether the text should break at soft line breaks. | bool | | true | +| textDirection | The directionality of the text. | String | One of the following string:
ltr (default)
rtl | "ltr" | +| textScaleFactor | The number of font pixels for each logical pixel. | double | | | +| textSpan | The text to display as a TextSpan. | TextSpan | | | ## TextSpan + TextSpan, here to see flutter [TextSpan](https://docs.flutter.io/flutter/painting/TextSpan-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| recognizer |Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. Currently only supports TapGestureRecognizer |String| |"route://productDetail?goods_id=123"| -| text|The text contained in the span.|String| |"I am a text"| -| style|The style to apply to the text and the children.|TextStyle| | {"color": "#00FFFF", "fontSize": 26.0}| -| children|Additional spans to include as children. |List<TextSpan>| | | +| property | definition | type | value | sample | +| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | ----- | -------------------------------------- | +| recognizer | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. Currently only supports TapGestureRecognizer | String | | "route://productDetail?goods_id=123" | +| text | The text contained in the span. | String | | "I am a text" | +| style | The style to apply to the text and the children. | TextStyle | | {"color": "#00FFFF", "fontSize": 26.0} | +| children | Additional spans to include as children. | List<TextSpan> | | | ## TextStyle + TextStyle, here to see flutter [TextStyle](https://docs.flutter.io/flutter/painting/TextStyle-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| color|The color to use when painting the text.|String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| debugLabel|A human-readable description of this text style. |String| | | -| decoration|The name of the decoration. |String| One of the following string: none (default)
lineThrough
overline
underline | "underline" | -| fontFamily|The name of the font to use when painting the text (e.g., Roboto). If the font is defined in a package, this will be prefixed with 'packages/package_name/' (e.g. 'packages/cool_fonts/Roboto'). The prefixing is done by the constructor when the package argument is provided.|String| | | -| fontSize|The size of glyphs (in logical pixels) to use when painting the text. |double| | | -| fontStyle|The typeface variant to use when drawing the letters (e.g., italics). |String|One of the following string: italic (default)
normal | "italic" | -| fontWeight|The typeface thickness to use when painting the text (e.g., bold). |String|One of the following string: w100
w200
w300
w400
w500
w600
w700
w800
w900
normal (default)
bold | "bold" | +| property | definition | type | value | sample | +| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| color | The color to use when painting the text. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| debugLabel | A human-readable description of this text style. | String | | | +| decoration | The name of the decoration. | String | One of the following string: none (default)
lineThrough
overline
underline | "underline" | +| fontFamily | The name of the font to use when painting the text (e.g., Roboto). If the font is defined in a package, this will be prefixed with 'packages/package_name/' (e.g. 'packages/cool_fonts/Roboto'). The prefixing is done by the constructor when the package argument is provided. | String | | | +| fontSize | The size of glyphs (in logical pixels) to use when painting the text. | double | | | +| fontStyle | The typeface variant to use when drawing the letters (e.g., italics). | String | One of the following string: italic (default)
normal | "italic" | +| fontWeight | The typeface thickness to use when painting the text (e.g., bold). | String | One of the following string: w100
w200
w300
w400
w500
w600
w700
w800
w900
normal (default)
bold | "bold" | ## RaisedButton Widget + RaisedButton widget, here to see flutter [RaisedButton widget](https://docs.flutter.io/flutter/widgets/Text-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| color|The button's fill color, displayed by its Material, while it is in its default (unpressed, enabled) state. |String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| disabledColor|The fill color of the button when the button is disabled. |String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| disabledElevation|The elevation for the button's Material when the button is not enabled.|double| | | -| disabledTextColor|The color to use for this button's text when the button is disabled.|String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| elevation|The z-coordinate at which to place this button. This controls the size of the shadow below the raised button.|double| | | -| padding|The internal padding for the button's child.|String|left,top,right,bottom|"8,10,12,8"| -| splashColor|The splash color of the button's InkWell.|String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| textColor|The color to use for this button's text.|String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| child|The button's label.|Widget| | | -| click_event|Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. |String| |"route://productDetail?goods_id=123"| +| property | definition | type | value | sample | +| ----------------- | ------------------------------------------------------------------------------------------------------------- | ------ | ------------------------ | ------------------------------------ | +| color | The button's fill color, displayed by its Material, while it is in its default (unpressed, enabled) state. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| disabledColor | The fill color of the button when the button is disabled. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| disabledElevation | The elevation for the button's Material when the button is not enabled. | double | | | +| disabledTextColor | The color to use for this button's text when the button is disabled. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| elevation | The z-coordinate at which to place this button. This controls the size of the shadow below the raised button. | double | | | +| padding | The internal padding for the button's child. | String | left,top,right,bottom | "8,10,12,8" | +| splashColor | The splash color of the button's InkWell. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| textColor | The color to use for this button's text. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| child | The button's label. | Widget | | | +| click_event | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. | String | | "route://productDetail?goods_id=123" | ## Row Widget + Row widget, here to see flutter [Row widget](https://docs.flutter.io/flutter/widgets/Row-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| crossAxisAlignment|How the children should be placed along the cross axis.|String|One of the following string:
center (default)
start
end
stretch
baseline| | -| mainAxisAlignment|How the children should be placed along the main axis. |String|One of the following string:
start (default)
end
center
spaceBetween
spaceAround
spaceEvenly| | -| mainAxisSize|How much space should be occupied in the main axis.|String| One of the following string:
max (default)
min | | -| textBaseline|If aligning items according to their baseline, which baseline to use.|String|One of the following string:
ideographic (default)
alphabetic| | -| textDirection|Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.|String| One of the following string:
ltr (default)
rtl | | -| verticalDirection|Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.|String|One of the following string:
down (default)
up| | -| children|The widgets below this widget in the tree. |List<TextSpan>| | | +| property | definition | type | value | sample | +| ------------------ | --------------------------------------------------------------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------- | ------ | +| crossAxisAlignment | How the children should be placed along the cross axis. | String | One of the following string:
center (default)
start
end
stretch
baseline | | +| mainAxisAlignment | How the children should be placed along the main axis. | String | One of the following string:
start (default)
end
center
spaceBetween
spaceAround
spaceEvenly | | +| mainAxisSize | How much space should be occupied in the main axis. | String | One of the following string:
max (default)
min | | +| textBaseline | If aligning items according to their baseline, which baseline to use. | String | One of the following string:
ideographic (default)
alphabetic | | +| textDirection | Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction. | String | One of the following string:
ltr (default)
rtl | | +| verticalDirection | Determines the order to lay children out vertically and how to interpret start and end in the vertical direction. | String | One of the following string:
down (default)
up | | +| children | The widgets below this widget in the tree. | List<TextSpan> | | | ## Column Widget + Column widget, here to see flutter [Column widget](https://docs.flutter.io/flutter/widgets/Column-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| crossAxisAlignment|How the children should be placed along the cross axis.|String|One of the following string:
center (default)
start
end
stretch
baseline| | -| mainAxisAlignment|How the children should be placed along the main axis. |String|One of the following string:
start (default)
end
center
spaceBetween
spaceAround
spaceEvenly| | -| mainAxisSize|How much space should be occupied in the main axis.|String| One of the following string:
max (default)
min | | -| textBaseline|If aligning items according to their baseline, which baseline to use.|String|One of the following string:
ideographic (default)
alphabetic| | -| textDirection|Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.|String| One of the following string:
ltr (default)
rtl | | -| verticalDirection|Determines the order to lay children out vertically and how to interpret start and end in the vertical direction.|String|One of the following string:
down (default)
up| | -| children|The widgets below this widget in the tree. |List<TextSpan>| | | +| property | definition | type | value | sample | +| ------------------ | --------------------------------------------------------------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------- | ------ | +| crossAxisAlignment | How the children should be placed along the cross axis. | String | One of the following string:
center (default)
start
end
stretch
baseline | | +| mainAxisAlignment | How the children should be placed along the main axis. | String | One of the following string:
start (default)
end
center
spaceBetween
spaceAround
spaceEvenly | | +| mainAxisSize | How much space should be occupied in the main axis. | String | One of the following string:
max (default)
min | | +| textBaseline | If aligning items according to their baseline, which baseline to use. | String | One of the following string:
ideographic (default)
alphabetic | | +| textDirection | Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction. | String | One of the following string:
ltr (default)
rtl | | +| verticalDirection | Determines the order to lay children out vertically and how to interpret start and end in the vertical direction. | String | One of the following string:
down (default)
up | | +| children | The widgets below this widget in the tree. | List<TextSpan> | | | ## AssetImage Widget + AssetImage widget, here to see flutter [Asset Image widget](https://docs.flutter.io/flutter/widgets/Image-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| name|The picture asset name|String||'images/cat.png' | -| semanticLabel|A Semantic description of the image. |String|| | -| excludeFromSemantics|Whether to exclude this image from semantics. |bool| | | -| scale||double| | | -| width|If non-null, require the image to have this width. |double| | | -| height|If non-null, require the image to have this height.|double| | | -| color|If non-null, this color is blended with each image pixel using colorBlendMode. |String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| blendMode|Used to combine color with this image. |String| enum values, please see enum BlendMode | 'srcIn' | -| boxFit|How to inscribe the image into the space allocated during layout. |String| enum values, please see enum BoxFit | 'none' | -| alignment|How to align the image within its bounds.|String|enum values, please see enum Alignment, default value is Alignment.center. |"center"| -| repeat|How to paint any portions of the layout bounds not covered by the image.|String| enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat'| -| centerSlice|The center slice for a nine-patch image.|String|left,top,right,bottom|"8,10,12,8"| -| matchTextDirection|Whether to paint the image in the direction of the TextDirection.|bool| | | -| gaplessPlayback|Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes.|bool| | | -| filterQuality|Used to set the FilterQuality of the image.|String|enum values, please see enum FilterQuality, default value is FilterQuality.low. |"low"| -| click_event|Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. |String| |"route://productDetail?goods_id=123"| +| property | definition | type | value | sample | +| -------------------- | ------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- | ------------------------------------ | +| name | The picture asset name | String | | 'images/cat.png' | +| semanticLabel | A Semantic description of the image. | String | | | +| excludeFromSemantics | Whether to exclude this image from semantics. | bool | | | +| scale | | double | | | +| width | If non-null, require the image to have this width. | double | | | +| height | If non-null, require the image to have this height. | double | | | +| color | If non-null, this color is blended with each image pixel using colorBlendMode. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| blendMode | Used to combine color with this image. | String | enum values, please see enum BlendMode | 'srcIn' | +| boxFit | How to inscribe the image into the space allocated during layout. | String | enum values, please see enum BoxFit | 'none' | +| alignment | How to align the image within its bounds. | String | enum values, please see enum Alignment, default value is Alignment.center. | "center" | +| repeat | How to paint any portions of the layout bounds not covered by the image. | String | enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat' | +| centerSlice | The center slice for a nine-patch image. | String | left,top,right,bottom | "8,10,12,8" | +| matchTextDirection | Whether to paint the image in the direction of the TextDirection. | bool | | | +| gaplessPlayback | Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes. | bool | | | +| filterQuality | Used to set the FilterQuality of the image. | String | enum values, please see enum FilterQuality, default value is FilterQuality.low. | "low" | +| click_event | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. | String | | "route://productDetail?goods_id=123" | ## NetworkImage Widget + NetworkImage widget, here to see flutter [Network Image widget](https://docs.flutter.io/flutter/widgets/Image-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| src|The picture url|String||'http://www.google.com/logo.png' | -| semanticLabel|A Semantic description of the image. |String|| | -| excludeFromSemantics|Whether to exclude this image from semantics. |bool| | | -| scale||double| | | -| width|If non-null, require the image to have this width. |double| | | -| height|If non-null, require the image to have this height.|double| | | -| color|If non-null, this color is blended with each image pixel using colorBlendMode. |String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| blendMode|Used to combine color with this image. |String| enum values, please see enum BlendMode | 'srcIn' | -| boxFit|How to inscribe the image into the space allocated during layout. |String| enum values, please see enum BoxFit | 'none' | -| alignment|How to align the image within its bounds.|String|enum values, please see enum Alignment, default value is Alignment.center. |"center"| -| repeat|How to paint any portions of the layout bounds not covered by the image.|String| enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat'| -| centerSlice|The center slice for a nine-patch image.|String|left,top,right,bottom|"8,10,12,8"| -| matchTextDirection|Whether to paint the image in the direction of the TextDirection.|bool| | | -| gaplessPlayback|Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes.|bool| | | -| filterQuality|Used to set the FilterQuality of the image.|String|enum values, please see enum FilterQuality, default value is FilterQuality.low. |"low"| -| click_event|Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. |String| |"route://productDetail?goods_id=123"| +| property | definition | type | value | sample | +| -------------------- | ------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- | ------------------------------------ | +| src | The picture url | String | | 'http://www.google.com/logo.png' | +| semanticLabel | A Semantic description of the image. | String | | | +| excludeFromSemantics | Whether to exclude this image from semantics. | bool | | | +| scale | | double | | | +| width | If non-null, require the image to have this width. | double | | | +| height | If non-null, require the image to have this height. | double | | | +| color | If non-null, this color is blended with each image pixel using colorBlendMode. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| blendMode | Used to combine color with this image. | String | enum values, please see enum BlendMode | 'srcIn' | +| boxFit | How to inscribe the image into the space allocated during layout. | String | enum values, please see enum BoxFit | 'none' | +| alignment | How to align the image within its bounds. | String | enum values, please see enum Alignment, default value is Alignment.center. | "center" | +| repeat | How to paint any portions of the layout bounds not covered by the image. | String | enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat' | +| centerSlice | The center slice for a nine-patch image. | String | left,top,right,bottom | "8,10,12,8" | +| matchTextDirection | Whether to paint the image in the direction of the TextDirection. | bool | | | +| gaplessPlayback | Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes. | bool | | | +| filterQuality | Used to set the FilterQuality of the image. | String | enum values, please see enum FilterQuality, default value is FilterQuality.low. | "low" | +| click_event | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. | String | | "route://productDetail?goods_id=123" | ## FileImage Widget + FileImage widget, here to see flutter [File Image widget](https://docs.flutter.io/flutter/widgets/Image-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| filePath|The picture file path|String||'/sdcard/logo.png' | -| semanticLabel|A Semantic description of the image. |String|| | -| excludeFromSemantics|Whether to exclude this image from semantics. |bool| | | -| scale||double| | | -| width|If non-null, require the image to have this width. |double| | | -| height|If non-null, require the image to have this height.|double| | | -| color|If non-null, this color is blended with each image pixel using colorBlendMode. |String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| blendMode|Used to combine color with this image. |String| enum values, please see enum BlendMode | 'srcIn' | -| boxFit|How to inscribe the image into the space allocated during layout. |String| enum values, please see enum BoxFit | 'none' | -| alignment|How to align the image within its bounds.|String|enum values, please see enum Alignment, default value is Alignment.center. |"center"| -| repeat|How to paint any portions of the layout bounds not covered by the image.|String| enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat'| -| centerSlice|The center slice for a nine-patch image.|String|left,top,right,bottom|"8,10,12,8"| -| matchTextDirection|Whether to paint the image in the direction of the TextDirection.|bool| | | -| gaplessPlayback|Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes.|bool| | | -| filterQuality|Used to set the FilterQuality of the image.|String|enum values, please see enum FilterQuality, default value is FilterQuality.low. |"low"| -| click_event|Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. |String| |"route://productDetail?goods_id=123"| +| property | definition | type | value | sample | +| -------------------- | ------------------------------------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------- | ------------------------------------ | +| filePath | The picture file path | String | | '/sdcard/logo.png' | +| semanticLabel | A Semantic description of the image. | String | | | +| excludeFromSemantics | Whether to exclude this image from semantics. | bool | | | +| scale | | double | | | +| width | If non-null, require the image to have this width. | double | | | +| height | If non-null, require the image to have this height. | double | | | +| color | If non-null, this color is blended with each image pixel using colorBlendMode. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| blendMode | Used to combine color with this image. | String | enum values, please see enum BlendMode | 'srcIn' | +| boxFit | How to inscribe the image into the space allocated during layout. | String | enum values, please see enum BoxFit | 'none' | +| alignment | How to align the image within its bounds. | String | enum values, please see enum Alignment, default value is Alignment.center. | "center" | +| repeat | How to paint any portions of the layout bounds not covered by the image. | String | enum values, please see enum ImageRepeat, default value is ImageRepeat.noRepeat. | 'noRepeat' | +| centerSlice | The center slice for a nine-patch image. | String | left,top,right,bottom | "8,10,12,8" | +| matchTextDirection | Whether to paint the image in the direction of the TextDirection. | bool | | | +| gaplessPlayback | Whether to continue showing the old image (true), or briefly show nothing (false), when the image provider changes. | bool | | | +| filterQuality | Used to set the FilterQuality of the image. | String | enum values, please see enum FilterQuality, default value is FilterQuality.low. | "low" | +| click_event | Url route string, for example: "route://productDetail?goods_id=123" for navigating to product detail page. | String | | "route://productDetail?goods_id=123" | ## Placeholder Widget + Placeholder widget, here to see flutter [Placeholder widget](https://docs.flutter.io/flutter/widgets/Placeholder-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| color|The color to draw the placeholder box.|String|"#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| strokeWidth|The width of the lines in the placeholder box. |double|| | -| fallbackWidth|The width to use when the placeholder is in a situation with an unbounded width.|double| | | -| fallbackHeight|The height to use when the placeholder is in a situation with an unbounded height. |double| | | +| property | definition | type | value | sample | +| -------------- | ---------------------------------------------------------------------------------- | ------ | ------------------------ | ------------------------ | +| color | The color to draw the placeholder box. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| strokeWidth | The width of the lines in the placeholder box. | double | | | +| fallbackWidth | The width to use when the placeholder is in a situation with an unbounded width. | double | | | +| fallbackHeight | The height to use when the placeholder is in a situation with an unbounded height. | double | | | ## GridView Widget + GridView widget, here to see flutter [GridView widget](https://docs.flutter.io/flutter/widgets/GridView-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| crossAxisCount|a fixed number of tiles in the cross axis.|int||| -| scrollDirection|The axis along which the scroll view scrolls. |String|enum values, please see enum Axis, default value is Axis.vertical.| "vertical" | -| reverse|Whether the scroll view scrolls in the reading direction.|bool| default value is false | | -| shrinkWrap|Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.|bool| default value is false | | -| cacheExtent|The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.|double| default value is 0.0 | | -| padding|The amount of space by which to inset the children.|String|left,top,right,bottom|"8,10,12,8"| -| mainAxisSpacing| The number of logical pixels between each child along the main axis.|double||| -| crossAxisSpacing| The number of logical pixels between each child along the cross axis.|double||| -| childAspectRatio| The ratio of the cross-axis to the main-axis extent of each child.|double||| -| children|The widgets below this widget in the tree. |List<Widget>| | | -| pageSize| ListView load more item count for next page|double||this will be append to load more url| -| loadMoreUrl| When listview scroll to bottom, it will do the request. The response of this url should be a json array of widget|String||| -| isDemo| used in the demo, if true, will do the fake request|bool||the default value is false| +| property | definition | type | value | sample | +| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------ | ------------------------------------ | +| crossAxisCount | a fixed number of tiles in the cross axis. | int | | | +| scrollDirection | The axis along which the scroll view scrolls. | String | enum values, please see enum Axis, default value is Axis.vertical. | "vertical" | +| reverse | Whether the scroll view scrolls in the reading direction. | bool | default value is false | | +| shrinkWrap | Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed. | bool | default value is false | | +| cacheExtent | The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls. | double | default value is 0.0 | | +| padding | The amount of space by which to inset the children. | String | left,top,right,bottom | "8,10,12,8" | +| mainAxisSpacing | The number of logical pixels between each child along the main axis. | double | | | +| crossAxisSpacing | The number of logical pixels between each child along the cross axis. | double | | | +| childAspectRatio | The ratio of the cross-axis to the main-axis extent of each child. | double | | | +| children | The widgets below this widget in the tree. | List<Widget> | | | +| pageSize | ListView load more item count for next page | int | | this will be append to load more url | +| loadMoreUrl | When listview scroll to bottom, it will do the request. The response of this url should be a json array of widget | String | | | +| isDemo | used in the demo, if true, will do the fake request | bool | | the default value is false | ## ListView Widget + ListView widget, here to see flutter [ListView widget](https://docs.flutter.io/flutter/widgets/ListView-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| scrollDirection|The axis along which the scroll view scrolls. |String|enum values, please see enum Axis, default value is Axis.vertical.| "vertical" | -| reverse|Whether the scroll view scrolls in the reading direction.|bool| default value is false | | -| shrinkWrap|Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.|bool| default value is false | | -| cacheExtent|The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls.|double| default value is 0.0 | | -| padding|The amount of space by which to inset the children.|String|left,top,right,bottom|"8,10,12,8"| -| itemExtent| If non-null, forces the children to have the given extent in the scroll direction.|double||| -| pageSize| ListView load more item count for next page|double||this will be append to load more url| -| loadMoreUrl| When listview scroll to bottom, it will do the request. The response of this url should be a json array of widget|String||| -| isDemo| used in the demo, if true, will do the fake request|bool||the default value is false| -| children|The widgets below this widget in the tree. |List<Widget>| | | +| property | definition | type | value | sample | +| --------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------ | ------------------------------------ | +| scrollDirection | The axis along which the scroll view scrolls. | String | enum values, please see enum Axis, default value is Axis.vertical. | "vertical" | +| reverse | Whether the scroll view scrolls in the reading direction. | bool | default value is false | | +| shrinkWrap | Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed. | bool | default value is false | | +| cacheExtent | The viewport has an area before and after the visible area to cache items that are about to become visible when the user scrolls. | double | default value is 0.0 | | +| padding | The amount of space by which to inset the children. | String | left,top,right,bottom | "8,10,12,8" | +| itemExtent | If non-null, forces the children to have the given extent in the scroll direction. | double | | | +| pageSize | ListView load more item count for next page | int | | this will be append to load more url | +| loadMoreUrl | When listview scroll to bottom, it will do the request. The response of this url should be a json array of widget | String | | | +| isDemo | used in the demo, if true, will do the fake request | bool | | the default value is false | +| children | The widgets below this widget in the tree. | List<Widget> | | | ## PageView Widget + PageView widget, here to see flutter [PageView widget](https://docs.flutter.io/flutter/widgets/PageView-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| scrollDirection|The axis along which the scroll view scrolls. |String|enum values, please see enum Axis, default value is Axis.vertical.| "vertical" | -| reverse|Whether the scroll view scrolls in the reading direction.|bool| default value is false | | -| pageSnapping|Set to false to disable page snapping, useful for custom scroll behavior.|bool|default value is true|| -| children|The widgets below this widget in the tree. |List<Widget>| | | +| property | definition | type | value | sample | +| --------------- | ------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------ | ---------- | +| scrollDirection | The axis along which the scroll view scrolls. | String | enum values, please see enum Axis, default value is Axis.vertical. | "vertical" | +| reverse | Whether the scroll view scrolls in the reading direction. | bool | default value is false | | +| pageSnapping | Set to false to disable page snapping, useful for custom scroll behavior. | bool | default value is true | | +| children | The widgets below this widget in the tree. | List<Widget> | | | ## Expanded Widget + Expanded widget, here to see flutter [Expanded widget](https://docs.flutter.io/flutter/widgets/Expanded-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| child|child widget |Widget|| | -| flex|The flex factor to use for this child|int| default value is 1 | | +| property | definition | type | value | sample | +| -------- | ------------------------------------- | ------ | ------------------ | ------ | +| child | child widget | Widget | | | +| flex | The flex factor to use for this child | int | default value is 1 | | ## Padding Widget + Padding widget, here to see flutter [Padding widget](https://docs.flutter.io/flutter/widgets/Padding-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| child|child widget |Widget|| | -| padding|The amount of space by which to inset the child.|String|left,top,right,bottom|"8,10,12,8"| +| property | definition | type | value | sample | +| -------- | ------------------------------------------------ | ------ | --------------------- | ----------- | +| child | child widget | Widget | | | +| padding | The amount of space by which to inset the child. | String | left,top,right,bottom | "8,10,12,8" | ## Center Widget + Center widget, here to see flutter [Center widget](https://docs.flutter.io/flutter/widgets/Center-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| child|child widget |Widget|| | -| widthFactor|If non-null, sets its width to the child's width multiplied by this factor.|double||| -| heightFactor|If non-null, sets its height to the child's height multiplied by this factor. |double||| +| property | definition | type | value | sample | +| ------------ | ----------------------------------------------------------------------------- | ------ | ----- | ------ | +| child | child widget | Widget | | | +| widthFactor | If non-null, sets its width to the child's width multiplied by this factor. | double | | | +| heightFactor | If non-null, sets its height to the child's height multiplied by this factor. | double | | | ## Align Widget + Align widget, here to see flutter [Align widget](https://docs.flutter.io/flutter/widgets/Align-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alignment|How to align the child. |String|enum values, please see enum Alignment, default value is Alignment.center.| | -| child|child widget |Widget|| | -| widthFactor|If non-null, sets its width to the child's width multiplied by this factor.|double||| -| heightFactor|If non-null, sets its height to the child's height multiplied by this factor. |double||| +| property | definition | type | value | sample | +| ------------ | ----------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------- | ------ | +| alignment | How to align the child. | String | enum values, please see enum Alignment, default value is Alignment.center. | | +| child | child widget | Widget | | | +| widthFactor | If non-null, sets its width to the child's width multiplied by this factor. | double | | | +| heightFactor | If non-null, sets its height to the child's height multiplied by this factor. | double | | | ## AspectRatio Widget + AspectRatio widget, here to see flutter [AspectRatio widget](https://docs.flutter.io/flutter/widgets/AspectRatio-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| aspectRatio|The aspect ratio to attempt to use. |double|| | -| child|child widget |Widget|| | +| property | definition | type | value | sample | +| ----------- | ----------------------------------- | ------ | ----- | ------ | +| aspectRatio | The aspect ratio to attempt to use. | double | | | +| child | child widget | Widget | | | ## FittedBox Widget + FittedBox widget, here to see flutter [FittedBox widget](https://docs.flutter.io/flutter/widgets/FittedBox-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alignment|How to align the child within its parent's bounds. |String|enum values, please see enum Alignment, default value is Alignment.center.| | -| fit|How to inscribe the child into the space allocated during layout. |String|enum values, please see enum BoxFit, default value is BoxFit.contain.| | -| child|child widget |Widget|| | +| property | definition | type | value | sample | +| --------- | ----------------------------------------------------------------- | ------ | -------------------------------------------------------------------------- | ------ | +| alignment | How to align the child within its parent's bounds. | String | enum values, please see enum Alignment, default value is Alignment.center. | | +| fit | How to inscribe the child into the space allocated during layout. | String | enum values, please see enum BoxFit, default value is BoxFit.contain. | | +| child | child widget | Widget | | | ## Baseline Widget + Baseline widget, here to see flutter [Baseline widget](https://docs.flutter.io/flutter/widgets/Baseline-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| baseline|The number of logical pixels from the top of this box at which to position the child's baseline. |double| | | -| baselineType|The type of baseline to use for positioning the child. |String|enum values, please see enum TextBaseline, default value is TextBaseline.ideographic.| | -| child|child widget |Widget|| | +| property | definition | type | value | sample | +| ------------ | ------------------------------------------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------------- | ------ | +| baseline | The number of logical pixels from the top of this box at which to position the child's baseline. | double | | | +| baselineType | The type of baseline to use for positioning the child. | String | enum values, please see enum TextBaseline, default value is TextBaseline.ideographic. | | +| child | child widget | Widget | | | ## Stack Widget + Stack widget, here to see flutter [Stack widget](https://docs.flutter.io/flutter/widgets/Stack-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alignment|How to align the non-positioned and partially-positioned children in the stack.|String|enum values, please see enum Alignment, default value is Alignment.center. |"center"| -| fit|How to size the non-positioned children in the stack. |String|enum values, please see enum StackFit, default value is StackFit.loose.| | -| clipBehavior|The content will be clipped (or not) according to this option. |String|enum values, please see enum Clip, default value is Clip.hardEdge.| | -| textDirection|The text direction with which to resolve alignment. |String|enum values, please see enum TextDirection| | -| children|list of Widget |List<Widget>|| | +| property | definition | type | value | sample | +| ------------- | ------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------- | -------- | +| alignment | How to align the non-positioned and partially-positioned children in the stack. | String | enum values, please see enum Alignment, default value is Alignment.center. | "center" | +| fit | How to size the non-positioned children in the stack. | String | enum values, please see enum StackFit, default value is StackFit.loose. | | +| clipBehavior | The content will be clipped (or not) according to this option. | String | enum values, please see enum Clip, default value is Clip.hardEdge. | | +| textDirection | The text direction with which to resolve alignment. | String | enum values, please see enum TextDirection | | +| children | list of Widget | List<Widget> | | | ## Positioned Widget + Positioned widget, here to see flutter [Positioned widget](https://docs.flutter.io/flutter/widgets/Positioned-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| bottom|The distance that the child's bottom edge is inset from the bottom of the stack.|double| || -| height |The child's height.|double| || -| left |The distance that the child's left edge is inset from the left of the stack.|double| || -| right |The distance that the child's right edge is inset from the right of the stack. |double| || -| top|The distance that the child's top edge is inset from the top of the stack. |double| || -| width |The child's width.|double| || -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| -------- | -------------------------------------------------------------------------------- | ------ | ----- | ------ | +| bottom | The distance that the child's bottom edge is inset from the bottom of the stack. | double | | | +| height | The child's height. | double | | | +| left | The distance that the child's left edge is inset from the left of the stack. | double | | | +| right | The distance that the child's right edge is inset from the right of the stack. | double | | | +| top | The distance that the child's top edge is inset from the top of the stack. | double | | | +| width | The child's width. | double | | | +| child | The widget below this widget in the tree. | Widget | | | ## IndexedStack Widget + IndexedStack widget, here to see flutter [IndexedStack widget](https://docs.flutter.io/flutter/widgets/IndexedStack-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| index |The index of the child to show.|int| || -| alignment|How to align the non-positioned and partially-positioned children in the stack.|String|enum values, please see enum Alignment, default value is Alignment.center. |"center"| -| textDirection|The text direction with which to resolve alignment. |String|enum values, please see enum TextDirection| | -| children|list of Widget |List<Widget>|| | +| property | definition | type | value | sample | +| ------------- | ------------------------------------------------------------------------------- | -------------------- | -------------------------------------------------------------------------- | -------- | +| index | The index of the child to show. | int | | | +| alignment | How to align the non-positioned and partially-positioned children in the stack. | String | enum values, please see enum Alignment, default value is Alignment.center. | "center" | +| textDirection | The text direction with which to resolve alignment. | String | enum values, please see enum TextDirection | | +| children | list of Widget | List<Widget> | | | ## ExpandedSizedBox Widget + ExpandedSizedBox widget, here to see flutter [ExpandedSizedBox widget](https://docs.flutter.io/flutter/widgets/SizedBox-class.html) definition. It's a shortcut of **SizedBox.expand**. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| -------- | ----------------------------------------- | ------ | ----- | ------ | +| child | The widget below this widget in the tree. | Widget | | | ## SizedBox Widget + SizedBox widget, here to see flutter [SizedBox widget](https://docs.flutter.io/flutter/widgets/SizedBox-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| width |If non-null, requires the child to have exactly this width.|double| || -| height |If non-null, requires the child to have exactly this height.|double| || -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| -------- | ------------------------------------------------------------ | ------ | ----- | ------ | +| width | If non-null, requires the child to have exactly this width. | double | | | +| height | If non-null, requires the child to have exactly this height. | double | | | +| child | The widget below this widget in the tree. | Widget | | | ## Opacity Widget + Opacity widget, here to see flutter [Opacity widget](https://docs.flutter.io/flutter/widgets/Opacity-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alwaysIncludeSemantics |Whether the semantic information of the children is always included.|bool| || -| opacity |The fraction to scale the child's alpha value.|double| || -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| ---------------------- | -------------------------------------------------------------------- | ------ | ----- | ------ | +| alwaysIncludeSemantics | Whether the semantic information of the children is always included. | bool | | | +| opacity | The fraction to scale the child's alpha value. | double | | | +| child | The widget below this widget in the tree. | Widget | | | ## Wrap Widget + Wrap widget, here to see flutter [Wrap widget](https://docs.flutter.io/flutter/widgets/Wrap-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| alignment |How the children within a run should be placed in the main axis.|String|enum values, please see enum WrapAlignment, default value is WrapAlignment.start. |"start"| -| crossAxisAlignment |How the children within a run should be aligned relative to each other in the cross axis.|String|enum values, please see enum WrapCrossAlignment, default value is WrapCrossAlignment.start. |"start"| -| direction |The direction to use as the main axis.|String|enum values, please see enum Axis, default value is Axis.horizontal. |"horizontal"| -| runAlignment |How the runs themselves should be placed in the cross axis. |String|enum values, please see enum WrapAlignment, default value is WrapAlignment.start. |"start"| -| runSpacing |The fraction to scale the child's alpha value.|double| |0.0| -| spacing |How much space to place between children in a run in the main axis.|double| |0.0| -| textDirection |Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction.|String|enum values, please see enum TextDirection, default value is null. |null| -| verticalDirection |Determines the order to lay children out vertically and how to interpret start and end in the vertical direction. |String|enum values, please see enum VerticalDirection, default value is VerticalDirection.down. |"down"| -| children|The widgets below this widget in the tree. |List<Widget>| | | +| property | definition | type | value | sample | +| ------------------ | --------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------- | ------------ | +| alignment | How the children within a run should be placed in the main axis. | String | enum values, please see enum WrapAlignment, default value is WrapAlignment.start. | "start" | +| crossAxisAlignment | How the children within a run should be aligned relative to each other in the cross axis. | String | enum values, please see enum WrapCrossAlignment, default value is WrapCrossAlignment.start. | "start" | +| direction | The direction to use as the main axis. | String | enum values, please see enum Axis, default value is Axis.horizontal. | "horizontal" | +| runAlignment | How the runs themselves should be placed in the cross axis. | String | enum values, please see enum WrapAlignment, default value is WrapAlignment.start. | "start" | +| runSpacing | The fraction to scale the child's alpha value. | double | | 0.0 | +| spacing | How much space to place between children in a run in the main axis. | double | | 0.0 | +| textDirection | Determines the order to lay children out horizontally and how to interpret start and end in the horizontal direction. | String | enum values, please see enum TextDirection, default value is null. | null | +| verticalDirection | Determines the order to lay children out vertically and how to interpret start and end in the vertical direction. | String | enum values, please see enum VerticalDirection, default value is VerticalDirection.down. | "down" | +| children | The widgets below this widget in the tree. | List<Widget> | | | ## ClipRRect Widget + ClipRRect, here to see flutter [ClipRRect](https://api.flutter.dev/flutter/widgets/ClipRRect-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| borderRadius|The border radius of the rounded corners. |String| |"topLeft,topRight,bottomLeft,bottomRight"| -| clipBehavior|Controls how to clip (default to "antiAlias")|String|enum values, please see enum Clip, default value is antiAlias. | "hardEdge"| -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| ------------ | --------------------------------------------- | ------ | -------------------------------------------------------------- | ----------------------------------------- | +| borderRadius | The border radius of the rounded corners. | String | | "topLeft,topRight,bottomLeft,bottomRight" | +| clipBehavior | Controls how to clip (default to "antiAlias") | String | enum values, please see enum Clip, default value is antiAlias. | "hardEdge" | +| child | The widget below this widget in the tree. | Widget | | | ## SafeArea Widget + SafeArea, here to see flutter [SafeArea](https://api.flutter.dev/flutter/widgets/SafeArea-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| bottom |Whether to avoid system intrusions on the bottom side of the screen.|bool| true or false, default is true|true| -| right |Whether to avoid system intrusions on the right.|bool| true or false, default is true|true| -| top |Whether to avoid system intrusions at the top of the screen, typically the system status bar.|bool| true or false, default is true|true| -| left |Whether to avoid system intrusions on the left.|bool| true or false, default is true|true| -| minimum |This minimum padding to apply.|String|left,top,right,bottom|"8,10,12,8"| -| child|The widget below this widget in the tree. |Widget|| | +| property | definition | type | value | sample | +| -------- | --------------------------------------------------------------------------------------------- | ------ | ------------------------------ | ----------- | +| bottom | Whether to avoid system intrusions on the bottom side of the screen. | bool | true or false, default is true | true | +| right | Whether to avoid system intrusions on the right. | bool | true or false, default is true | true | +| top | Whether to avoid system intrusions at the top of the screen, typically the system status bar. | bool | true or false, default is true | true | +| left | Whether to avoid system intrusions on the left. | bool | true or false, default is true | true | +| minimum | This minimum padding to apply. | String | left,top,right,bottom | "8,10,12,8" | +| child | The widget below this widget in the tree. | Widget | | | ## ListTile Widget + ListTile, here to see flutter [ListTile](https://api.flutter.dev/flutter/material/ListTile-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| contentPadding |The tile's internal padding.|String| left,top,right,bottom|"8,10,12,8"| -| dense |Whether this list tile is part of a vertically dense list.|bool| true or false, default is false|true| -| enabled |Whether this list tile is interactive.|bool| true or false, default is true|true| -| isThreeLine |Whether this list tile is intended to display three lines of text.|bool| true or false, default is false|true| -| leading |A widget to display before the title.|Widget||| -| tapEvent |tap event |String||route://goToProductDetail| -| selected |If this tile is also enabled then icons and text are rendered with the same color.|bool| true or false, default is false|true| -| subtitle |Additional content displayed below the title.|Widget||| -| title |The primary content of the list tile.|Widget||| -| trailing |A widget to display after the title.|Widget||| +| property | definition | type | value | sample | +| -------------- | ---------------------------------------------------------------------------------- | ------ | ------------------------------- | ------------------------- | +| contentPadding | The tile's internal padding. | String | left,top,right,bottom | "8,10,12,8" | +| dense | Whether this list tile is part of a vertically dense list. | bool | true or false, default is false | true | +| enabled | Whether this list tile is interactive. | bool | true or false, default is true | true | +| isThreeLine | Whether this list tile is intended to display three lines of text. | bool | true or false, default is false | true | +| leading | A widget to display before the title. | Widget | | | +| tapEvent | tap event | String | | route://goToProductDetail | +| selected | If this tile is also enabled then icons and text are rendered with the same color. | bool | true or false, default is false | true | +| subtitle | Additional content displayed below the title. | Widget | | | +| title | The primary content of the list tile. | Widget | | | +| trailing | A widget to display after the title. | Widget | | | ## SelectableText Widget + SelectableText, here to see flutter [SelectableText](https://api.flutter.dev/flutter/material/SelectableText-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| data|The text to display|String| |"I am a text"| -| textAlign|How the text should be aligned horizontally.|String|One of the following string:
left (default)
right
center
justify
start
end|"left"| -| maxLines|An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. |int| |3| -| textDirection|The directionality of the text.|String| One of the following string:
ltr (default)
rtl |"ltr"| -| textSpan|The text to display as a TextSpan. |TextSpan| | | +| property | definition | type | value | sample | +| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------------------------- | ------------- | +| data | The text to display | String | | "I am a text" | +| textAlign | How the text should be aligned horizontally. | String | One of the following string:
left (default)
right
center
justify
start
end | "left" | +| maxLines | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. | int | | 3 | +| textDirection | The directionality of the text. | String | One of the following string:
ltr (default)
rtl | "ltr" | +| textSpan | The text to display as a TextSpan. | TextSpan | | | ## Icon Widget + Icon, here to see flutter [Icon](https://api.flutter.dev/flutter/widgets/Icon-class.html) definition. Supported json properties: -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| data|The icon to display. The available icons are described |String| |"fa.google" : font_awesome_flutter lib's icon, "favorite" : flutter's icon| -| size|The size of the icon in logical pixels. |double||12.0| -| color|The color to use when drawing the icon.|String| "#AARRGGBB" or "#RRGGBB"|"#FF00FF"
"#00FF00FF"| -| semanticLabel|Semantic label for the icon.|String| || -| textDirection|The text direction to use for rendering the icon.|String| One of the following string:
ltr (default)
rtl |"ltr"| +| property | definition | type | value | sample | +| ------------- | ------------------------------------------------------ | ------ | ----------------------------------------------------- | -------------------------------------------------------------------------- | +| data | The icon to display. The available icons are described | String | | "fa.google" : font_awesome_flutter lib's icon, "favorite" : flutter's icon | +| size | The size of the icon in logical pixels. | double | | 12.0 | +| color | The color to use when drawing the icon. | String | "#AARRGGBB" or "#RRGGBB" | "#FF00FF"
"#00FF00FF" | +| semanticLabel | Semantic label for the icon. | String | | | +| textDirection | The text direction to use for rendering the icon. | String | One of the following string:
ltr (default)
rtl | "ltr" | ## DropCapText Widget -DropCapText, Supported json properties: - -| property | definition | type | value | sample | -| ---| ---| --- | ---| ---| -| data|The text to display |String| ||"I am a text"| -| selectable|Text can be selected |bool||| -| mode|Drop cap mode|String| One of the following string:
inside (default)
upwards
aside
baseline |"#FF00FF"
"#00FF00FF"| -| style|The style to apply to the text and the children.|TextStyle| | {"color": "#00FFFF", "fontSize": 26.0}| -| dropCapStyle|The drop cap letter style|TextStyle| | {"color": "#00FFFF", "fontSize": 26.0}| -| textAlign|How the text should be aligned horizontally.|String|One of the following string:
left (default)
right
center
justify
start
end|"left"| -| dropCap|The drop cap |Widget | {"width":216.1,"height":162.1,"child":{"type":"NetworkImage","src":"https://b.appsimg.com/upload/momin/2019/01/23/101/1548249269085.png ","click_event" : "route://productDetail?goods_id=123"}}| -| dropCapStyle|The drop cap padding|String|left,top,right,bottom|"8,10,12,8"| -| dropCapChars|The drop cap chars length|int||1| -| forceNoDescent|forceNoDescent|bool||| -| parseInlineMarkdown|if parse markdown |bool||| -| textDirection|The directionality of the text.|String| One of the following string:
ltr (default)
rtl |"ltr"| -| overflow|How visual overflow should be handled.|String|One of the following string:
ellipsis (default)
clip
fade|"ellipsis"| -| maxLines|An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. |int| One of the following string:
start (default)
end|"end"| -| dropCapPosition|drop cap position |String| |3| - +DropCapText, Supported json properties: + +| property | definition | type | value | sample | +| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------- | +| data | The text to display | String | | | "I am a text" | +| selectable | Text can be selected | bool | | | +| mode | Drop cap mode | String | One of the following string:
inside (default)
upwards
aside
baseline | "#FF00FF"
"#00FF00FF" | +| style | The style to apply to the text and the children. | TextStyle | | {"color": "#00FFFF", "fontSize": 26.0} | +| dropCapStyle | The drop cap letter style | TextStyle | | {"color": "#00FFFF", "fontSize": 26.0} | +| textAlign | How the text should be aligned horizontally. | String | One of the following string:
left (default)
right
center
justify
start
end | "left" | +| dropCap | The drop cap | Widget | {"width":216.1,"height":162.1,"child":{"type":"NetworkImage","src":"https://b.appsimg.com/upload/momin/2019/01/23/101/1548249269085.png ","click_event" : "route://productDetail?goods_id=123"}} | +| dropCapStyle | The drop cap padding | String | left,top,right,bottom | "8,10,12,8" | +| dropCapChars | The drop cap chars length | int | | 1 | +| forceNoDescent | forceNoDescent | bool | | | +| parseInlineMarkdown | if parse markdown | bool | | | +| textDirection | The directionality of the text. | String | One of the following string:
ltr (default)
rtl | "ltr" | +| overflow | How visual overflow should be handled. | String | One of the following string:
ellipsis (default)
clip
fade | "ellipsis" | +| maxLines | An optional maximum number of lines for the text to span, wrapping if necessary. If the text exceeds the given number of lines, it will be truncated according to overflow. | int | One of the following string:
start (default)
end | "end" | +| dropCapPosition | drop cap position | String | | 3 | diff --git a/lib/dynamic_widget/basic/align_widget_parser.dart b/lib/dynamic_widget/basic/align_widget_parser.dart index 5d70469..b57047b 100644 --- a/lib/dynamic_widget/basic/align_widget_parser.dart +++ b/lib/dynamic_widget/basic/align_widget_parser.dart @@ -10,9 +10,9 @@ class AlignWidgetParser extends WidgetParser { alignment: map.containsKey("alignment") ? parseAlignment(map["alignment"]) : Alignment.center, - widthFactor: map.containsKey("widthFactor") ? map["widthFactor"] : null, + widthFactor: map.containsKey("widthFactor") ? map["widthFactor"]?.toDouble() : null, heightFactor: - map.containsKey("heightFactor") ? map["heightFactor"] : null, + map.containsKey("heightFactor") ? map["heightFactor"]?.toDouble() : null, child: DynamicWidgetBuilder.buildFromMap( map["child"], buildContext, listener), ); diff --git a/lib/dynamic_widget/basic/aspectratio_widget_parser.dart b/lib/dynamic_widget/basic/aspectratio_widget_parser.dart index 88b8ef6..fb5a800 100644 --- a/lib/dynamic_widget/basic/aspectratio_widget_parser.dart +++ b/lib/dynamic_widget/basic/aspectratio_widget_parser.dart @@ -6,7 +6,7 @@ class AspectRatioWidgetParser extends WidgetParser { Widget parse(Map map, BuildContext buildContext, ClickListener listener) { return AspectRatio( - aspectRatio: map["aspectRatio"], + aspectRatio: map["aspectRatio"]?.toDouble(), child: DynamicWidgetBuilder.buildFromMap( map["child"], buildContext, listener), ); diff --git a/lib/dynamic_widget/basic/baseline_widget_parser.dart b/lib/dynamic_widget/basic/baseline_widget_parser.dart index 11e736f..4ebb990 100644 --- a/lib/dynamic_widget/basic/baseline_widget_parser.dart +++ b/lib/dynamic_widget/basic/baseline_widget_parser.dart @@ -6,7 +6,7 @@ class BaselineWidgetParser extends WidgetParser { Widget parse(Map map, BuildContext buildContext, ClickListener listener) { return Baseline( - baseline: map["baseline"], + baseline: map["baseline"]?.toDouble(), baselineType: map["baselineType"] == "alphabetic" ? TextBaseline.alphabetic : TextBaseline.ideographic, @@ -24,8 +24,10 @@ class BaselineWidgetParser extends WidgetParser { return { "type": widgetName, "baseline": realWidget.baseline, - "baselineType" : realWidget.baselineType == TextBaseline.alphabetic ? "alphabetic":"ideographic", - "child":DynamicWidgetBuilder.export(realWidget.child, buildContext) + "baselineType": realWidget.baselineType == TextBaseline.alphabetic + ? "alphabetic" + : "ideographic", + "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } diff --git a/lib/dynamic_widget/basic/button_widget_parser.dart b/lib/dynamic_widget/basic/button_widget_parser.dart index d79c638..8bfb383 100644 --- a/lib/dynamic_widget/basic/button_widget_parser.dart +++ b/lib/dynamic_widget/basic/button_widget_parser.dart @@ -14,12 +14,14 @@ class RaisedButtonParser extends WidgetParser { disabledColor: map.containsKey('disabledColor') ? parseHexColor(map['disabledColor']) : null, - disabledElevation: - map.containsKey('disabledElevation') ? map['disabledElevation'] : 0.0, + disabledElevation: map.containsKey('disabledElevation') + ? map['disabledElevation']?.toDouble() + : 0.0, disabledTextColor: map.containsKey('disabledTextColor') ? parseHexColor(map['disabledTextColor']) : null, - elevation: map.containsKey('elevation') ? map['elevation'] : 0.0, + elevation: + map.containsKey('elevation') ? map['elevation']?.toDouble() : 0.0, padding: map.containsKey('padding') ? parseEdgeInsetsGeometry(map['padding']) : null, @@ -48,16 +50,27 @@ class RaisedButtonParser extends WidgetParser { return { "type": widgetName, - "color": realWidget.color != null ? realWidget.color.value.toRadixString(16):null, - "disabledColor" : realWidget.disabledColor !=null? realWidget.disabledColor.value.toRadixString(16):null, + "color": realWidget.color != null + ? realWidget.color.value.toRadixString(16) + : null, + "disabledColor": realWidget.disabledColor != null + ? realWidget.disabledColor.value.toRadixString(16) + : null, "disabledElevation": realWidget.disabledElevation, - "disabledTextColor": realWidget.disabledTextColor!=null ?realWidget.disabledTextColor.value.toRadixString(16):null, + "disabledTextColor": realWidget.disabledTextColor != null + ? realWidget.disabledTextColor.value.toRadixString(16) + : null, "elevation": realWidget.elevation, - "padding": padding !=null ? "${padding.left},${padding.top},${padding.right},${padding.bottom}" : null, - "splashColor": realWidget.splashColor!=null ? realWidget.splashColor.value.toRadixString(16) : null, - "textColor": realWidget.textColor!=null?realWidget.textColor.value.toRadixString(16):null, - "child":DynamicWidgetBuilder.export(realWidget.child, buildContext) - + "padding": padding != null + ? "${padding.left},${padding.top},${padding.right},${padding.bottom}" + : null, + "splashColor": realWidget.splashColor != null + ? realWidget.splashColor.value.toRadixString(16) + : null, + "textColor": realWidget.textColor != null + ? realWidget.textColor.value.toRadixString(16) + : null, + "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } diff --git a/lib/dynamic_widget/basic/center_widget_parser.dart b/lib/dynamic_widget/basic/center_widget_parser.dart index 298322c..4279aef 100644 --- a/lib/dynamic_widget/basic/center_widget_parser.dart +++ b/lib/dynamic_widget/basic/center_widget_parser.dart @@ -6,9 +6,9 @@ class CenterWidgetParser extends WidgetParser { Widget parse(Map map, BuildContext buildContext, ClickListener listener) { return Center( - widthFactor: map.containsKey("widthFactor") ? map["widthFactor"] : null, + widthFactor: map.containsKey("widthFactor") ? map["widthFactor"]?.toDouble() : null, heightFactor: - map.containsKey("heightFactor") ? map["heightFactor"] : null, + map.containsKey("heightFactor") ? map["heightFactor"]?.toDouble() : null, child: DynamicWidgetBuilder.buildFromMap( map["child"], buildContext, listener), ); diff --git a/lib/dynamic_widget/basic/container_widget_parser.dart b/lib/dynamic_widget/basic/container_widget_parser.dart index f223aa6..11becab 100644 --- a/lib/dynamic_widget/basic/container_widget_parser.dart +++ b/lib/dynamic_widget/basic/container_widget_parser.dart @@ -25,8 +25,8 @@ class ContainerWidgetParser extends WidgetParser { padding: padding, color: color, margin: margin, - width: map['width'], - height: map['height'], + width: map['width']?.toDouble(), + height: map['height']?.toDouble(), constraints: constraints, child: child, ); diff --git a/lib/dynamic_widget/basic/icon_widget_parser.dart b/lib/dynamic_widget/basic/icon_widget_parser.dart index ac9eeaf..048b5ed 100644 --- a/lib/dynamic_widget/basic/icon_widget_parser.dart +++ b/lib/dynamic_widget/basic/icon_widget_parser.dart @@ -11,7 +11,7 @@ class IconWidgetParser extends WidgetParser { map.containsKey('data') ? getIconUsingPrefix(name: map['data']) : Icons.android, - size: map.containsKey("size") ? map['size'] : null, + size: map.containsKey("size") ? map['size']?.toDouble() : null, color: map.containsKey('color') ? parseHexColor(map['color']) : null, semanticLabel: map.containsKey('semanticLabel') ? map['semanticLabel'] : null, @@ -31,9 +31,13 @@ class IconWidgetParser extends WidgetParser { "type": widgetName, "data": exportIconGuessFavorMaterial(realWidget.icon), "size": realWidget.size, - "color": realWidget.color!=null?realWidget.color.value.toRadixString(16):null, + "color": realWidget.color != null + ? realWidget.color.value.toRadixString(16) + : null, "semanticLabel": realWidget.semanticLabel, - "textDirection": realWidget.textDirection!=null? exportTextDirection(realWidget.textDirection):null, + "textDirection": realWidget.textDirection != null + ? exportTextDirection(realWidget.textDirection) + : null, }; } diff --git a/lib/dynamic_widget/basic/image_widget_parser.dart b/lib/dynamic_widget/basic/image_widget_parser.dart index 9fa05fa..1a93dfa 100644 --- a/lib/dynamic_widget/basic/image_widget_parser.dart +++ b/lib/dynamic_widget/basic/image_widget_parser.dart @@ -14,9 +14,9 @@ class AssetImageWidgetParser extends WidgetParser { bool excludeFromSemantics = map.containsKey('excludeFromSemantics') ? map['excludeFromSemantics'] : false; - double scale = map.containsKey("scale") ? map['scale'] : null; - double width = map.containsKey('width') ? map['width'] : null; - double height = map.containsKey('height') ? map['height'] : null; + double scale = map.containsKey("scale") ? map['scale']?.toDouble() : null; + double width = map.containsKey('width') ? map['width']?.toDouble() : null; + double height = map.containsKey('height') ? map['height']?.toDouble() : null; Color color = map.containsKey('color') ? parseHexColor(map['color']) : null; BlendMode blendMode = map.containsKey('blendMode') ? parseBlendMode(map['blendMode']) : null; @@ -184,9 +184,9 @@ class NetworkImageWidgetParser extends WidgetParser { bool excludeFromSemantics = map.containsKey('excludeFromSemantics') ? map['excludeFromSemantics'] : false; - double scale = map.containsKey("scale") ? map['scale'] : 1.0; - double width = map.containsKey('width') ? map['width'] : null; - double height = map.containsKey('height') ? map['height'] : null; + double scale = map.containsKey("scale") ? map['scale']?.toDouble() : 1.0; + double width = map.containsKey('width') ? map['width']?.toDouble() : null; + double height = map.containsKey('height') ? map['height']?.toDouble() : null; Color color = map.containsKey('color') ? parseHexColor(map['color']) : null; BlendMode blendMode = map.containsKey('blendMode') ? parseBlendMode(map['blendMode']) : null; diff --git a/lib/dynamic_widget/basic/opacity_widget_parser.dart b/lib/dynamic_widget/basic/opacity_widget_parser.dart index 44c198e..e7a45b0 100644 --- a/lib/dynamic_widget/basic/opacity_widget_parser.dart +++ b/lib/dynamic_widget/basic/opacity_widget_parser.dart @@ -6,7 +6,7 @@ class OpacityWidgetParser extends WidgetParser { Widget parse(Map map, BuildContext buildContext, ClickListener listener) { return Opacity( - opacity: map["opacity"], + opacity: map["opacity"]?.toDouble(), alwaysIncludeSemantics: map.containsKey("alwaysIncludeSemantics") ? map["alwaysIncludeSemantics"] : false, diff --git a/lib/dynamic_widget/basic/placeholder_widget_parser.dart b/lib/dynamic_widget/basic/placeholder_widget_parser.dart index 8716352..fcdba56 100644 --- a/lib/dynamic_widget/basic/placeholder_widget_parser.dart +++ b/lib/dynamic_widget/basic/placeholder_widget_parser.dart @@ -10,11 +10,11 @@ class PlaceholderWidgetParser extends WidgetParser { color: map.containsKey('color') ? parseHexColor(map['color']) : const Color(0xFF455A64), - strokeWidth: map.containsKey('strokeWidth') ? map['strokeWidth'] : 2.0, + strokeWidth: map.containsKey('strokeWidth') ? map['strokeWidth']?.toDouble() : 2.0, fallbackWidth: - map.containsKey('fallbackWidth') ? map['fallbackWidth'] : 400.0, + map.containsKey('fallbackWidth') ? map['fallbackWidth']?.toDouble() : 400.0, fallbackHeight: - map.containsKey('fallbackHeight') ? map['fallbackHeight'] : 400.0, + map.containsKey('fallbackHeight') ? map['fallbackHeight']?.toDouble() : 400.0, ); } diff --git a/lib/dynamic_widget/basic/stack_positioned_widgets_parser.dart b/lib/dynamic_widget/basic/stack_positioned_widgets_parser.dart index 26d2f0b..2e978a0 100644 --- a/lib/dynamic_widget/basic/stack_positioned_widgets_parser.dart +++ b/lib/dynamic_widget/basic/stack_positioned_widgets_parser.dart @@ -9,12 +9,12 @@ class PositionedWidgetParser extends WidgetParser { return Positioned( child: DynamicWidgetBuilder.buildFromMap( map["child"], buildContext, listener), - top: map.containsKey("top") ? map["top"] : null, - right: map.containsKey("right") ? map["right"] : null, - bottom: map.containsKey("bottom") ? map["bottom"] : null, - left: map.containsKey("left") ? map["left"] : null, - width: map.containsKey("width") ? map["width"] : null, - height: map.containsKey("height") ? map["height"] : null, + top: map.containsKey("top") ? map["top"]?.toDouble() : null, + right: map.containsKey("right") ? map["right"]?.toDouble() : null, + bottom: map.containsKey("bottom") ? map["bottom"]?.toDouble() : null, + left: map.containsKey("left") ? map["left"]?.toDouble() : null, + width: map.containsKey("width") ? map["width"]?.toDouble() : null, + height: map.containsKey("height") ? map["height"]?.toDouble() : null, ); } diff --git a/lib/dynamic_widget/basic/text_widget_parser.dart b/lib/dynamic_widget/basic/text_widget_parser.dart index 91c9d3a..92aa039 100644 --- a/lib/dynamic_widget/basic/text_widget_parser.dart +++ b/lib/dynamic_widget/basic/text_widget_parser.dart @@ -14,7 +14,7 @@ class TextWidgetParser implements WidgetParser { String semanticsLabel = map['semanticsLabel']; bool softWrap = map['softWrap']; String textDirectionString = map['textDirection']; - double textScaleFactor = map['textScaleFactor']; + double textScaleFactor = map['textScaleFactor']?.toDouble(); var textSpan; var textSpanParser = TextSpanParser(); if (map.containsKey("textSpan")) { diff --git a/lib/dynamic_widget/basic/wrap_widget_parser.dart b/lib/dynamic_widget/basic/wrap_widget_parser.dart index 2424f89..a236e85 100644 --- a/lib/dynamic_widget/basic/wrap_widget_parser.dart +++ b/lib/dynamic_widget/basic/wrap_widget_parser.dart @@ -13,11 +13,11 @@ class WrapWidgetParser extends WidgetParser { alignment: map.containsKey("alignment") ? parseWrapAlignment(map["alignment"]) : WrapAlignment.start, - spacing: map.containsKey("spacing") ? map["spacing"] : 0.0, + spacing: map.containsKey("spacing") ? map["spacing"]?.toDouble() : 0.0, runAlignment: map.containsKey("runAlignment") ? parseWrapAlignment(map["runAlignment"]) : WrapAlignment.start, - runSpacing: map.containsKey("runSpacing") ? map["runSpacing"] : 0.0, + runSpacing: map.containsKey("runSpacing") ? map["runSpacing"]?.toDouble() : 0.0, crossAxisAlignment: map.containsKey("crossAxisAlignment") ? parseWrapCrossAlignment(map["crossAxisAlignment"]) : WrapCrossAlignment.start, diff --git a/lib/dynamic_widget/scrolling/gridview_widget_parser.dart b/lib/dynamic_widget/scrolling/gridview_widget_parser.dart index 5c306b4..d6ed8c9 100644 --- a/lib/dynamic_widget/scrolling/gridview_widget_parser.dart +++ b/lib/dynamic_widget/scrolling/gridview_widget_parser.dart @@ -20,16 +20,16 @@ class GridViewWidgetParser extends WidgetParser { bool reverse = map.containsKey("reverse") ? map['reverse'] : false; bool shrinkWrap = map.containsKey("shrinkWrap") ? map["shrinkWrap"] : false; double cacheExtent = - map.containsKey("cacheExtent") ? map["cacheExtent"] : 0.0; + map.containsKey("cacheExtent") ? map["cacheExtent"]?.toDouble() : 0.0; EdgeInsetsGeometry padding = map.containsKey('padding') ? parseEdgeInsetsGeometry(map['padding']) : null; double mainAxisSpacing = - map.containsKey('mainAxisSpacing') ? map['mainAxisSpacing'] : 0.0; + map.containsKey('mainAxisSpacing') ? map['mainAxisSpacing']?.toDouble() : 0.0; double crossAxisSpacing = - map.containsKey('crossAxisSpacing') ? map['crossAxisSpacing'] : 0.0; + map.containsKey('crossAxisSpacing') ? map['crossAxisSpacing']?.toDouble() : 0.0; double childAspectRatio = - map.containsKey('childAspectRatio') ? map['childAspectRatio'] : 1.0; + map.containsKey('childAspectRatio') ? map['childAspectRatio']?.toDouble() : 1.0; var children = DynamicWidgetBuilder.buildWidgets( map['children'], buildContext, listener); diff --git a/lib/dynamic_widget/scrolling/listview_widget_parser.dart b/lib/dynamic_widget/scrolling/listview_widget_parser.dart index 05fe812..2a46554 100644 --- a/lib/dynamic_widget/scrolling/listview_widget_parser.dart +++ b/lib/dynamic_widget/scrolling/listview_widget_parser.dart @@ -19,11 +19,11 @@ class ListViewWidgetParser extends WidgetParser { var reverse = map.containsKey("reverse") ? map['reverse'] : false; var shrinkWrap = map.containsKey("shrinkWrap") ? map["shrinkWrap"] : false; - var cacheExtent = map.containsKey("cacheExtent") ? map["cacheExtent"] : 0.0; + var cacheExtent = map.containsKey("cacheExtent") ? map["cacheExtent"]?.toDouble() : 0.0; var padding = map.containsKey('padding') ? parseEdgeInsetsGeometry(map['padding']) : null; - var itemExtent = map.containsKey("itemExtent") ? map["itemExtent"] : null; + var itemExtent = map.containsKey("itemExtent") ? map["itemExtent"]?.toDouble() : null; var children = DynamicWidgetBuilder.buildWidgets( map['children'], buildContext, listener); var pageSize = map.containsKey("pageSize") ? map["pageSize"] : 10; diff --git a/lib/dynamic_widget/utils.dart b/lib/dynamic_widget/utils.dart index 56ed176..5614214 100644 --- a/lib/dynamic_widget/utils.dart +++ b/lib/dynamic_widget/utils.dart @@ -235,7 +235,7 @@ TextStyle parseTextStyle(Map map) { String debugLabel = map['debugLabel']; String decoration = map['decoration']; String fontFamily = map['fontFamily']; - double fontSize = map['fontSize']; + double fontSize = map['fontSize']?.toDouble(); String fontWeight = map['fontWeight']; FontStyle fontStyle = 'italic' == map['fontStyle'] ? FontStyle.italic : FontStyle.normal; @@ -311,7 +311,7 @@ BoxConstraints parseBoxConstraints(Map map) { if (map != null) { if (map.containsKey('minWidth')) { - var minWidthValue = map['minWidth']; + var minWidthValue = map['minWidth']?.toDouble(); if (minWidthValue != null) { if (minWidthValue >= infinity) { @@ -323,7 +323,7 @@ BoxConstraints parseBoxConstraints(Map map) { } if (map.containsKey('maxWidth')) { - var maxWidthValue = map['maxWidth']; + var maxWidthValue = map['maxWidth']?.toDouble(); if (maxWidthValue != null) { if (maxWidthValue >= infinity) { @@ -335,7 +335,7 @@ BoxConstraints parseBoxConstraints(Map map) { } if (map.containsKey('minHeight')) { - var minHeightValue = map['minHeight']; + var minHeightValue = map['minHeight']?.toDouble(); if (minHeightValue != null) { if (minHeightValue >= infinity) { @@ -347,7 +347,7 @@ BoxConstraints parseBoxConstraints(Map map) { } if (map.containsKey('maxHeight')) { - var maxHeightValue = map['maxHeight']; + var maxHeightValue = map['maxHeight']?.toDouble(); if (maxHeightValue != null) { if (maxHeightValue >= infinity) { @@ -1032,8 +1032,8 @@ DropCap parseDropCap(Map map, BuildContext buildContext, return null; } return DropCap( - width: map['width'], - height: map['height'], + width: map['width']?.toDouble(), + height: map['height']?.toDouble(), child: DynamicWidgetBuilder.buildFromMap(map["child"], buildContext, listener), ); From 05759a04cca42125454fb9ebf1931797d4cf8513 Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 20 Nov 2020 12:30:59 +0700 Subject: [PATCH 8/8] export constraints, it also represent width and height of container --- .../basic/container_widget_parser.dart | 11 +- lib/dynamic_widget/utils.dart | 219 +++++++++--------- 2 files changed, 117 insertions(+), 113 deletions(-) diff --git a/lib/dynamic_widget/basic/container_widget_parser.dart b/lib/dynamic_widget/basic/container_widget_parser.dart index 11becab..69e1eef 100644 --- a/lib/dynamic_widget/basic/container_widget_parser.dart +++ b/lib/dynamic_widget/basic/container_widget_parser.dart @@ -66,14 +66,9 @@ class ContainerWidgetParser extends WidgetParser { "margin": margin != null ? "${margin.left},${margin.top},${margin.right},${margin.bottom}" : null, - "width": - constraints != null && constraints.minWidth == constraints.maxWidth - ? constraints.minWidth - : null, - "height": - constraints != null && constraints.minHeight == constraints.maxHeight - ? constraints.minHeight - : null, + "constraints": constraints!= null + ? exportConstraints(constraints) + : null, "child": DynamicWidgetBuilder.export(realWidget.child, buildContext) }; } diff --git a/lib/dynamic_widget/utils.dart b/lib/dynamic_widget/utils.dart index 5614214..11eab8d 100644 --- a/lib/dynamic_widget/utils.dart +++ b/lib/dynamic_widget/utils.dart @@ -32,24 +32,24 @@ TextAlign parseTextAlign(String textAlignString) { return textAlign; } -String exportTextAlign(TextAlign textAlign){ +String exportTextAlign(TextAlign textAlign) { String rt = "start"; - if (textAlign == TextAlign.left){ + if (textAlign == TextAlign.left) { rt = "left"; } - if (textAlign == TextAlign.right){ + if (textAlign == TextAlign.right) { rt = "right"; } - if (textAlign == TextAlign.center){ + if (textAlign == TextAlign.center) { rt = "center"; } - if (textAlign == TextAlign.justify){ + if (textAlign == TextAlign.justify) { rt = "justify"; } - if (textAlign == TextAlign.start){ + if (textAlign == TextAlign.start) { rt = "start"; } - if (textAlign == TextAlign.end){ + if (textAlign == TextAlign.end) { rt = "end"; } return rt; @@ -73,13 +73,13 @@ TextOverflow parseTextOverflow(String textOverflowString) { return textOverflow; } -String exportTextOverflow(TextOverflow textOverflow){ +String exportTextOverflow(TextOverflow textOverflow) { String rt = "ellipsis"; - if (textOverflow == TextOverflow.clip){ + if (textOverflow == TextOverflow.clip) { rt = "clip"; } - if (textOverflow == TextOverflow.fade){ + if (textOverflow == TextOverflow.fade) { rt = "fade"; } return rt; @@ -104,7 +104,7 @@ TextDecoration parseTextDecoration(String textDecorationString) { return textDecoration; } -String exportTextDecoration(TextDecoration decoration){ +String exportTextDecoration(TextDecoration decoration) { var rt = "none"; if (decoration == TextDecoration.lineThrough) { rt = "lineThrough"; @@ -136,9 +136,9 @@ TextDirection parseTextDirection(String textDirectionString) { return textDirection; } -String exportTextDirection(TextDirection textDirection){ +String exportTextDirection(TextDirection textDirection) { String rt = "ltr"; - if (textDirection == TextDirection.rtl){ + if (textDirection == TextDirection.rtl) { rt = "rtl"; } return rt; @@ -182,7 +182,7 @@ FontWeight parseFontWeight(String textFontWeight) { return fontWeight; } -String exportFontWeight(FontWeight fontWeight){ +String exportFontWeight(FontWeight fontWeight) { String rt = "normal"; if (fontWeight == FontWeight.w100) { rt = "w100"; @@ -251,18 +251,20 @@ TextStyle parseTextStyle(Map map) { ); } -Map exportTextStyle(TextStyle textStyle){ +Map exportTextStyle(TextStyle textStyle) { if (textStyle == null) { return null; } return { - "color": textStyle.color !=null? textStyle.color.value.toRadixString(16) : null, + "color": textStyle.color != null + ? textStyle.color.value.toRadixString(16) + : null, "debugLabel": textStyle.debugLabel, "decoration": exportTextDecoration(textStyle.decoration), "fontSize": textStyle.fontSize, "fontFamily": textStyle.fontFamily, - "fontStyle": FontStyle.italic == textStyle.fontStyle? "italic" : "normal", + "fontStyle": FontStyle.italic == textStyle.fontStyle ? "italic" : "normal", "fontWeight": exportFontWeight(textStyle.fontWeight), }; } @@ -381,7 +383,6 @@ EdgeInsetsGeometry parseEdgeInsetsGeometry(String edgeInsetsGeometryString) { bottom: double.parse(values[3])); } - CrossAxisAlignment parseCrossAxisAlignment(String crossAxisAlignmentString) { switch (crossAxisAlignmentString) { case 'start': @@ -398,21 +399,21 @@ CrossAxisAlignment parseCrossAxisAlignment(String crossAxisAlignmentString) { return CrossAxisAlignment.center; } -String exportCrossAxisAlignment(CrossAxisAlignment crossAxisAlignment){ +String exportCrossAxisAlignment(CrossAxisAlignment crossAxisAlignment) { String rt = "center"; - if (crossAxisAlignment == CrossAxisAlignment.start){ + if (crossAxisAlignment == CrossAxisAlignment.start) { rt = "start"; } - if (crossAxisAlignment == CrossAxisAlignment.end){ + if (crossAxisAlignment == CrossAxisAlignment.end) { rt = "end"; } - if (crossAxisAlignment == CrossAxisAlignment.center){ + if (crossAxisAlignment == CrossAxisAlignment.center) { rt = "center"; } - if (crossAxisAlignment == CrossAxisAlignment.stretch){ + if (crossAxisAlignment == CrossAxisAlignment.stretch) { rt = "stretch"; } - if (crossAxisAlignment == CrossAxisAlignment.baseline){ + if (crossAxisAlignment == CrossAxisAlignment.baseline) { rt = "baseline"; } @@ -437,17 +438,17 @@ MainAxisAlignment parseMainAxisAlignment(String mainAxisAlignmentString) { return MainAxisAlignment.start; } -String exportMainAxisAlignment(MainAxisAlignment mainAxisAlignment){ +String exportMainAxisAlignment(MainAxisAlignment mainAxisAlignment) { String rt = "start"; if (mainAxisAlignment == MainAxisAlignment.end) { rt = "end"; - }else if (mainAxisAlignment == MainAxisAlignment.center) { + } else if (mainAxisAlignment == MainAxisAlignment.center) { rt = "center"; - }else if (mainAxisAlignment == MainAxisAlignment.spaceBetween) { + } else if (mainAxisAlignment == MainAxisAlignment.spaceBetween) { rt = "spaceBetween"; - }else if (mainAxisAlignment == MainAxisAlignment.spaceAround) { + } else if (mainAxisAlignment == MainAxisAlignment.spaceAround) { rt = "spaceAround"; - }else if (mainAxisAlignment == MainAxisAlignment.spaceEvenly) { + } else if (mainAxisAlignment == MainAxisAlignment.spaceEvenly) { rt = "spaceEvenly"; } return rt; @@ -466,101 +467,100 @@ VerticalDirection parseVerticalDirection(String verticalDirectionString) => ? VerticalDirection.up : VerticalDirection.down; -String exportBlendMode(BlendMode blendMode){ +String exportBlendMode(BlendMode blendMode) { if (blendMode == null) { return null; } String rt = "srcIn"; - if (blendMode == BlendMode.clear){ + if (blendMode == BlendMode.clear) { rt = "clear"; } - if (blendMode == BlendMode.src){ + if (blendMode == BlendMode.src) { rt = "src"; } - if (blendMode == BlendMode.dst){ + if (blendMode == BlendMode.dst) { rt = "dst"; } - if (blendMode == BlendMode.srcOver){ + if (blendMode == BlendMode.srcOver) { rt = "srcOver"; } - if (blendMode == BlendMode.dstOver){ + if (blendMode == BlendMode.dstOver) { rt = "dstOver"; } - if (blendMode == BlendMode.srcIn){ + if (blendMode == BlendMode.srcIn) { rt = "srcIn"; } - if (blendMode == BlendMode.dstIn){ + if (blendMode == BlendMode.dstIn) { rt = "dstIn"; } - if (blendMode == BlendMode.srcOut){ + if (blendMode == BlendMode.srcOut) { rt = "srcOut"; } - if (blendMode == BlendMode.dstOut){ + if (blendMode == BlendMode.dstOut) { rt = "dstOut"; } - if (blendMode == BlendMode.srcATop){ + if (blendMode == BlendMode.srcATop) { rt = "srcATop"; } - if (blendMode == BlendMode.dstATop){ + if (blendMode == BlendMode.dstATop) { rt = "dstATop"; } - if (blendMode == BlendMode.xor){ + if (blendMode == BlendMode.xor) { rt = "xor"; } - if (blendMode == BlendMode.plus){ + if (blendMode == BlendMode.plus) { rt = "plus"; } - if (blendMode == BlendMode.modulate){ + if (blendMode == BlendMode.modulate) { rt = "modulate"; } - if (blendMode == BlendMode.screen){ + if (blendMode == BlendMode.screen) { rt = "screen"; } - if (blendMode == BlendMode.overlay){ + if (blendMode == BlendMode.overlay) { rt = "overlay"; } - if (blendMode == BlendMode.darken){ + if (blendMode == BlendMode.darken) { rt = "darken"; } - if (blendMode == BlendMode.lighten){ + if (blendMode == BlendMode.lighten) { rt = "lighten"; } - if (blendMode == BlendMode.colorDodge){ + if (blendMode == BlendMode.colorDodge) { rt = "colorDodge"; } - if (blendMode == BlendMode.colorBurn){ + if (blendMode == BlendMode.colorBurn) { rt = "colorBurn"; } - if (blendMode == BlendMode.hardLight){ + if (blendMode == BlendMode.hardLight) { rt = "hardLight"; } - if (blendMode == BlendMode.softLight){ + if (blendMode == BlendMode.softLight) { rt = "softLight"; } - if (blendMode == BlendMode.difference){ + if (blendMode == BlendMode.difference) { rt = "difference"; } - if (blendMode == BlendMode.exclusion){ + if (blendMode == BlendMode.exclusion) { rt = "exclusion"; } - if (blendMode == BlendMode.multiply){ + if (blendMode == BlendMode.multiply) { rt = "multiply"; } - if (blendMode == BlendMode.hue){ + if (blendMode == BlendMode.hue) { rt = "hue"; } - if (blendMode == BlendMode.saturation){ + if (blendMode == BlendMode.saturation) { rt = "saturation"; } - if (blendMode == BlendMode.color){ + if (blendMode == BlendMode.color) { rt = "color"; } - if (blendMode == BlendMode.luminosity){ + if (blendMode == BlendMode.luminosity) { rt = "luminosity"; } return rt; - } BlendMode parseBlendMode(String blendModeString) { @@ -658,24 +658,24 @@ BoxFit parseBoxFit(String boxFitString) { return null; } -String exportBoxFit(BoxFit boxFit){ +String exportBoxFit(BoxFit boxFit) { String rt = "contain"; - if (boxFit == BoxFit.fill){ + if (boxFit == BoxFit.fill) { rt = "fill"; } - if (boxFit == BoxFit.cover){ + if (boxFit == BoxFit.cover) { rt = "cover"; } - if (boxFit == BoxFit.fitWidth){ + if (boxFit == BoxFit.fitWidth) { rt = "fitWidth"; } - if (boxFit == BoxFit.fitHeight){ + if (boxFit == BoxFit.fitHeight) { rt = "fitHeight"; } - if (boxFit == BoxFit.none){ + if (boxFit == BoxFit.none) { rt = "none"; } - if (boxFit == BoxFit.scaleDown){ + if (boxFit == BoxFit.scaleDown) { rt = "scaleDown"; } return rt; @@ -701,18 +701,18 @@ ImageRepeat parseImageRepeat(String imageRepeatString) { } } -String exportImageRepeat(ImageRepeat imageRepeat){ - if (imageRepeat==null) { +String exportImageRepeat(ImageRepeat imageRepeat) { + if (imageRepeat == null) { return null; } String rt = "noRepeat"; - if (imageRepeat == ImageRepeat.repeat){ + if (imageRepeat == ImageRepeat.repeat) { rt = "repeat"; } - if (imageRepeat == ImageRepeat.repeatX){ + if (imageRepeat == ImageRepeat.repeatX) { rt = "repeatX"; } - if (imageRepeat == ImageRepeat.repeatY){ + if (imageRepeat == ImageRepeat.repeatY) { rt = "repeatY"; } return rt; @@ -727,7 +727,7 @@ Rect parseRect(String fromLTRBString) { double.parse(strings[2]), double.parse(strings[3])); } -String exportRect(Rect rect){ +String exportRect(Rect rect) { return "${rect.left},${rect.top},${rect.right},${rect.bottom}"; } @@ -749,21 +749,21 @@ FilterQuality parseFilterQuality(String filterQualityString) { } } -String exportFilterQuality(FilterQuality filterQuality){ - if (filterQuality==null) { +String exportFilterQuality(FilterQuality filterQuality) { + if (filterQuality == null) { return null; } String rt = "low"; - if (filterQuality == FilterQuality.none){ + if (filterQuality == FilterQuality.none) { rt = "none"; } - if (filterQuality == FilterQuality.low){ + if (filterQuality == FilterQuality.low) { rt = "low"; } - if (filterQuality == FilterQuality.medium){ + if (filterQuality == FilterQuality.medium) { rt = "medium"; } - if (filterQuality == FilterQuality.high){ + if (filterQuality == FilterQuality.high) { rt = "high"; } return rt; @@ -806,11 +806,11 @@ StackFit parseStackFit(String value) { } } -String exportStackFit(StackFit stackFit){ +String exportStackFit(StackFit stackFit) { String rt = "loose"; - if (stackFit == StackFit.expand){ + if (stackFit == StackFit.expand) { rt = "expand"; - }else if (stackFit == StackFit.passthrough){ + } else if (stackFit == StackFit.passthrough) { rt = "passthrough"; } return rt; @@ -835,15 +835,15 @@ Clip parseClip(String value) { } } -String exportClip(Clip clip){ +String exportClip(Clip clip) { String rt = "hardEdge"; - if (clip == Clip.none){ + if (clip == Clip.none) { rt = "none"; - }else if (clip == Clip.hardEdge){ + } else if (clip == Clip.hardEdge) { rt = "hardEdge"; - }else if (clip == Clip.antiAlias){ + } else if (clip == Clip.antiAlias) { rt = "antiAlias"; - }else if (clip == Clip.antiAliasWithSaveLayer){ + } else if (clip == Clip.antiAliasWithSaveLayer) { rt = "antiAliasWithSaveLayer"; } return rt; @@ -886,17 +886,17 @@ WrapAlignment parseWrapAlignment(String wrapAlignmentString) { return WrapAlignment.start; } -String exportWrapAlignment(WrapAlignment wrapAlignment){ +String exportWrapAlignment(WrapAlignment wrapAlignment) { String rt = "start"; - if (wrapAlignment == WrapAlignment.end){ + if (wrapAlignment == WrapAlignment.end) { rt = "end"; - }else if (wrapAlignment == WrapAlignment.center){ + } else if (wrapAlignment == WrapAlignment.center) { rt = "center"; - }else if (wrapAlignment == WrapAlignment.spaceBetween){ + } else if (wrapAlignment == WrapAlignment.spaceBetween) { rt = "spaceBetween"; - }else if (wrapAlignment == WrapAlignment.spaceAround){ + } else if (wrapAlignment == WrapAlignment.spaceAround) { rt = "spaceAround"; - }else if (wrapAlignment == WrapAlignment.spaceEvenly){ + } else if (wrapAlignment == WrapAlignment.spaceEvenly) { rt = "spaceEvenly"; } return rt; @@ -920,11 +920,11 @@ WrapCrossAlignment parseWrapCrossAlignment(String wrapCrossAlignmentString) { return WrapCrossAlignment.start; } -String exportWrapCrossAlignment(WrapCrossAlignment wrapCrossAlignment){ +String exportWrapCrossAlignment(WrapCrossAlignment wrapCrossAlignment) { String rt = "start"; - if (wrapCrossAlignment == WrapCrossAlignment.end){ + if (wrapCrossAlignment == WrapCrossAlignment.end) { rt = "end"; - }else if (wrapCrossAlignment == WrapCrossAlignment.center){ + } else if (wrapCrossAlignment == WrapCrossAlignment.center) { rt = "center"; } return rt; @@ -947,7 +947,7 @@ Clip parseClipBehavior(String clipBehaviorString) { return Clip.antiAlias; } -String exportClipBehavior(Clip clip){ +String exportClipBehavior(Clip clip) { if (clip == null) { return "antiAlias"; } @@ -984,12 +984,12 @@ DropCapMode parseDropCapMode(String value) { } } -String exportDropCapMod(DropCapMode mode){ +String exportDropCapMod(DropCapMode mode) { if (mode == null) { return null; } - switch(mode){ + switch (mode) { case DropCapMode.inside: return "inside"; case DropCapMode.baseline: @@ -1018,9 +1018,9 @@ DropCapPosition parseDropCapPosition(String value) { } } -String exportDropCapPosition(DropCapPosition dropCapPosition){ +String exportDropCapPosition(DropCapPosition dropCapPosition) { String rt = "start"; - if (dropCapPosition == DropCapPosition.end){ + if (dropCapPosition == DropCapPosition.end) { rt = "end"; } return rt; @@ -1028,7 +1028,7 @@ String exportDropCapPosition(DropCapPosition dropCapPosition){ DropCap parseDropCap(Map map, BuildContext buildContext, ClickListener listener) { - if (map==null) { + if (map == null) { return null; } return DropCap( @@ -1039,7 +1039,7 @@ DropCap parseDropCap(Map map, BuildContext buildContext, ); } -Map exportDropCap(DropCap dropCap, BuildContext buildContext){ +Map exportDropCap(DropCap dropCap, BuildContext buildContext) { if (dropCap == null) { return null; } @@ -1050,7 +1050,7 @@ Map exportDropCap(DropCap dropCap, BuildContext buildContext){ }; } -String exportAlignment(Alignment alignment){ +String exportAlignment(Alignment alignment) { if (alignment == null) { return "center"; } @@ -1086,4 +1086,13 @@ String exportAlignment(Alignment alignment){ } return "center"; -} \ No newline at end of file +} + +Map exportConstraints(BoxConstraints constraints) { + return { + 'minWidth': constraints.minWidth, + 'maxWidth': constraints.maxWidth, + 'minHeight': constraints.minHeight, + 'maxHeight': constraints.maxHeight, + }; +}