From 3f666b68d36aa0564415705778cb468a3bd95df8 Mon Sep 17 00:00:00 2001 From: Saad Ardati Date: Wed, 2 Oct 2024 19:36:18 +0300 Subject: [PATCH] Simulator #10 --- lib/src/api/models/brightness.dart | 12 ++++++ lib/src/api/models/models.dart | 1 + lib/src/api/nodes/canvas_node.dart | 5 +++ lib/src/api/nodes/canvas_node.g.dart | 11 +++++ lib/src/api/nodes/divider_node.g.dart | 4 +- lib/src/api/nodes/embedded_video_node.g.dart | 4 +- .../api/nodes/external_component_node.g.dart | 4 +- lib/src/api/nodes/icon_node.g.dart | 4 +- .../api/nodes/loading_indicator_node.g.dart | 4 +- lib/src/api/nodes/navigation_bar_node.g.dart | 4 +- lib/src/api/nodes/page_view_node.g.dart | 8 ++-- lib/src/api/nodes/placeholder_node.g.dart | 4 +- .../api/nodes/single_placeholder_node.g.dart | 4 +- lib/src/api/nodes/slider_node.g.dart | 4 +- lib/src/api/nodes/text_node.g.dart | 43 +++++++++---------- lib/src/api/nodes/web_view_node.g.dart | 4 +- 16 files changed, 74 insertions(+), 46 deletions(-) create mode 100644 lib/src/api/models/brightness.dart diff --git a/lib/src/api/models/brightness.dart b/lib/src/api/models/brightness.dart new file mode 100644 index 0000000..248ccab --- /dev/null +++ b/lib/src/api/models/brightness.dart @@ -0,0 +1,12 @@ +/// Defines an enum to represent the brightness of the app, in which the system +/// status bar and navigation bar will be colored accordingly. +enum BrightnessModel { + /// Light brightness. + light, + + /// Dark brightness. + dark, + + /// System brightness, which will be determined by the system. + system, +} diff --git a/lib/src/api/models/models.dart b/lib/src/api/models/models.dart index 9d3015b..872e492 100644 --- a/lib/src/api/models/models.dart +++ b/lib/src/api/models/models.dart @@ -20,6 +20,7 @@ export 'box_constraints.dart'; export 'box_height_style.dart'; export 'box_width_style.dart'; export 'breakpoint.dart'; +export 'brightness.dart'; export 'cloud_database_queries/query_filter.dart'; export 'color_rgb.dart'; export 'color_rgba.dart'; diff --git a/lib/src/api/nodes/canvas_node.dart b/lib/src/api/nodes/canvas_node.dart index 7101061..dce4117 100644 --- a/lib/src/api/nodes/canvas_node.dart +++ b/lib/src/api/nodes/canvas_node.dart @@ -178,6 +178,9 @@ class CanvasProperties with SerializableMixin, EquatableMixin { /// Safe area properties. SafeAreaModel safeArea; + /// The brightness of the system UI. + BrightnessModel brightness; + /// Whether this canvas is a scaffold. A scaffold can hold an app bar, drawer, /// bottom navigation bar, and floating action button. If any of this is /// present, the canvas is a scaffold. @@ -193,6 +196,7 @@ class CanvasProperties with SerializableMixin, EquatableMixin { this.topAppBarPlaceholderId, this.floatingActionButton, this.safeArea = const SafeAreaModel.all(true), + this.brightness = BrightnessModel.system, }); @override @@ -201,6 +205,7 @@ class CanvasProperties with SerializableMixin, EquatableMixin { topAppBarPlaceholderId, floatingActionButton, safeArea, + brightness, ]; /// Creates a new [CanvasProperties] from a JSON data. diff --git a/lib/src/api/nodes/canvas_node.g.dart b/lib/src/api/nodes/canvas_node.g.dart index 02ac3d0..61ba434 100644 --- a/lib/src/api/nodes/canvas_node.g.dart +++ b/lib/src/api/nodes/canvas_node.g.dart @@ -364,6 +364,9 @@ CanvasProperties _$CanvasPropertiesFromJson(Map json) => CanvasProperties( safeArea: json['safeArea'] == null ? const SafeAreaModel.all(true) : SafeAreaModel.fromJson(json['safeArea']), + brightness: + $enumDecodeNullable(_$BrightnessModelEnumMap, json['brightness']) ?? + BrightnessModel.system, ); Map _$CanvasPropertiesToJson(CanvasProperties instance) { @@ -392,5 +395,13 @@ Map _$CanvasPropertiesToJson(CanvasProperties instance) { instance.floatingActionButton?.toJson(), null); writeNotNull('safeArea', instance.safeArea, instance.safeArea.toJson(), const SafeAreaModel.all(true)); + writeNotNull('brightness', instance.brightness, + _$BrightnessModelEnumMap[instance.brightness]!, BrightnessModel.system); return val; } + +const _$BrightnessModelEnumMap = { + BrightnessModel.light: 'light', + BrightnessModel.dark: 'dark', + BrightnessModel.system: 'system', +}; diff --git a/lib/src/api/nodes/divider_node.g.dart b/lib/src/api/nodes/divider_node.g.dart index d7130ed..3a56d6f 100644 --- a/lib/src/api/nodes/divider_node.g.dart +++ b/lib/src/api/nodes/divider_node.g.dart @@ -71,8 +71,6 @@ Map _$DividerNodeToJson(DividerNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -99,6 +97,8 @@ Map _$DividerNodeToJson(DividerNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/embedded_video_node.g.dart b/lib/src/api/nodes/embedded_video_node.g.dart index 7dd28a4..ed31ddf 100644 --- a/lib/src/api/nodes/embedded_video_node.g.dart +++ b/lib/src/api/nodes/embedded_video_node.g.dart @@ -71,8 +71,6 @@ Map _$EmbeddedVideoNodeToJson(EmbeddedVideoNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -99,6 +97,8 @@ Map _$EmbeddedVideoNodeToJson(EmbeddedVideoNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/external_component_node.g.dart b/lib/src/api/nodes/external_component_node.g.dart index 25fe0a3..eb7a81f 100644 --- a/lib/src/api/nodes/external_component_node.g.dart +++ b/lib/src/api/nodes/external_component_node.g.dart @@ -73,8 +73,6 @@ Map _$ExternalComponentNodeToJson( } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -101,6 +99,8 @@ Map _$ExternalComponentNodeToJson( instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/icon_node.g.dart b/lib/src/api/nodes/icon_node.g.dart index 476e7e2..57bbe4c 100644 --- a/lib/src/api/nodes/icon_node.g.dart +++ b/lib/src/api/nodes/icon_node.g.dart @@ -85,8 +85,6 @@ Map _$IconNodeToJson(IconNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -113,6 +111,8 @@ Map _$IconNodeToJson(IconNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/loading_indicator_node.g.dart b/lib/src/api/nodes/loading_indicator_node.g.dart index d613e1f..5cfe13a 100644 --- a/lib/src/api/nodes/loading_indicator_node.g.dart +++ b/lib/src/api/nodes/loading_indicator_node.g.dart @@ -74,8 +74,6 @@ Map _$LoadingIndicatorNodeToJson( } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -102,6 +100,8 @@ Map _$LoadingIndicatorNodeToJson( instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/navigation_bar_node.g.dart b/lib/src/api/nodes/navigation_bar_node.g.dart index 4471593..908c5f4 100644 --- a/lib/src/api/nodes/navigation_bar_node.g.dart +++ b/lib/src/api/nodes/navigation_bar_node.g.dart @@ -72,8 +72,6 @@ Map _$NavigationBarNodeToJson(NavigationBarNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -100,6 +98,8 @@ Map _$NavigationBarNodeToJson(NavigationBarNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/page_view_node.g.dart b/lib/src/api/nodes/page_view_node.g.dart index f592e04..fc33e88 100644 --- a/lib/src/api/nodes/page_view_node.g.dart +++ b/lib/src/api/nodes/page_view_node.g.dart @@ -74,15 +74,15 @@ PageViewNode _$PageViewNodeFromJson(Map json) => PageViewNode( {} ..widthFactor = (json['widthFactor'] as num?)?.toDouble() ..heightFactor = (json['heightFactor'] as num?)?.toDouble() - ..allowedTypes = (json['allowedTypes'] as List) - .map((e) => e as String) - .toList() ..deniedTypes = (json['deniedTypes'] as List) .map((e) => e as String) .toList() ..maxAllowedSize = json['maxAllowedSize'] == null ? null : SizeC.fromJson(json['maxAllowedSize'] as Map) + ..allowedTypes = (json['allowedTypes'] as List) + .map((e) => e as String) + .toList() ..isScrollable = json['isScrollable'] as bool ..useFlutterListView = json['useFlutterListView'] as bool ..type = json['type'] as String; @@ -140,12 +140,12 @@ Map _$PageViewNodeToJson(PageViewNode instance) { writeNotNull( 'heightFactor', instance.heightFactor, instance.heightFactor, null); writeNotNull('children', instance.children, instance.children, []); - val['allowedTypes'] = instance.allowedTypes; val['deniedTypes'] = instance.deniedTypes; writeNotNull('maxAllowedSize', instance.maxAllowedSize, instance.maxAllowedSize?.toJson(), null); writeNotNull( 'clipsContent', instance.clipsContent, instance.clipsContent, true); + val['allowedTypes'] = instance.allowedTypes; val['isScrollable'] = instance.isScrollable; writeNotNull('scrollDirection', instance.scrollDirection, _$AxisCEnumMap[instance.scrollDirection]!, AxisC.vertical); diff --git a/lib/src/api/nodes/placeholder_node.g.dart b/lib/src/api/nodes/placeholder_node.g.dart index 009741d..d96d6b8 100644 --- a/lib/src/api/nodes/placeholder_node.g.dart +++ b/lib/src/api/nodes/placeholder_node.g.dart @@ -72,8 +72,6 @@ Map _$PlaceholderNodeToJson(PlaceholderNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -100,6 +98,8 @@ Map _$PlaceholderNodeToJson(PlaceholderNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/single_placeholder_node.g.dart b/lib/src/api/nodes/single_placeholder_node.g.dart index a43a3ac..1de094a 100644 --- a/lib/src/api/nodes/single_placeholder_node.g.dart +++ b/lib/src/api/nodes/single_placeholder_node.g.dart @@ -85,8 +85,6 @@ Map _$SinglePlaceholderNodeToJson( } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -113,6 +111,8 @@ Map _$SinglePlaceholderNodeToJson( instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/slider_node.g.dart b/lib/src/api/nodes/slider_node.g.dart index b89f62c..fc17361 100644 --- a/lib/src/api/nodes/slider_node.g.dart +++ b/lib/src/api/nodes/slider_node.g.dart @@ -72,8 +72,6 @@ Map _$SliderNodeToJson(SliderNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -100,6 +98,8 @@ Map _$SliderNodeToJson(SliderNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/text_node.g.dart b/lib/src/api/nodes/text_node.g.dart index 828d69c..262b050 100644 --- a/lib/src/api/nodes/text_node.g.dart +++ b/lib/src/api/nodes/text_node.g.dart @@ -98,9 +98,7 @@ TextNode _$TextNodeFromJson(Map json) => TextNode( ..type = json['type'] as String; Map _$TextNodeToJson(TextNode instance) { - final val = { - 'characters': instance.characters, - }; + final val = {}; void writeNotNull( String key, dynamic value, dynamic jsonValue, dynamic defaultValue) { @@ -112,25 +110,6 @@ Map _$TextNodeToJson(TextNode instance) { } } - writeNotNull( - 'textAlignHorizontal', - instance.textAlignHorizontal, - _$TextAlignHorizontalEnumEnumMap[instance.textAlignHorizontal]!, - TextAlignHorizontalEnum.left); - writeNotNull( - 'textAlignVertical', - instance.textAlignVertical, - _$TextAlignVerticalEnumEnumMap[instance.textAlignVertical]!, - TextAlignVerticalEnum.top); - writeNotNull( - 'paragraphIndent', instance.paragraphIndent, instance.paragraphIndent, 0); - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); - writeNotNull('paragraphSpacing', instance.paragraphSpacing, - instance.paragraphSpacing, 0); - writeNotNull('maxLines', instance.maxLines, instance.maxLines, null); - writeNotNull('overflow', instance.overflow, - _$TextOverflowCEnumMap[instance.overflow]!, TextOverflowC.clip); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -155,10 +134,30 @@ Map _$TextNodeToJson(TextNode instance) { writeNotNull('flex', instance.flex, instance.flex, 1); writeNotNull('aspectRatioLock', instance.aspectRatioLock, instance.aspectRatioLock, false); + val['characters'] = instance.characters; writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); writeNotNull('textMixedProps', instance.textMixedProps, instance.textMixedProps.map((e) => e.toJson()).toList(), const []); + writeNotNull( + 'textAlignHorizontal', + instance.textAlignHorizontal, + _$TextAlignHorizontalEnumEnumMap[instance.textAlignHorizontal]!, + TextAlignHorizontalEnum.left); + writeNotNull( + 'textAlignVertical', + instance.textAlignVertical, + _$TextAlignVerticalEnumEnumMap[instance.textAlignVertical]!, + TextAlignVerticalEnum.top); + writeNotNull( + 'paragraphIndent', instance.paragraphIndent, instance.paragraphIndent, 0); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); + writeNotNull('paragraphSpacing', instance.paragraphSpacing, + instance.paragraphSpacing, 0); + writeNotNull('maxLines', instance.maxLines, instance.maxLines, null); + writeNotNull('overflow', instance.overflow, + _$TextOverflowCEnumMap[instance.overflow]!, TextOverflowC.clip); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero); diff --git a/lib/src/api/nodes/web_view_node.g.dart b/lib/src/api/nodes/web_view_node.g.dart index 0f0421a..d5857aa 100644 --- a/lib/src/api/nodes/web_view_node.g.dart +++ b/lib/src/api/nodes/web_view_node.g.dart @@ -71,8 +71,6 @@ Map _$WebViewNodeToJson(WebViewNode instance) { } } - writeNotNull('reactions', instance.reactions, - instance.reactions.map((e) => e.toJson()).toList(), const []); writeNotNull('variables', instance.variables, instance.variables, {}); writeNotNull('multipleVariables', instance.multipleVariables, instance.multipleVariables, {}); @@ -99,6 +97,8 @@ Map _$WebViewNodeToJson(WebViewNode instance) { instance.aspectRatioLock, false); writeNotNull('alignment', instance.alignment, instance.alignment.toJson(), AlignmentModel.none); + writeNotNull('reactions', instance.reactions, + instance.reactions.map((e) => e.toJson()).toList(), const []); val['basicBoxLocal'] = instance.basicBoxLocal.toJson(); writeNotNull('margin', instance.margin, instance.margin.toJson(), EdgeInsetsModel.zero);