From ef87b981683f0ba5c8a3c2aa60f318838365149f Mon Sep 17 00:00:00 2001 From: superiorsd10 Date: Thu, 29 Feb 2024 14:56:32 +0530 Subject: [PATCH 1/4] feat(mirai_edge_insets): customize the fromJson factory to support num and List as input --- .../mirai_edge_insets/mirai_edge_insets.dart | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart index 70843e48..44777b24 100644 --- a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart +++ b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart @@ -13,8 +13,33 @@ class MiraiEdgeInsets with _$MiraiEdgeInsets { double? bottom, }) = _MiraiEdgeInsets; - factory MiraiEdgeInsets.fromJson(Map json) => - _$MiraiEdgeInsetsFromJson(json); + factory MiraiEdgeInsets.fromJson(dynamic json) => _fromJson(json); + + static MiraiEdgeInsets _fromJson(dynamic json) { + Map resultantJson; + + if (json is num) { + resultantJson = { + "left": json, + "top": json, + "right": json, + "bottom": json + }; + } else if (json is List && json.length == 4) { + resultantJson = { + "left": json[0], + "top": json[1], + "right": json[2], + "bottom": json[3] + }; + } else if (json is Map) { + resultantJson = json; + } else { + throw ArgumentError('Invalid input format for MiraiEdgeInsets'); + } + + return _$MiraiEdgeInsetsFromJson(resultantJson); + } } extension MiraiEdgeInsetsParser on MiraiEdgeInsets? { From 613af6f8c49940a604b05cf0d5d26810f60f9fb2 Mon Sep 17 00:00:00 2001 From: superiorsd10 Date: Thu, 29 Feb 2024 14:57:34 +0530 Subject: [PATCH 2/4] chore(src): update generated code files --- .../mirai_dialog_action.g.dart | 1 - .../mirai_alert_dialog.g.dart | 18 ++++++------------ .../mirai_bottom_app_bar_theme.g.dart | 2 +- .../mirai_button_style.g.dart | 2 +- .../src/parsers/mirai_card/mirai_card.g.dart | 2 +- .../mirai_card_theme_data.g.dart | 2 +- .../src/parsers/mirai_chip/mirai_chip.g.dart | 5 ++--- .../mirai_container/mirai_container.g.dart | 4 ++-- .../mirai_dialog_theme.g.dart | 3 +-- ...ai_floating_action_button_theme_data.g.dart | 3 +-- .../mirai_grid_view/mirai_grid_view.g.dart | 2 +- .../mirai_icon_button/mirai_icon_button.g.dart | 2 +- .../mirai_input_decoration.g.dart | 3 +-- .../mirai_input_decoration_theme.g.dart | 3 +-- .../mirai_list_tile/mirai_list_tile.g.dart | 3 +-- .../mirai_list_tile_theme_data.g.dart | 3 +-- .../mirai_list_view/mirai_list_view.g.dart | 2 +- .../parsers/mirai_padding/mirai_padding.g.dart | 3 +-- .../mirai_safe_area/mirai_safe_area.g.dart | 2 +- .../mirai_single_child_scroll_view.g.dart | 2 +- .../lib/src/parsers/mirai_tab/mirai_tab.g.dart | 3 +-- .../parsers/mirai_tab_bar/mirai_tab_bar.g.dart | 8 +++----- .../mirai_tab_bar_theme_data.g.dart | 3 +-- .../mirai_text_form_field.g.dart | 3 +-- 24 files changed, 32 insertions(+), 52 deletions(-) diff --git a/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart b/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart index 949d3f10..d67fc766 100644 --- a/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart +++ b/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart @@ -40,5 +40,4 @@ Map _$$MiraiDialogActionImplToJson( const _$TraversalEdgeBehaviorEnumMap = { TraversalEdgeBehavior.closedLoop: 'closedLoop', TraversalEdgeBehavior.leaveFlutterView: 'leaveFlutterView', - TraversalEdgeBehavior.parentScope: 'parentScope', }; diff --git a/packages/mirai/lib/src/parsers/mirai_alert_dialog/mirai_alert_dialog.g.dart b/packages/mirai/lib/src/parsers/mirai_alert_dialog/mirai_alert_dialog.g.dart index ef26ef8e..0de9047c 100644 --- a/packages/mirai/lib/src/parsers/mirai_alert_dialog/mirai_alert_dialog.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_alert_dialog/mirai_alert_dialog.g.dart @@ -12,14 +12,12 @@ _$MiraiAlertDialogImpl _$$MiraiAlertDialogImplFromJson( icon: json['icon'] as Map?, iconPadding: json['iconPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['iconPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['iconPadding']), iconColor: json['iconColor'] as String?, title: json['title'] as Map?, titlePadding: json['titlePadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['titlePadding'] as Map), + : MiraiEdgeInsets.fromJson(json['titlePadding']), titleTextStyle: json['titleTextStyle'] == null ? null : MiraiTextStyle.fromJson( @@ -27,8 +25,7 @@ _$MiraiAlertDialogImpl _$$MiraiAlertDialogImplFromJson( content: json['content'] as Map?, contentPadding: json['contentPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['contentPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['contentPadding']), contentTextStyle: json['contentTextStyle'] == null ? null : MiraiTextStyle.fromJson( @@ -38,8 +35,7 @@ _$MiraiAlertDialogImpl _$$MiraiAlertDialogImplFromJson( .toList(), actionsPadding: json['actionsPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['actionsPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['actionsPadding']), actionsAlignment: $enumDecodeNullable( _$MainAxisAlignmentEnumMap, json['actionsAlignment']), actionsOverflowAlignment: $enumDecodeNullable( @@ -50,15 +46,13 @@ _$MiraiAlertDialogImpl _$$MiraiAlertDialogImplFromJson( (json['actionsOverflowButtonSpacing'] as num?)?.toDouble(), buttonPadding: json['buttonPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['buttonPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['buttonPadding']), backgroundColor: json['backgroundColor'] as String?, elevation: (json['elevation'] as num?)?.toDouble(), semanticLabel: json['semanticLabel'] as String?, insetPadding: json['insetPadding'] == null ? const MiraiEdgeInsets(left: 40, right: 40, top: 24, bottom: 24) - : MiraiEdgeInsets.fromJson( - json['insetPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['insetPadding']), clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, scrollable: json['scrollable'] as bool? ?? false, diff --git a/packages/mirai/lib/src/parsers/mirai_bottom_app_bar_theme/mirai_bottom_app_bar_theme.g.dart b/packages/mirai/lib/src/parsers/mirai_bottom_app_bar_theme/mirai_bottom_app_bar_theme.g.dart index 3adaaa22..104b7846 100644 --- a/packages/mirai/lib/src/parsers/mirai_bottom_app_bar_theme/mirai_bottom_app_bar_theme.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_bottom_app_bar_theme/mirai_bottom_app_bar_theme.g.dart @@ -16,7 +16,7 @@ _$MiraiBottomAppBarThemeImpl _$$MiraiBottomAppBarThemeImplFromJson( shadowColor: json['shadowColor'] as String?, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), ); Map _$$MiraiBottomAppBarThemeImplToJson( diff --git a/packages/mirai/lib/src/parsers/mirai_button_style/mirai_button_style.g.dart b/packages/mirai/lib/src/parsers/mirai_button_style/mirai_button_style.g.dart index e1f6534d..b71d4c8d 100644 --- a/packages/mirai/lib/src/parsers/mirai_button_style/mirai_button_style.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_button_style/mirai_button_style.g.dart @@ -23,7 +23,7 @@ _$MiraiButtonStyleImpl _$$MiraiButtonStyleImplFromJson( : MiraiTextStyle.fromJson(json['textStyle'] as Map), padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), minimumSize: json['minimumSize'] == null ? null : MiraiSize.fromJson(json['minimumSize'] as Map), diff --git a/packages/mirai/lib/src/parsers/mirai_card/mirai_card.g.dart b/packages/mirai/lib/src/parsers/mirai_card/mirai_card.g.dart index 8cb1cc2d..fcba443e 100644 --- a/packages/mirai/lib/src/parsers/mirai_card/mirai_card.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_card/mirai_card.g.dart @@ -15,7 +15,7 @@ _$MiraiCardImpl _$$MiraiCardImplFromJson(Map json) => borderOnForeground: json['borderOnForeground'] as bool? ?? true, margin: json['margin'] == null ? null - : MiraiEdgeInsets.fromJson(json['margin'] as Map), + : MiraiEdgeInsets.fromJson(json['margin']), clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']), child: json['child'] as Map?, semanticContainer: json['semanticContainer'] as bool? ?? true, diff --git a/packages/mirai/lib/src/parsers/mirai_card_theme_data/mirai_card_theme_data.g.dart b/packages/mirai/lib/src/parsers/mirai_card_theme_data/mirai_card_theme_data.g.dart index a23a5e9f..a8f077e7 100644 --- a/packages/mirai/lib/src/parsers/mirai_card_theme_data/mirai_card_theme_data.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_card_theme_data/mirai_card_theme_data.g.dart @@ -16,7 +16,7 @@ _$MiraiCardThemeDataImpl _$$MiraiCardThemeDataImplFromJson( elevation: (json['elevation'] as num?)?.toDouble(), margin: json['margin'] == null ? null - : MiraiEdgeInsets.fromJson(json['margin'] as Map), + : MiraiEdgeInsets.fromJson(json['margin']), shape: json['shape'] == null ? null : MiraiBorder.fromJson(json['shape'] as Map), diff --git a/packages/mirai/lib/src/parsers/mirai_chip/mirai_chip.g.dart b/packages/mirai/lib/src/parsers/mirai_chip/mirai_chip.g.dart index 329d1988..920fe999 100644 --- a/packages/mirai/lib/src/parsers/mirai_chip/mirai_chip.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_chip/mirai_chip.g.dart @@ -15,8 +15,7 @@ _$MiraiChipImpl _$$MiraiChipImplFromJson(Map json) => : MiraiTextStyle.fromJson(json['labelStyle'] as Map), labelPadding: json['labelPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['labelPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['labelPadding']), deleteIcon: json['deleteIcon'] as Map?, deleteIconColor: json['deleteIconColor'] as String?, deleteButtonTooltipMessage: json['deleteButtonTooltipMessage'] as String?, @@ -32,7 +31,7 @@ _$MiraiChipImpl _$$MiraiChipImplFromJson(Map json) => backgroundColor: json['backgroundColor'] as String?, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), elevation: (json['elevation'] as num?)?.toDouble(), shadowColor: json['shadowColor'] as String?, surfaceTintColor: json['surfaceTintColor'] as String?, diff --git a/packages/mirai/lib/src/parsers/mirai_container/mirai_container.g.dart b/packages/mirai/lib/src/parsers/mirai_container/mirai_container.g.dart index e975bebd..8ddede8c 100644 --- a/packages/mirai/lib/src/parsers/mirai_container/mirai_container.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_container/mirai_container.g.dart @@ -12,7 +12,7 @@ _$MiraiContainerImpl _$$MiraiContainerImplFromJson(Map json) => $enumDecodeNullable(_$MiraiAlignmentEnumMap, json['alignment']), padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), decoration: json['decoration'] == null ? null : MiraiBoxDecoration.fromJson( @@ -22,7 +22,7 @@ _$MiraiContainerImpl _$$MiraiContainerImplFromJson(Map json) => height: (json['height'] as num?)?.toDouble(), margin: json['margin'] == null ? null - : MiraiEdgeInsets.fromJson(json['margin'] as Map), + : MiraiEdgeInsets.fromJson(json['margin']), child: json['child'] as Map?, clipBehavior: $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, diff --git a/packages/mirai/lib/src/parsers/mirai_dialog_theme/mirai_dialog_theme.g.dart b/packages/mirai/lib/src/parsers/mirai_dialog_theme/mirai_dialog_theme.g.dart index cbf05f63..98ef79a6 100644 --- a/packages/mirai/lib/src/parsers/mirai_dialog_theme/mirai_dialog_theme.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_dialog_theme/mirai_dialog_theme.g.dart @@ -30,8 +30,7 @@ _$MiraiDialogThemeImpl _$$MiraiDialogThemeImplFromJson( json['contentTextStyle'] as Map), actionsPadding: json['actionsPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['actionsPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['actionsPadding']), iconColor: json['iconColor'] as String?, ); diff --git a/packages/mirai/lib/src/parsers/mirai_floating_action_button_theme_data/mirai_floating_action_button_theme_data.g.dart b/packages/mirai/lib/src/parsers/mirai_floating_action_button_theme_data/mirai_floating_action_button_theme_data.g.dart index e3c1629a..f4ed23ed 100644 --- a/packages/mirai/lib/src/parsers/mirai_floating_action_button_theme_data/mirai_floating_action_button_theme_data.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_floating_action_button_theme_data/mirai_floating_action_button_theme_data.g.dart @@ -26,8 +26,7 @@ _$MiraiFloatingActionButtonThemeDataImpl (json['extendedIconLabelSpacing'] as num?)?.toDouble(), extendedPadding: json['extendedPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['extendedPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['extendedPadding']), extendedTextStyle: json['extendedTextStyle'] == null ? null : MiraiTextStyle.fromJson( diff --git a/packages/mirai/lib/src/parsers/mirai_grid_view/mirai_grid_view.g.dart b/packages/mirai/lib/src/parsers/mirai_grid_view/mirai_grid_view.g.dart index ad33bb82..2f40ef13 100644 --- a/packages/mirai/lib/src/parsers/mirai_grid_view/mirai_grid_view.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_grid_view/mirai_grid_view.g.dart @@ -18,7 +18,7 @@ _$MiraiGridViewImpl _$$MiraiGridViewImplFromJson(Map json) => shrinkWrap: json['shrinkWrap'] as bool? ?? false, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), crossAxisCount: json['crossAxisCount'] as int?, mainAxisSpacing: (json['mainAxisSpacing'] as num?)?.toDouble() ?? 0.0, crossAxisSpacing: (json['crossAxisSpacing'] as num?)?.toDouble() ?? 0.0, diff --git a/packages/mirai/lib/src/parsers/mirai_icon_button/mirai_icon_button.g.dart b/packages/mirai/lib/src/parsers/mirai_icon_button/mirai_icon_button.g.dart index 180fe11f..b8cad032 100644 --- a/packages/mirai/lib/src/parsers/mirai_icon_button/mirai_icon_button.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_icon_button/mirai_icon_button.g.dart @@ -13,7 +13,7 @@ _$MiraiIconButtonImpl _$$MiraiIconButtonImplFromJson( iconSize: (json['iconSize'] as num?)?.toDouble(), padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), alignment: $enumDecodeNullable(_$MiraiAlignmentEnumMap, json['alignment']) ?? MiraiAlignment.center, diff --git a/packages/mirai/lib/src/parsers/mirai_input_decoration/mirai_input_decoration.g.dart b/packages/mirai/lib/src/parsers/mirai_input_decoration/mirai_input_decoration.g.dart index 5da180c7..f7412c12 100644 --- a/packages/mirai/lib/src/parsers/mirai_input_decoration/mirai_input_decoration.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_input_decoration/mirai_input_decoration.g.dart @@ -46,8 +46,7 @@ _$MiraiInputDecorationImpl _$$MiraiInputDecorationImplFromJson( isDense: json['isDense'] as bool? ?? false, contentPadding: json['contentPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['contentPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['contentPadding']), prefixIcon: json['prefixIcon'] as Map?, prefixIconConstraints: json['prefixIconConstraints'] == null ? null diff --git a/packages/mirai/lib/src/parsers/mirai_input_decoration_theme/mirai_input_decoration_theme.g.dart b/packages/mirai/lib/src/parsers/mirai_input_decoration_theme/mirai_input_decoration_theme.g.dart index 3a97f20c..1ae5b044 100644 --- a/packages/mirai/lib/src/parsers/mirai_input_decoration_theme/mirai_input_decoration_theme.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_input_decoration_theme/mirai_input_decoration_theme.g.dart @@ -35,8 +35,7 @@ _$MiraiInputDecorationThemeImpl _$$MiraiInputDecorationThemeImplFromJson( isDense: json['isDense'] as bool? ?? false, contentPadding: json['contentPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['contentPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['contentPadding']), isCollapsed: json['isCollapsed'] as bool? ?? false, iconColor: json['iconColor'] as String?, prefixStyle: json['prefixStyle'] == null diff --git a/packages/mirai/lib/src/parsers/mirai_list_tile/mirai_list_tile.g.dart b/packages/mirai/lib/src/parsers/mirai_list_tile/mirai_list_tile.g.dart index 149a1a41..9986a274 100644 --- a/packages/mirai/lib/src/parsers/mirai_list_tile/mirai_list_tile.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_list_tile/mirai_list_tile.g.dart @@ -22,8 +22,7 @@ _$MiraiListTileImpl _$$MiraiListTileImplFromJson(Map json) => textColor: json['textColor'] as String?, contentPadding: json['contentPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['contentPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['contentPadding']), enabled: json['enabled'] as bool? ?? true, selected: json['selected'] as bool? ?? false, focusColor: json['focusColor'] as String?, diff --git a/packages/mirai/lib/src/parsers/mirai_list_tile_theme_data/mirai_list_tile_theme_data.g.dart b/packages/mirai/lib/src/parsers/mirai_list_tile_theme_data/mirai_list_tile_theme_data.g.dart index 8564c0cc..f88c84f0 100644 --- a/packages/mirai/lib/src/parsers/mirai_list_tile_theme_data/mirai_list_tile_theme_data.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_list_tile_theme_data/mirai_list_tile_theme_data.g.dart @@ -31,8 +31,7 @@ _$MiraiListTileThemeDataImpl _$$MiraiListTileThemeDataImplFromJson( json['leadingAndTrailingTextStyle'] as Map), contentPadding: json['contentPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['contentPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['contentPadding']), tileColor: json['tileColor'] as String?, selectedTileColor: json['selectedTileColor'] as String?, horizontalTitleGap: (json['horizontalTitleGap'] as num?)?.toDouble(), diff --git a/packages/mirai/lib/src/parsers/mirai_list_view/mirai_list_view.g.dart b/packages/mirai/lib/src/parsers/mirai_list_view/mirai_list_view.g.dart index 12a4a585..169fa4fb 100644 --- a/packages/mirai/lib/src/parsers/mirai_list_view/mirai_list_view.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_list_view/mirai_list_view.g.dart @@ -18,7 +18,7 @@ _$MiraiListViewImpl _$$MiraiListViewImplFromJson(Map json) => shrinkWrap: json['shrinkWrap'] as bool? ?? false, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), addAutomaticKeepAlives: json['addAutomaticKeepAlives'] as bool? ?? true, addRepaintBoundaries: json['addRepaintBoundaries'] as bool? ?? true, addSemanticIndexes: json['addSemanticIndexes'] as bool? ?? true, diff --git a/packages/mirai/lib/src/parsers/mirai_padding/mirai_padding.g.dart b/packages/mirai/lib/src/parsers/mirai_padding/mirai_padding.g.dart index 46a05bb9..c611038d 100644 --- a/packages/mirai/lib/src/parsers/mirai_padding/mirai_padding.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_padding/mirai_padding.g.dart @@ -8,8 +8,7 @@ part of 'mirai_padding.dart'; _$MiraiPaddingImpl _$$MiraiPaddingImplFromJson(Map json) => _$MiraiPaddingImpl( - padding: - MiraiEdgeInsets.fromJson(json['padding'] as Map), + padding: MiraiEdgeInsets.fromJson(json['padding']), child: json['child'] as Map?, ); diff --git a/packages/mirai/lib/src/parsers/mirai_safe_area/mirai_safe_area.g.dart b/packages/mirai/lib/src/parsers/mirai_safe_area/mirai_safe_area.g.dart index aeec9e1a..bd317b61 100644 --- a/packages/mirai/lib/src/parsers/mirai_safe_area/mirai_safe_area.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_safe_area/mirai_safe_area.g.dart @@ -15,7 +15,7 @@ _$MiraiSafeAreaImpl _$$MiraiSafeAreaImplFromJson(Map json) => bottom: json['bottom'] as bool? ?? true, minimum: json['minimum'] == null ? const MiraiEdgeInsets() - : MiraiEdgeInsets.fromJson(json['minimum'] as Map), + : MiraiEdgeInsets.fromJson(json['minimum']), maintainBottomViewPadding: json['maintainBottomViewPadding'] as bool? ?? false, ); diff --git a/packages/mirai/lib/src/parsers/mirai_single_child_scroll_view/mirai_single_child_scroll_view.g.dart b/packages/mirai/lib/src/parsers/mirai_single_child_scroll_view/mirai_single_child_scroll_view.g.dart index f3100cc7..2b3e275e 100644 --- a/packages/mirai/lib/src/parsers/mirai_single_child_scroll_view/mirai_single_child_scroll_view.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_single_child_scroll_view/mirai_single_child_scroll_view.g.dart @@ -15,7 +15,7 @@ _$MiraiSingleChildScrollViewImpl _$$MiraiSingleChildScrollViewImplFromJson( reverse: json['reverse'] as bool? ?? false, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), primary: json['primary'] as bool?, physics: $enumDecodeNullable(_$MiraiScrollPhysicsEnumMap, json['physics']), diff --git a/packages/mirai/lib/src/parsers/mirai_tab/mirai_tab.g.dart b/packages/mirai/lib/src/parsers/mirai_tab/mirai_tab.g.dart index a0599172..72de8814 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab/mirai_tab.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab/mirai_tab.g.dart @@ -12,8 +12,7 @@ _$MiraiTabImpl _$$MiraiTabImplFromJson(Map json) => icon: json['icon'] as Map?, iconMargin: json['iconMargin'] == null ? null - : MiraiEdgeInsets.fromJson( - json['iconMargin'] as Map), + : MiraiEdgeInsets.fromJson(json['iconMargin']), height: (json['height'] as num?)?.toDouble(), child: json['child'] as Map?, ); diff --git a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart index 2bb48464..067b77e4 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab_bar/mirai_tab_bar.g.dart @@ -15,15 +15,14 @@ _$MiraiTabBarImpl _$$MiraiTabBarImplFromJson(Map json) => isScrollable: json['isScrollable'] as bool? ?? false, padding: json['padding'] == null ? null - : MiraiEdgeInsets.fromJson(json['padding'] as Map), + : MiraiEdgeInsets.fromJson(json['padding']), indicatorColor: json['indicatorColor'] as String?, automaticIndicatorColorAdjustment: json['automaticIndicatorColorAdjustment'] as bool? ?? true, indicatorWeight: (json['indicatorWeight'] as num?)?.toDouble() ?? 2.0, indicatorPadding: json['indicatorPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['indicatorPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['indicatorPadding']), indicatorSize: $enumDecodeNullable( _$TabBarIndicatorSizeEnumMap, json['indicatorSize']), labelColor: json['labelColor'] as String?, @@ -32,8 +31,7 @@ _$MiraiTabBarImpl _$$MiraiTabBarImplFromJson(Map json) => : MiraiTextStyle.fromJson(json['labelStyle'] as Map), labelPadding: json['labelPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['labelPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['labelPadding']), unselectedLabelColor: json['unselectedLabelColor'] as String?, unselectedLabelStyle: json['unselectedLabelStyle'] == null ? null diff --git a/packages/mirai/lib/src/parsers/mirai_tab_bar_theme_data/mirai_tab_bar_theme_data.g.dart b/packages/mirai/lib/src/parsers/mirai_tab_bar_theme_data/mirai_tab_bar_theme_data.g.dart index acf15809..021eb477 100644 --- a/packages/mirai/lib/src/parsers/mirai_tab_bar_theme_data/mirai_tab_bar_theme_data.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_tab_bar_theme_data/mirai_tab_bar_theme_data.g.dart @@ -20,8 +20,7 @@ _$MiraiTabBarThemeDataImpl _$$MiraiTabBarThemeDataImplFromJson( labelColor: json['labelColor'] as String?, labelPadding: json['labelPadding'] == null ? null - : MiraiEdgeInsets.fromJson( - json['labelPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['labelPadding']), labelStyle: json['labelStyle'] == null ? null : MiraiTextStyle.fromJson(json['labelStyle'] as Map), diff --git a/packages/mirai/lib/src/parsers/mirai_text_form_field/mirai_text_form_field.g.dart b/packages/mirai/lib/src/parsers/mirai_text_form_field/mirai_text_form_field.g.dart index 77d45108..a0c361e3 100644 --- a/packages/mirai/lib/src/parsers/mirai_text_form_field/mirai_text_form_field.g.dart +++ b/packages/mirai/lib/src/parsers/mirai_text_form_field/mirai_text_form_field.g.dart @@ -52,8 +52,7 @@ _$MiraiTextFormFieldImpl _$$MiraiTextFormFieldImplFromJson( $enumDecodeNullable(_$BrightnessEnumMap, json['keyboardAppearance']), scrollPadding: json['scrollPadding'] == null ? const MiraiEdgeInsets(bottom: 20, top: 20, left: 20, right: 20) - : MiraiEdgeInsets.fromJson( - json['scrollPadding'] as Map), + : MiraiEdgeInsets.fromJson(json['scrollPadding']), restorationId: json['restorationId'] as String?, enableIMEPersonalizedLearning: json['enableIMEPersonalizedLearning'] as bool? ?? true, From 6df274db3063007ed852061b3ea90bf6c5b2fd5b Mon Sep 17 00:00:00 2001 From: superiorsd10 Date: Thu, 29 Feb 2024 18:29:24 +0530 Subject: [PATCH 3/4] chore(src): upgrading the flutter on local machine and running code generators --- .../mirai_dialog_action/mirai_dialog_action.g.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart b/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart index d67fc766..949d3f10 100644 --- a/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart +++ b/packages/mirai/lib/src/action_parsers/mirai_dialog_action/mirai_dialog_action.g.dart @@ -40,4 +40,5 @@ Map _$$MiraiDialogActionImplToJson( const _$TraversalEdgeBehaviorEnumMap = { TraversalEdgeBehavior.closedLoop: 'closedLoop', TraversalEdgeBehavior.leaveFlutterView: 'leaveFlutterView', + TraversalEdgeBehavior.parentScope: 'parentScope', }; From 20bdd8b5b08544451bf73288ba3a2033c8f708b3 Mon Sep 17 00:00:00 2001 From: superiorsd10 Date: Thu, 29 Feb 2024 21:32:25 +0530 Subject: [PATCH 4/4] fix(mirai_edge_insets): replace List by List and check if all elements are num --- .../src/parsers/mirai_edge_insets/mirai_edge_insets.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart index 44777b24..87a678b6 100644 --- a/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart +++ b/packages/mirai/lib/src/parsers/mirai_edge_insets/mirai_edge_insets.dart @@ -25,7 +25,11 @@ class MiraiEdgeInsets with _$MiraiEdgeInsets { "right": json, "bottom": json }; - } else if (json is List && json.length == 4) { + } else if (json is List && json.length == 4) { + bool allElementsNum = json.every((element) => element is num); + if (!allElementsNum) { + throw ArgumentError('Invalid input format for MiraiEdgeInsets'); + } resultantJson = { "left": json[0], "top": json[1],