diff --git a/examples/counter_example/pubspec.lock b/examples/counter_example/pubspec.lock index 74b2ab73..f5e275f9 100644 --- a/examples/counter_example/pubspec.lock +++ b/examples/counter_example/pubspec.lock @@ -733,7 +733,7 @@ packages: path: "../../packages/stac_core" relative: true source: path - version: "0.0.1" + version: "0.1.0" stac_framework: dependency: "direct overridden" description: diff --git a/examples/counter_example/pubspec_overrides.yaml b/examples/counter_example/pubspec_overrides.yaml index 70cc5215..cdd6ad22 100644 --- a/examples/counter_example/pubspec_overrides.yaml +++ b/examples/counter_example/pubspec_overrides.yaml @@ -1,4 +1,4 @@ -# melos_managed_dependency_overrides: stac,stac_framework,stac_logger,stac_core +# melos_managed_dependency_overrides: stac,stac_core,stac_framework,stac_logger dependency_overrides: stac: path: ../../packages/stac diff --git a/examples/movie_app/pubspec.lock b/examples/movie_app/pubspec.lock index 37fc1ec8..93ca1e84 100644 --- a/examples/movie_app/pubspec.lock +++ b/examples/movie_app/pubspec.lock @@ -453,7 +453,7 @@ packages: path: "../../packages/stac_core" relative: true source: path - version: "0.0.1" + version: "0.1.0" stac_framework: dependency: "direct overridden" description: diff --git a/examples/movie_app/pubspec_overrides.yaml b/examples/movie_app/pubspec_overrides.yaml index 70cc5215..cdd6ad22 100644 --- a/examples/movie_app/pubspec_overrides.yaml +++ b/examples/movie_app/pubspec_overrides.yaml @@ -1,4 +1,4 @@ -# melos_managed_dependency_overrides: stac,stac_framework,stac_logger,stac_core +# melos_managed_dependency_overrides: stac,stac_core,stac_framework,stac_logger dependency_overrides: stac: path: ../../packages/stac diff --git a/examples/stac_gallery/.stacrc b/examples/stac_gallery/.stacrc deleted file mode 100644 index 993c2ecf..00000000 --- a/examples/stac_gallery/.stacrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "project_id": "2vopLhGLotaRHjG6jwL2", - "user_id": "JqVDPuuLdqfqmS1vX8NnGGi1hlk1", - "api_url": "https://upsertjson-awv6bh3y5a-uc.a.run.app" -} \ No newline at end of file diff --git a/examples/stac_gallery/bin/stac_cli.dart b/examples/stac_gallery/bin/stac_cli.dart deleted file mode 100644 index 88b09ecf..00000000 --- a/examples/stac_gallery/bin/stac_cli.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; - -final double fontSize = 20; - -void main(List args) { - final json = homeScreen().toJson(); - json.removeWhere((key, value) => value == null); -} - -StacWidget homeScreen() { - return StacScaffold( - appBar: StacAppBar( - title: StacText( - data: 'Hello, Stac!!', - ), - ), - body: StacCenter( - child: StacContainer( - width: 200, - height: 200, - decoration: StacBoxDecoration( - color: StacColors.red, - border: StacBorder( - color: StacColors.black, - width: 10, - ), - ), - child: StacText( - data: 'Hello, Stac!!', - style: StacTextStyle( - color: StacColors.white, - fontSize: fontSize, - fontWeight: StacFontWeight.bold, - ), - ), - ), - ), - ); -} diff --git a/examples/stac_gallery/pubspec.lock b/examples/stac_gallery/pubspec.lock index 4ecd4b66..ba36ca12 100644 --- a/examples/stac_gallery/pubspec.lock +++ b/examples/stac_gallery/pubspec.lock @@ -733,7 +733,7 @@ packages: path: "../../packages/stac_core" relative: true source: path - version: "0.0.1" + version: "0.1.0" stac_framework: dependency: "direct overridden" description: diff --git a/examples/stac_gallery/pubspec_overrides.yaml b/examples/stac_gallery/pubspec_overrides.yaml index 6110fa0f..ccc67dee 100644 --- a/examples/stac_gallery/pubspec_overrides.yaml +++ b/examples/stac_gallery/pubspec_overrides.yaml @@ -1,4 +1,4 @@ -# melos_managed_dependency_overrides: stac,stac_framework,stac_logger,stac_webview,stac_core +# melos_managed_dependency_overrides: stac,stac_core,stac_framework,stac_logger,stac_webview dependency_overrides: stac: path: ../../packages/stac diff --git a/examples/stac_gallery/stac/.stac_build/home_screen.json b/examples/stac_gallery/stac/.stac_build/home_screen.json deleted file mode 100644 index 2fa11472..00000000 --- a/examples/stac_gallery/stac/.stac_build/home_screen.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "body": { - "child": { - "decoration": { - "color": "#FFE91E63" - }, - "width": 200.0, - "height": 200.0, - "child": { - "child": { - "data": "Hello World - UPDATED!", - "style": { - "fontSize": 17.0, - "fontWeight": "bold" - }, - "type": "text" - }, - "type": "center" - }, - "type": "container" - }, - "type": "center" - }, - "drawerDragStartBehavior": "start", - "type": "scaffold" -} \ No newline at end of file diff --git a/examples/stac_gallery/stac/.stac_build/unga_screen.json b/examples/stac_gallery/stac/.stac_build/unga_screen.json deleted file mode 100644 index 54e5d4fc..00000000 --- a/examples/stac_gallery/stac/.stac_build/unga_screen.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "appBar": { - "title": { - "data": "Unga bunga punga", - "type": "text" - }, - "type": "appBar" - }, - "body": { - "child": { - "data": "Unga", - "type": "text" - }, - "type": "center" - }, - "drawerDragStartBehavior": "start", - "type": "scaffold" -} \ No newline at end of file diff --git a/examples/stac_gallery/stac/home_screen.dart b/examples/stac_gallery/stac/home_screen.dart deleted file mode 100644 index ae747c03..00000000 --- a/examples/stac_gallery/stac/home_screen.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:stac_core/stac_core.dart'; - -StacWidget homeScreen() { - return StacScaffold( - body: StacCenter( - child: StacContainer( - width: 200, - height: 200, - decoration: StacBoxDecoration( - color: StacColors.pink, - ), - child: StacCenter( - child: StacText( - data: 'Hello World - UPDATED!', - style: StacTextStyle( - fontSize: 17, - fontWeight: StacFontWeight.bold, - ), - ), - ), - ), - ), - ); -} diff --git a/packages/stac/lib/src/framework/stac_service.dart b/packages/stac/lib/src/framework/stac_service.dart index 80e211d1..aef81ac7 100644 --- a/packages/stac/lib/src/framework/stac_service.dart +++ b/packages/stac/lib/src/framework/stac_service.dart @@ -11,14 +11,12 @@ import 'package:stac/src/parsers/actions/stac_get_form_value/stac_get_form_value import 'package:stac/src/parsers/actions/stac_network_request/stac_network_request_parser.dart'; import 'package:stac/src/parsers/parsers.dart'; import 'package:stac/src/parsers/widgets/stac_app_bar/stac_app_bar_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_image/stac_image_parser.dart'; import 'package:stac/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart'; import 'package:stac/src/parsers/widgets/stac_row/stac_row_parser.dart'; import 'package:stac/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart'; import 'package:stac/src/parsers/widgets/stac_text/stac_text_parser.dart'; import 'package:stac/src/services/stac_network_service.dart'; import 'package:stac/src/utils/variable_resolver.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_core/core/stac_options.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/actions/stac_delay_action/stac_delay_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_delay_action/stac_delay_action_parser.dart index 3636a8b3..d0bf6e9d 100644 --- a/packages/stac/lib/src/parsers/actions/stac_delay_action/stac_delay_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_delay_action/stac_delay_action_parser.dart @@ -1,8 +1,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:stac_core/actions/delay/stac_delay_action.dart'; -import 'package:stac/src/utils/action_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacDelayActionParser extends StacActionParser { diff --git a/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart index abfd609e..e145805f 100644 --- a/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_dialog_action/stac_dialog_action_parser.dart @@ -3,9 +3,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/actions/dialog/stac_dialog_action.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacDialogActionParser extends StacActionParser { diff --git a/packages/stac/lib/src/parsers/actions/stac_form_validate/stac_form_validate_parser.dart b/packages/stac/lib/src/parsers/actions/stac_form_validate/stac_form_validate_parser.dart index 4c571a7b..8833712b 100644 --- a/packages/stac/lib/src/parsers/actions/stac_form_validate/stac_form_validate_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_form_validate/stac_form_validate_parser.dart @@ -3,9 +3,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; -import 'package:stac/src/utils/action_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/actions/form_validate/stac_form_validate.dart'; class StacFormValidateParser extends StacActionParser { const StacFormValidateParser(); diff --git a/packages/stac/lib/src/parsers/actions/stac_get_form_value/stac_get_form_value_parser.dart b/packages/stac/lib/src/parsers/actions/stac_get_form_value/stac_get_form_value_parser.dart index f88ddd91..57a66660 100644 --- a/packages/stac/lib/src/parsers/actions/stac_get_form_value/stac_get_form_value_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_get_form_value/stac_get_form_value_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; -import 'package:stac/src/utils/action_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/actions/get_form_value/stac_get_form_value.dart'; class StacGetFormValueParser extends StacActionParser { const StacGetFormValueParser(); diff --git a/packages/stac/lib/src/parsers/actions/stac_modal_bottom_sheet_action/stac_modal_bottom_sheet_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_modal_bottom_sheet_action/stac_modal_bottom_sheet_action_parser.dart index 7d145310..4cba571d 100644 --- a/packages/stac/lib/src/parsers/actions/stac_modal_bottom_sheet_action/stac_modal_bottom_sheet_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_modal_bottom_sheet_action/stac_modal_bottom_sheet_action_parser.dart @@ -3,10 +3,9 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac_core/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacModalBottomSheetActionParser diff --git a/packages/stac/lib/src/parsers/actions/stac_multi_action/stac_multi_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_multi_action/stac_multi_action_parser.dart index dfb46831..e023c06f 100644 --- a/packages/stac/lib/src/parsers/actions/stac_multi_action/stac_multi_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_multi_action/stac_multi_action_parser.dart @@ -2,8 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; -import 'package:stac_core/actions/multi/stac_multi_action.dart'; -import 'package:stac/src/utils/action_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacMultiActionParser extends StacActionParser { diff --git a/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart index 8cc2e227..447da382 100644 --- a/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_navigate_action/stac_navigate_action_parser.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart b/packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart index c1958f7f..9886769b 100644 --- a/packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart @@ -4,7 +4,6 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/services/stac_network_service.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_logger/stac_logger.dart'; diff --git a/packages/stac/lib/src/parsers/actions/stac_none_action/stac_none_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_none_action/stac_none_action_parser.dart index e5d4be9e..88e6e9b9 100644 --- a/packages/stac/lib/src/parsers/actions/stac_none_action/stac_none_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_none_action/stac_none_action_parser.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:flutter/widgets.dart'; -import 'package:stac/src/utils/action_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacNoneActionParser extends StacActionParser { diff --git a/packages/stac/lib/src/parsers/actions/stac_set_value/stac_set_value_action_parser.dart b/packages/stac/lib/src/parsers/actions/stac_set_value/stac_set_value_action_parser.dart index b3d27f89..c7bfd485 100644 --- a/packages/stac/lib/src/parsers/actions/stac_set_value/stac_set_value_action_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_set_value/stac_set_value_action_parser.dart @@ -1,9 +1,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/actions/set_value/stac_set_value_action.dart'; +import 'package:stac_core/stac_core.dart'; class StacSetValueActionParser extends StacActionParser { const StacSetValueActionParser(); diff --git a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart index 3296bd0e..7e43a851 100644 --- a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart +++ b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar_parser.dart @@ -3,12 +3,10 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; -import 'package:stac_core/actions/snack_bar/stac_snack_bar.dart'; -import 'package:stac_core/actions/snack_bar/stac_snack_bar_action.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/action_type.dart'; import 'package:stac/src/utils/color_utils.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacSnackBarParser extends StacActionParser { diff --git a/packages/stac/lib/src/parsers/painting/stac_box_decoration_parser.dart b/packages/stac/lib/src/parsers/painting/stac_box_decoration_parser.dart index 35d5241e..b87796ca 100644 --- a/packages/stac/lib/src/parsers/painting/stac_box_decoration_parser.dart +++ b/packages/stac/lib/src/parsers/painting/stac_box_decoration_parser.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_web.dart'; +import 'package:stac/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_box_decoration/stac_box_decoration.dart'; +import 'package:stac/stac.dart'; +import 'package:stac_core/foundation/decoration/stac_box_decoration/stac_box_decoration.dart'; extension StacBoxDecorationParser on StacBoxDecoration { BoxDecoration? parse(BuildContext context) { diff --git a/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser.dart b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser.dart new file mode 100644 index 00000000..7b9c4565 --- /dev/null +++ b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser.dart @@ -0,0 +1,2 @@ +export 'stac_decoration_image_parser_web.dart' + if (dart.library.io) 'stac_decoration_image_parser_io.dart'; diff --git a/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_io.dart b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_io.dart index a65e9c51..5ca050e6 100644 --- a/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_io.dart +++ b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_io.dart @@ -2,8 +2,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/painting/stac_decoration_image/stac_decoration_image.dart'; -import 'package:stac_core/types/stac_image_type.dart'; +import 'package:stac_core/stac_core.dart'; extension StacDecorationImageParser on StacDecorationImage { DecorationImage? get parse { diff --git a/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_web.dart b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_web.dart index 1640e29c..53926706 100644 --- a/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_web.dart +++ b/packages/stac/lib/src/parsers/painting/stac_decoration_image/stac_decoration_image_parser_web.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_logger/stac_logger.dart'; -import 'package:stac_core/painting/stac_decoration_image/stac_decoration_image.dart'; -import 'package:stac_core/types/stac_image_type.dart'; extension StacDecorationImageParser on StacDecorationImage { DecorationImage? get parse { diff --git a/packages/stac/lib/src/parsers/painting/stac_edge_insets_parser.dart b/packages/stac/lib/src/parsers/painting/stac_edge_insets_parser.dart index 1ab58bd8..f055dfef 100644 --- a/packages/stac/lib/src/parsers/painting/stac_edge_insets_parser.dart +++ b/packages/stac/lib/src/parsers/painting/stac_edge_insets_parser.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/stac_core.dart'; extension StacEdgeInsetsParser on StacEdgeInsets { EdgeInsets get parse { diff --git a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart index 4733ac45..651f5fbb 100644 --- a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dart @@ -6,10 +6,7 @@ import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_app_bar_theme.freezed.dart'; part 'stac_app_bar_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart index 195ad621..20634184 100644 --- a/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_data.dart @@ -5,9 +5,7 @@ import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_badge_theme_data.freezed.dart'; part 'stac_badge_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart index 04ef5bae..a6a9503c 100644 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_bottom_app_bar_theme.freezed.dart'; part 'stac_bottom_app_bar_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart index 7c32ed29..db83e505 100644 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -124,6 +123,187 @@ class _$StacBottomAppBarThemeCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacBottomAppBarTheme]. +extension StacBottomAppBarThemePatterns on StacBottomAppBarTheme { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacBottomAppBarTheme value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacBottomAppBarTheme value) $default, + ) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacBottomAppBarTheme value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + String? color, + double? elevation, + double? height, + String? surfaceTintColor, + String? shadowColor, + StacEdgeInsets? padding)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme() when $default != null: + return $default(_that.color, _that.elevation, _that.height, + _that.surfaceTintColor, _that.shadowColor, _that.padding); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + String? color, + double? elevation, + double? height, + String? surfaceTintColor, + String? shadowColor, + StacEdgeInsets? padding) + $default, + ) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme(): + return $default(_that.color, _that.elevation, _that.height, + _that.surfaceTintColor, _that.shadowColor, _that.padding); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + String? color, + double? elevation, + double? height, + String? surfaceTintColor, + String? shadowColor, + StacEdgeInsets? padding)? + $default, + ) { + final _that = this; + switch (_that) { + case _StacBottomAppBarTheme() when $default != null: + return $default(_that.color, _that.elevation, _that.height, + _that.surfaceTintColor, _that.shadowColor, _that.padding); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacBottomAppBarTheme implements StacBottomAppBarTheme { diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart index e4c43cd0..9240d2e8 100644 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart @@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_bottom_nav_bar_theme.freezed.dart'; part 'stac_bottom_nav_bar_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart index a415459f..b7f1f1a7 100644 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_size/stac_size.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_bottom_sheet_theme.freezed.dart'; part 'stac_bottom_sheet_theme.g.dart'; @@ -44,7 +42,7 @@ extension StacBottomSheetThemeDataParser on StacBottomSheetThemeData { shape: shape?.parse(context), showDragHandle: showDragHandle, dragHandleColor: dragHandleColor.toColor(context), - dragHandleSize: dragHandleSize.parse, + dragHandleSize: dragHandleSize?.parse, clipBehavior: clipBehavior, constraints: constraints?.parse, ); diff --git a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart index 7a6f35f2..871fd322 100644 --- a/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.freezed.dart @@ -115,8 +115,6 @@ abstract mixin class $StacBottomSheetThemeDataCopyWith<$Res> { StacSize? dragHandleSize, Clip? clipBehavior, StacBoxConstraints? constraints}); - - $StacSizeCopyWith<$Res>? get dragHandleSize; } /// @nodoc @@ -201,20 +199,6 @@ class _$StacBottomSheetThemeDataCopyWithImpl<$Res> as StacBoxConstraints?, )); } - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get dragHandleSize { - if (_self.dragHandleSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.dragHandleSize!, (value) { - return _then(_self.copyWith(dragHandleSize: value)); - }); - } } /// Adds pattern-matching-related methods to [StacBottomSheetThemeData]. @@ -596,9 +580,6 @@ abstract mixin class _$StacBottomSheetThemeDataCopyWith<$Res> StacSize? dragHandleSize, Clip? clipBehavior, StacBoxConstraints? constraints}); - - @override - $StacSizeCopyWith<$Res>? get dragHandleSize; } /// @nodoc @@ -683,20 +664,6 @@ class __$StacBottomSheetThemeDataCopyWithImpl<$Res> as StacBoxConstraints?, )); } - - /// Create a copy of StacBottomSheetThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get dragHandleSize { - if (_self.dragHandleSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.dragHandleSize!, (value) { - return _then(_self.copyWith(dragHandleSize: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart b/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart index 77800b3d..f44e6a15 100644 --- a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart +++ b/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart @@ -3,7 +3,7 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_core/stac_core.dart'; extension StacButtonStyleParser on StacButtonStyle { ButtonStyle parseElevatedButton(BuildContext context) { diff --git a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart index 8decc4e3..85a6b9c1 100644 --- a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart @@ -4,8 +4,7 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/theme/stac_color_scheme/stac_color_scheme.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_button_theme_data.freezed.dart'; part 'stac_button_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart index 12e5817b..07d9493e 100644 --- a/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart @@ -3,8 +3,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; part 'stac_card_theme_data.freezed.dart'; part 'stac_card_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart index 7414e5f0..4cfae8d5 100644 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart'; -import 'package:stac/src/parsers/widgets/stac_visual_density/stac_visual_density.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_checkbox_theme_data.freezed.dart'; part 'stac_checkbox_theme_data.g.dart'; @@ -31,7 +28,7 @@ abstract class StacCheckboxThemeData with _$StacCheckboxThemeData { extension StacCheckboxThemeDataParser on StacCheckboxThemeData { CheckboxThemeData parse(BuildContext context) { return CheckboxThemeData( - mouseCursor: WidgetStateProperty.all(mouseCursor?.value), + mouseCursor: WidgetStateProperty.all(mouseCursor?.parse), fillColor: fillColor != null ? WidgetStateProperty.all(fillColor!.toColor(context)) : null, diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart index b47114d1..144877ce 100644 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.freezed.dart @@ -94,8 +94,6 @@ abstract mixin class $StacCheckboxThemeDataCopyWith<$Res> { StacVisualDensity? visualDensity, StacShapeBorder? shape, StacBorderSide? side}); - - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -160,20 +158,6 @@ class _$StacCheckboxThemeDataCopyWithImpl<$Res> as StacBorderSide?, )); } - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } /// Adds pattern-matching-related methods to [StacCheckboxThemeData]. @@ -502,9 +486,6 @@ abstract mixin class _$StacCheckboxThemeDataCopyWith<$Res> StacVisualDensity? visualDensity, StacShapeBorder? shape, StacBorderSide? side}); - - @override - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -569,20 +550,6 @@ class __$StacCheckboxThemeDataCopyWithImpl<$Res> as StacBorderSide?, )); } - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart index 3e500a15..28f6d2ca 100644 --- a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.dart @@ -4,11 +4,7 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_chip_theme_data.freezed.dart'; part 'stac_chip_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart index 3e61db9e..0db77290 100644 --- a/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_color_scheme/stac_color_scheme.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -534,6 +533,448 @@ class _$StacColorSchemeCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacColorScheme]. +extension StacColorSchemePatterns on StacColorScheme { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacColorScheme value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacColorScheme() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacColorScheme value) $default, + ) { + final _that = this; + switch (_that) { + case _StacColorScheme(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacColorScheme value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacColorScheme() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + Brightness brightness, + String primary, + String onPrimary, + String? primaryContainer, + String? onPrimaryContainer, + String? primaryFixed, + String? primaryFixedDim, + String? onPrimaryFixed, + String? onPrimaryFixedVariant, + String secondary, + String onSecondary, + String? secondaryContainer, + String? onSecondaryContainer, + String? secondaryFixed, + String? secondaryFixedDim, + String? onSecondaryFixed, + String? onSecondaryFixedVariant, + String? tertiary, + String? onTertiary, + String? tertiaryContainer, + String? onTertiaryContainer, + String? tertiaryFixed, + String? tertiaryFixedDim, + String? onTertiaryFixed, + String? onTertiaryFixedVariant, + String error, + String onError, + String? errorContainer, + String? onErrorContainer, + String surface, + String onSurface, + String? surfaceDim, + String? surfaceBright, + String? surfaceContainerLowest, + String? surfaceContainerLow, + String? surfaceContainer, + String? surfaceContainerHigh, + String? surfaceContainerHighest, + String? onSurfaceVariant, + String? outline, + String? outlineVariant, + String? shadow, + String? scrim, + String? inverseSurface, + String? onInverseSurface, + String? inversePrimary, + String? surfaceTint)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacColorScheme() when $default != null: + return $default( + _that.brightness, + _that.primary, + _that.onPrimary, + _that.primaryContainer, + _that.onPrimaryContainer, + _that.primaryFixed, + _that.primaryFixedDim, + _that.onPrimaryFixed, + _that.onPrimaryFixedVariant, + _that.secondary, + _that.onSecondary, + _that.secondaryContainer, + _that.onSecondaryContainer, + _that.secondaryFixed, + _that.secondaryFixedDim, + _that.onSecondaryFixed, + _that.onSecondaryFixedVariant, + _that.tertiary, + _that.onTertiary, + _that.tertiaryContainer, + _that.onTertiaryContainer, + _that.tertiaryFixed, + _that.tertiaryFixedDim, + _that.onTertiaryFixed, + _that.onTertiaryFixedVariant, + _that.error, + _that.onError, + _that.errorContainer, + _that.onErrorContainer, + _that.surface, + _that.onSurface, + _that.surfaceDim, + _that.surfaceBright, + _that.surfaceContainerLowest, + _that.surfaceContainerLow, + _that.surfaceContainer, + _that.surfaceContainerHigh, + _that.surfaceContainerHighest, + _that.onSurfaceVariant, + _that.outline, + _that.outlineVariant, + _that.shadow, + _that.scrim, + _that.inverseSurface, + _that.onInverseSurface, + _that.inversePrimary, + _that.surfaceTint); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + Brightness brightness, + String primary, + String onPrimary, + String? primaryContainer, + String? onPrimaryContainer, + String? primaryFixed, + String? primaryFixedDim, + String? onPrimaryFixed, + String? onPrimaryFixedVariant, + String secondary, + String onSecondary, + String? secondaryContainer, + String? onSecondaryContainer, + String? secondaryFixed, + String? secondaryFixedDim, + String? onSecondaryFixed, + String? onSecondaryFixedVariant, + String? tertiary, + String? onTertiary, + String? tertiaryContainer, + String? onTertiaryContainer, + String? tertiaryFixed, + String? tertiaryFixedDim, + String? onTertiaryFixed, + String? onTertiaryFixedVariant, + String error, + String onError, + String? errorContainer, + String? onErrorContainer, + String surface, + String onSurface, + String? surfaceDim, + String? surfaceBright, + String? surfaceContainerLowest, + String? surfaceContainerLow, + String? surfaceContainer, + String? surfaceContainerHigh, + String? surfaceContainerHighest, + String? onSurfaceVariant, + String? outline, + String? outlineVariant, + String? shadow, + String? scrim, + String? inverseSurface, + String? onInverseSurface, + String? inversePrimary, + String? surfaceTint) + $default, + ) { + final _that = this; + switch (_that) { + case _StacColorScheme(): + return $default( + _that.brightness, + _that.primary, + _that.onPrimary, + _that.primaryContainer, + _that.onPrimaryContainer, + _that.primaryFixed, + _that.primaryFixedDim, + _that.onPrimaryFixed, + _that.onPrimaryFixedVariant, + _that.secondary, + _that.onSecondary, + _that.secondaryContainer, + _that.onSecondaryContainer, + _that.secondaryFixed, + _that.secondaryFixedDim, + _that.onSecondaryFixed, + _that.onSecondaryFixedVariant, + _that.tertiary, + _that.onTertiary, + _that.tertiaryContainer, + _that.onTertiaryContainer, + _that.tertiaryFixed, + _that.tertiaryFixedDim, + _that.onTertiaryFixed, + _that.onTertiaryFixedVariant, + _that.error, + _that.onError, + _that.errorContainer, + _that.onErrorContainer, + _that.surface, + _that.onSurface, + _that.surfaceDim, + _that.surfaceBright, + _that.surfaceContainerLowest, + _that.surfaceContainerLow, + _that.surfaceContainer, + _that.surfaceContainerHigh, + _that.surfaceContainerHighest, + _that.onSurfaceVariant, + _that.outline, + _that.outlineVariant, + _that.shadow, + _that.scrim, + _that.inverseSurface, + _that.onInverseSurface, + _that.inversePrimary, + _that.surfaceTint); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + Brightness brightness, + String primary, + String onPrimary, + String? primaryContainer, + String? onPrimaryContainer, + String? primaryFixed, + String? primaryFixedDim, + String? onPrimaryFixed, + String? onPrimaryFixedVariant, + String secondary, + String onSecondary, + String? secondaryContainer, + String? onSecondaryContainer, + String? secondaryFixed, + String? secondaryFixedDim, + String? onSecondaryFixed, + String? onSecondaryFixedVariant, + String? tertiary, + String? onTertiary, + String? tertiaryContainer, + String? onTertiaryContainer, + String? tertiaryFixed, + String? tertiaryFixedDim, + String? onTertiaryFixed, + String? onTertiaryFixedVariant, + String error, + String onError, + String? errorContainer, + String? onErrorContainer, + String surface, + String onSurface, + String? surfaceDim, + String? surfaceBright, + String? surfaceContainerLowest, + String? surfaceContainerLow, + String? surfaceContainer, + String? surfaceContainerHigh, + String? surfaceContainerHighest, + String? onSurfaceVariant, + String? outline, + String? outlineVariant, + String? shadow, + String? scrim, + String? inverseSurface, + String? onInverseSurface, + String? inversePrimary, + String? surfaceTint)? + $default, + ) { + final _that = this; + switch (_that) { + case _StacColorScheme() when $default != null: + return $default( + _that.brightness, + _that.primary, + _that.onPrimary, + _that.primaryContainer, + _that.onPrimaryContainer, + _that.primaryFixed, + _that.primaryFixedDim, + _that.onPrimaryFixed, + _that.onPrimaryFixedVariant, + _that.secondary, + _that.onSecondary, + _that.secondaryContainer, + _that.onSecondaryContainer, + _that.secondaryFixed, + _that.secondaryFixedDim, + _that.onSecondaryFixed, + _that.onSecondaryFixedVariant, + _that.tertiary, + _that.onTertiary, + _that.tertiaryContainer, + _that.onTertiaryContainer, + _that.tertiaryFixed, + _that.tertiaryFixedDim, + _that.onTertiaryFixed, + _that.onTertiaryFixedVariant, + _that.error, + _that.onError, + _that.errorContainer, + _that.onErrorContainer, + _that.surface, + _that.onSurface, + _that.surfaceDim, + _that.surfaceBright, + _that.surfaceContainerLowest, + _that.surfaceContainerLow, + _that.surfaceContainer, + _that.surfaceContainerHigh, + _that.surfaceContainerHighest, + _that.onSurfaceVariant, + _that.outline, + _that.outlineVariant, + _that.shadow, + _that.scrim, + _that.inverseSurface, + _that.onInverseSurface, + _that.inversePrimary, + _that.surfaceTint); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacColorScheme implements StacColorScheme { diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart index 7a6e786c..227e13b3 100644 --- a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.dart @@ -2,13 +2,9 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_date_picker_theme_data.freezed.dart'; part 'stac_date_picker_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart index b0ae6548..91545d5e 100644 --- a/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_date_picker_theme_data/stac_date_picker_theme_data.freezed.dart @@ -240,8 +240,6 @@ abstract mixin class $StacDatePickerThemeDataCopyWith<$Res> { StacInputDecorationTheme? inputDecorationTheme, StacButtonStyle? cancelButtonStyle, StacButtonStyle? confirmButtonStyle}); - - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; } /// @nodoc @@ -448,21 +446,6 @@ class _$StacDatePickerThemeDataCopyWithImpl<$Res> as StacButtonStyle?, )); } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { - if (_self.inputDecorationTheme == null) { - return null; - } - - return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, - (value) { - return _then(_self.copyWith(inputDecorationTheme: value)); - }); - } } /// Adds pattern-matching-related methods to [StacDatePickerThemeData]. @@ -1161,9 +1144,6 @@ abstract mixin class _$StacDatePickerThemeDataCopyWith<$Res> StacInputDecorationTheme? inputDecorationTheme, StacButtonStyle? cancelButtonStyle, StacButtonStyle? confirmButtonStyle}); - - @override - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; } /// @nodoc @@ -1370,21 +1350,6 @@ class __$StacDatePickerThemeDataCopyWithImpl<$Res> as StacButtonStyle?, )); } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { - if (_self.inputDecorationTheme == null) { - return null; - } - - return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, - (value) { - return _then(_self.copyWith(inputDecorationTheme: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart b/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart index a5794d87..97ebcaaf 100644 --- a/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart @@ -5,9 +5,7 @@ import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_dialog_theme.freezed.dart'; part 'stac_dialog_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart index f61fb5c9..80bc0bcd 100644 --- a/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_divider_theme_data/stac_divider_theme_data.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -115,6 +114,172 @@ class _$StacDividerThemeDataCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacDividerThemeData]. +extension StacDividerThemeDataPatterns on StacDividerThemeData { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacDividerThemeData value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacDividerThemeData() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacDividerThemeData value) $default, + ) { + final _that = this; + switch (_that) { + case _StacDividerThemeData(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacDividerThemeData value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacDividerThemeData() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String? color, double? space, double? thickness, + double? indent, double? endIndent)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacDividerThemeData() when $default != null: + return $default(_that.color, _that.space, _that.thickness, _that.indent, + _that.endIndent); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String? color, double? space, double? thickness, + double? indent, double? endIndent) + $default, + ) { + final _that = this; + switch (_that) { + case _StacDividerThemeData(): + return $default(_that.color, _that.space, _that.thickness, _that.indent, + _that.endIndent); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String? color, double? space, double? thickness, + double? indent, double? endIndent)? + $default, + ) { + final _that = this; + switch (_that) { + case _StacDividerThemeData() when $default != null: + return $default(_that.color, _that.space, _that.thickness, _that.indent, + _that.endIndent); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacDividerThemeData implements StacDividerThemeData { diff --git a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart index 735d346d..0089083a 100644 --- a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_drawer_theme_data.freezed.dart'; part 'stac_drawer_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart index 5461541c..8823312c 100644 --- a/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart @@ -3,8 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_floating_action_button_theme_data.freezed.dart'; part 'stac_floating_action_button_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart index 4c5cb55b..2aae3517 100644 --- a/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/types/stac_shadow/stac_shadow.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_icon_theme_data.freezed.dart'; part 'stac_icon_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart b/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart deleted file mode 100644 index 8101a228..00000000 --- a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart +++ /dev/null @@ -1,110 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_input_border/stac_input_border.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; - -part 'stac_input_decoration_theme.freezed.dart'; -part 'stac_input_decoration_theme.g.dart'; - -enum StacFloatingLabelAlignment { - start, - center; - - FloatingLabelAlignment get parse { - switch (this) { - case start: - return FloatingLabelAlignment.start; - case center: - return FloatingLabelAlignment.center; - } - } -} - -@freezed -abstract class StacInputDecorationTheme with _$StacInputDecorationTheme { - const factory StacInputDecorationTheme({ - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - @Default(false) bool isDense, - StacEdgeInsets? contentPadding, - @Default(false) bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - @Default(false) bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - @Default(false) bool alignLabelWithHint, - StacBoxConstraints? constraints, - }) = _StacInputDecorationTheme; - - factory StacInputDecorationTheme.fromJson(Map json) => - _$StacInputDecorationThemeFromJson(json); -} - -extension StacInputDecorationThemeParser on StacInputDecorationTheme? { - InputDecorationTheme parse(BuildContext context) { - return InputDecorationTheme( - labelStyle: this?.labelStyle?.parse(context), - floatingLabelStyle: this?.floatingLabelStyle?.parse(context), - helperStyle: this?.helperStyle?.parse(context), - helperMaxLines: this?.helperMaxLines, - hintStyle: this?.hintStyle?.parse(context), - errorStyle: this?.errorStyle?.parse(context), - errorMaxLines: this?.errorMaxLines, - floatingLabelBehavior: - this?.floatingLabelBehavior ?? FloatingLabelBehavior.auto, - floatingLabelAlignment: - this?.floatingLabelAlignment?.parse ?? FloatingLabelAlignment.start, - isDense: this?.isDense ?? false, - contentPadding: this?.contentPadding?.parse, - isCollapsed: this?.isCollapsed ?? false, - iconColor: this?.iconColor.toColor(context), - prefixStyle: this?.prefixStyle?.parse(context), - prefixIconColor: this?.prefixIconColor.toColor(context), - suffixStyle: this?.suffixStyle?.parse(context), - suffixIconColor: this?.suffixIconColor.toColor(context), - counterStyle: this?.counterStyle?.parse(context), - filled: this?.filled ?? false, - fillColor: this?.fillColor.toColor(context), - activeIndicatorBorder: this?.activeIndicatorBorder?.parse(context), - outlineBorder: this?.outlineBorder?.parse(context), - focusColor: this?.focusColor.toColor(context), - hoverColor: this?.hoverColor.toColor(context), - errorBorder: this?.errorBorder?.parse(context), - focusedBorder: this?.focusedBorder?.parse(context), - focusedErrorBorder: this?.focusedErrorBorder?.parse(context), - disabledBorder: this?.disabledBorder?.parse(context), - enabledBorder: this?.enabledBorder?.parse(context), - border: this?.border?.parse(context), - alignLabelWithHint: this?.alignLabelWithHint ?? false, - constraints: this?.constraints?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.freezed.dart deleted file mode 100644 index 4dee3695..00000000 --- a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.freezed.dart +++ /dev/null @@ -1,1391 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_input_decoration_theme.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacInputDecorationTheme { - StacTextStyle? get labelStyle; - StacTextStyle? get floatingLabelStyle; - StacTextStyle? get helperStyle; - int? get helperMaxLines; - StacTextStyle? get hintStyle; - StacTextStyle? get errorStyle; - int? get errorMaxLines; - FloatingLabelBehavior? get floatingLabelBehavior; - StacFloatingLabelAlignment? get floatingLabelAlignment; - bool get isDense; - StacEdgeInsets? get contentPadding; - bool get isCollapsed; - String? get iconColor; - StacTextStyle? get prefixStyle; - String? get prefixIconColor; - StacTextStyle? get suffixStyle; - String? get suffixIconColor; - StacTextStyle? get counterStyle; - bool get filled; - String? get fillColor; - StacBorderSide? get activeIndicatorBorder; - StacBorderSide? get outlineBorder; - String? get focusColor; - String? get hoverColor; - StacInputBorder? get errorBorder; - StacInputBorder? get focusedBorder; - StacInputBorder? get focusedErrorBorder; - StacInputBorder? get disabledBorder; - StacInputBorder? get enabledBorder; - StacInputBorder? get border; - bool get alignLabelWithHint; - StacBoxConstraints? get constraints; - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacInputDecorationThemeCopyWith get copyWith => - _$StacInputDecorationThemeCopyWithImpl( - this as StacInputDecorationTheme, _$identity); - - /// Serializes this StacInputDecorationTheme to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacInputDecorationTheme && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.floatingLabelStyle, floatingLabelStyle) || - other.floatingLabelStyle == floatingLabelStyle) && - (identical(other.helperStyle, helperStyle) || - other.helperStyle == helperStyle) && - (identical(other.helperMaxLines, helperMaxLines) || - other.helperMaxLines == helperMaxLines) && - (identical(other.hintStyle, hintStyle) || - other.hintStyle == hintStyle) && - (identical(other.errorStyle, errorStyle) || - other.errorStyle == errorStyle) && - (identical(other.errorMaxLines, errorMaxLines) || - other.errorMaxLines == errorMaxLines) && - (identical(other.floatingLabelBehavior, floatingLabelBehavior) || - other.floatingLabelBehavior == floatingLabelBehavior) && - (identical(other.floatingLabelAlignment, floatingLabelAlignment) || - other.floatingLabelAlignment == floatingLabelAlignment) && - (identical(other.isDense, isDense) || other.isDense == isDense) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - (identical(other.isCollapsed, isCollapsed) || - other.isCollapsed == isCollapsed) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.prefixStyle, prefixStyle) || - other.prefixStyle == prefixStyle) && - (identical(other.prefixIconColor, prefixIconColor) || - other.prefixIconColor == prefixIconColor) && - (identical(other.suffixStyle, suffixStyle) || - other.suffixStyle == suffixStyle) && - (identical(other.suffixIconColor, suffixIconColor) || - other.suffixIconColor == suffixIconColor) && - (identical(other.counterStyle, counterStyle) || - other.counterStyle == counterStyle) && - (identical(other.filled, filled) || other.filled == filled) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.activeIndicatorBorder, activeIndicatorBorder) || - other.activeIndicatorBorder == activeIndicatorBorder) && - (identical(other.outlineBorder, outlineBorder) || - other.outlineBorder == outlineBorder) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.errorBorder, errorBorder) || - other.errorBorder == errorBorder) && - (identical(other.focusedBorder, focusedBorder) || - other.focusedBorder == focusedBorder) && - (identical(other.focusedErrorBorder, focusedErrorBorder) || - other.focusedErrorBorder == focusedErrorBorder) && - (identical(other.disabledBorder, disabledBorder) || - other.disabledBorder == disabledBorder) && - (identical(other.enabledBorder, enabledBorder) || - other.enabledBorder == enabledBorder) && - (identical(other.border, border) || other.border == border) && - (identical(other.alignLabelWithHint, alignLabelWithHint) || - other.alignLabelWithHint == alignLabelWithHint) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - labelStyle, - floatingLabelStyle, - helperStyle, - helperMaxLines, - hintStyle, - errorStyle, - errorMaxLines, - floatingLabelBehavior, - floatingLabelAlignment, - isDense, - contentPadding, - isCollapsed, - iconColor, - prefixStyle, - prefixIconColor, - suffixStyle, - suffixIconColor, - counterStyle, - filled, - fillColor, - activeIndicatorBorder, - outlineBorder, - focusColor, - hoverColor, - errorBorder, - focusedBorder, - focusedErrorBorder, - disabledBorder, - enabledBorder, - border, - alignLabelWithHint, - constraints - ]); - - @override - String toString() { - return 'StacInputDecorationTheme(labelStyle: $labelStyle, floatingLabelStyle: $floatingLabelStyle, helperStyle: $helperStyle, helperMaxLines: $helperMaxLines, hintStyle: $hintStyle, errorStyle: $errorStyle, errorMaxLines: $errorMaxLines, floatingLabelBehavior: $floatingLabelBehavior, floatingLabelAlignment: $floatingLabelAlignment, isDense: $isDense, contentPadding: $contentPadding, isCollapsed: $isCollapsed, iconColor: $iconColor, prefixStyle: $prefixStyle, prefixIconColor: $prefixIconColor, suffixStyle: $suffixStyle, suffixIconColor: $suffixIconColor, counterStyle: $counterStyle, filled: $filled, fillColor: $fillColor, activeIndicatorBorder: $activeIndicatorBorder, outlineBorder: $outlineBorder, focusColor: $focusColor, hoverColor: $hoverColor, errorBorder: $errorBorder, focusedBorder: $focusedBorder, focusedErrorBorder: $focusedErrorBorder, disabledBorder: $disabledBorder, enabledBorder: $enabledBorder, border: $border, alignLabelWithHint: $alignLabelWithHint, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class $StacInputDecorationThemeCopyWith<$Res> { - factory $StacInputDecorationThemeCopyWith(StacInputDecorationTheme value, - $Res Function(StacInputDecorationTheme) _then) = - _$StacInputDecorationThemeCopyWithImpl; - @useResult - $Res call( - {StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isDense, - StacEdgeInsets? contentPadding, - bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool alignLabelWithHint, - StacBoxConstraints? constraints}); - - $StacInputBorderCopyWith<$Res>? get errorBorder; - $StacInputBorderCopyWith<$Res>? get focusedBorder; - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder; - $StacInputBorderCopyWith<$Res>? get disabledBorder; - $StacInputBorderCopyWith<$Res>? get enabledBorder; - $StacInputBorderCopyWith<$Res>? get border; -} - -/// @nodoc -class _$StacInputDecorationThemeCopyWithImpl<$Res> - implements $StacInputDecorationThemeCopyWith<$Res> { - _$StacInputDecorationThemeCopyWithImpl(this._self, this._then); - - final StacInputDecorationTheme _self; - final $Res Function(StacInputDecorationTheme) _then; - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? labelStyle = freezed, - Object? floatingLabelStyle = freezed, - Object? helperStyle = freezed, - Object? helperMaxLines = freezed, - Object? hintStyle = freezed, - Object? errorStyle = freezed, - Object? errorMaxLines = freezed, - Object? floatingLabelBehavior = freezed, - Object? floatingLabelAlignment = freezed, - Object? isDense = null, - Object? contentPadding = freezed, - Object? isCollapsed = null, - Object? iconColor = freezed, - Object? prefixStyle = freezed, - Object? prefixIconColor = freezed, - Object? suffixStyle = freezed, - Object? suffixIconColor = freezed, - Object? counterStyle = freezed, - Object? filled = null, - Object? fillColor = freezed, - Object? activeIndicatorBorder = freezed, - Object? outlineBorder = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? errorBorder = freezed, - Object? focusedBorder = freezed, - Object? focusedErrorBorder = freezed, - Object? disabledBorder = freezed, - Object? enabledBorder = freezed, - Object? border = freezed, - Object? alignLabelWithHint = null, - Object? constraints = freezed, - }) { - return _then(_self.copyWith( - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - floatingLabelStyle: freezed == floatingLabelStyle - ? _self.floatingLabelStyle - : floatingLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperStyle: freezed == helperStyle - ? _self.helperStyle - : helperStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperMaxLines: freezed == helperMaxLines - ? _self.helperMaxLines - : helperMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - hintStyle: freezed == hintStyle - ? _self.hintStyle - : hintStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorStyle: freezed == errorStyle - ? _self.errorStyle - : errorStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorMaxLines: freezed == errorMaxLines - ? _self.errorMaxLines - : errorMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - floatingLabelBehavior: freezed == floatingLabelBehavior - ? _self.floatingLabelBehavior - : floatingLabelBehavior // ignore: cast_nullable_to_non_nullable - as FloatingLabelBehavior?, - floatingLabelAlignment: freezed == floatingLabelAlignment - ? _self.floatingLabelAlignment - : floatingLabelAlignment // ignore: cast_nullable_to_non_nullable - as StacFloatingLabelAlignment?, - isDense: null == isDense - ? _self.isDense - : isDense // ignore: cast_nullable_to_non_nullable - as bool, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - isCollapsed: null == isCollapsed - ? _self.isCollapsed - : isCollapsed // ignore: cast_nullable_to_non_nullable - as bool, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - prefixStyle: freezed == prefixStyle - ? _self.prefixStyle - : prefixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - prefixIconColor: freezed == prefixIconColor - ? _self.prefixIconColor - : prefixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - suffixStyle: freezed == suffixStyle - ? _self.suffixStyle - : suffixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - suffixIconColor: freezed == suffixIconColor - ? _self.suffixIconColor - : suffixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - counterStyle: freezed == counterStyle - ? _self.counterStyle - : counterStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - filled: null == filled - ? _self.filled - : filled // ignore: cast_nullable_to_non_nullable - as bool, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - activeIndicatorBorder: freezed == activeIndicatorBorder - ? _self.activeIndicatorBorder - : activeIndicatorBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - outlineBorder: freezed == outlineBorder - ? _self.outlineBorder - : outlineBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - errorBorder: freezed == errorBorder - ? _self.errorBorder - : errorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedBorder: freezed == focusedBorder - ? _self.focusedBorder - : focusedBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedErrorBorder: freezed == focusedErrorBorder - ? _self.focusedErrorBorder - : focusedErrorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - disabledBorder: freezed == disabledBorder - ? _self.disabledBorder - : disabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabledBorder: freezed == enabledBorder - ? _self.enabledBorder - : enabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - border: freezed == border - ? _self.border - : border // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - alignLabelWithHint: null == alignLabelWithHint - ? _self.alignLabelWithHint - : alignLabelWithHint // ignore: cast_nullable_to_non_nullable - as bool, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get errorBorder { - if (_self.errorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.errorBorder!, (value) { - return _then(_self.copyWith(errorBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedBorder { - if (_self.focusedBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedBorder!, (value) { - return _then(_self.copyWith(focusedBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder { - if (_self.focusedErrorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedErrorBorder!, (value) { - return _then(_self.copyWith(focusedErrorBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get disabledBorder { - if (_self.disabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.disabledBorder!, (value) { - return _then(_self.copyWith(disabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get enabledBorder { - if (_self.enabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.enabledBorder!, (value) { - return _then(_self.copyWith(enabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get border { - if (_self.border == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.border!, (value) { - return _then(_self.copyWith(border: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacInputDecorationTheme]. -extension StacInputDecorationThemePatterns on StacInputDecorationTheme { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_StacInputDecorationTheme value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_StacInputDecorationTheme value) $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_StacInputDecorationTheme value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isDense, - StacEdgeInsets? contentPadding, - bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool alignLabelWithHint, - StacBoxConstraints? constraints)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme() when $default != null: - return $default( - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperStyle, - _that.helperMaxLines, - _that.hintStyle, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isDense, - _that.contentPadding, - _that.isCollapsed, - _that.iconColor, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffixStyle, - _that.suffixIconColor, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.activeIndicatorBorder, - _that.outlineBorder, - _that.focusColor, - _that.hoverColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.alignLabelWithHint, - _that.constraints); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function( - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isDense, - StacEdgeInsets? contentPadding, - bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool alignLabelWithHint, - StacBoxConstraints? constraints) - $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme(): - return $default( - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperStyle, - _that.helperMaxLines, - _that.hintStyle, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isDense, - _that.contentPadding, - _that.isCollapsed, - _that.iconColor, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffixStyle, - _that.suffixIconColor, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.activeIndicatorBorder, - _that.outlineBorder, - _that.focusColor, - _that.hoverColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.alignLabelWithHint, - _that.constraints); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isDense, - StacEdgeInsets? contentPadding, - bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool alignLabelWithHint, - StacBoxConstraints? constraints)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecorationTheme() when $default != null: - return $default( - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperStyle, - _that.helperMaxLines, - _that.hintStyle, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isDense, - _that.contentPadding, - _that.isCollapsed, - _that.iconColor, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffixStyle, - _that.suffixIconColor, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.activeIndicatorBorder, - _that.outlineBorder, - _that.focusColor, - _that.hoverColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.alignLabelWithHint, - _that.constraints); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacInputDecorationTheme implements StacInputDecorationTheme { - const _StacInputDecorationTheme( - {this.labelStyle, - this.floatingLabelStyle, - this.helperStyle, - this.helperMaxLines, - this.hintStyle, - this.errorStyle, - this.errorMaxLines, - this.floatingLabelBehavior, - this.floatingLabelAlignment, - this.isDense = false, - this.contentPadding, - this.isCollapsed = false, - this.iconColor, - this.prefixStyle, - this.prefixIconColor, - this.suffixStyle, - this.suffixIconColor, - this.counterStyle, - this.filled = false, - this.fillColor, - this.activeIndicatorBorder, - this.outlineBorder, - this.focusColor, - this.hoverColor, - this.errorBorder, - this.focusedBorder, - this.focusedErrorBorder, - this.disabledBorder, - this.enabledBorder, - this.border, - this.alignLabelWithHint = false, - this.constraints}); - factory _StacInputDecorationTheme.fromJson(Map json) => - _$StacInputDecorationThemeFromJson(json); - - @override - final StacTextStyle? labelStyle; - @override - final StacTextStyle? floatingLabelStyle; - @override - final StacTextStyle? helperStyle; - @override - final int? helperMaxLines; - @override - final StacTextStyle? hintStyle; - @override - final StacTextStyle? errorStyle; - @override - final int? errorMaxLines; - @override - final FloatingLabelBehavior? floatingLabelBehavior; - @override - final StacFloatingLabelAlignment? floatingLabelAlignment; - @override - @JsonKey() - final bool isDense; - @override - final StacEdgeInsets? contentPadding; - @override - @JsonKey() - final bool isCollapsed; - @override - final String? iconColor; - @override - final StacTextStyle? prefixStyle; - @override - final String? prefixIconColor; - @override - final StacTextStyle? suffixStyle; - @override - final String? suffixIconColor; - @override - final StacTextStyle? counterStyle; - @override - @JsonKey() - final bool filled; - @override - final String? fillColor; - @override - final StacBorderSide? activeIndicatorBorder; - @override - final StacBorderSide? outlineBorder; - @override - final String? focusColor; - @override - final String? hoverColor; - @override - final StacInputBorder? errorBorder; - @override - final StacInputBorder? focusedBorder; - @override - final StacInputBorder? focusedErrorBorder; - @override - final StacInputBorder? disabledBorder; - @override - final StacInputBorder? enabledBorder; - @override - final StacInputBorder? border; - @override - @JsonKey() - final bool alignLabelWithHint; - @override - final StacBoxConstraints? constraints; - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacInputDecorationThemeCopyWith<_StacInputDecorationTheme> get copyWith => - __$StacInputDecorationThemeCopyWithImpl<_StacInputDecorationTheme>( - this, _$identity); - - @override - Map toJson() { - return _$StacInputDecorationThemeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacInputDecorationTheme && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.floatingLabelStyle, floatingLabelStyle) || - other.floatingLabelStyle == floatingLabelStyle) && - (identical(other.helperStyle, helperStyle) || - other.helperStyle == helperStyle) && - (identical(other.helperMaxLines, helperMaxLines) || - other.helperMaxLines == helperMaxLines) && - (identical(other.hintStyle, hintStyle) || - other.hintStyle == hintStyle) && - (identical(other.errorStyle, errorStyle) || - other.errorStyle == errorStyle) && - (identical(other.errorMaxLines, errorMaxLines) || - other.errorMaxLines == errorMaxLines) && - (identical(other.floatingLabelBehavior, floatingLabelBehavior) || - other.floatingLabelBehavior == floatingLabelBehavior) && - (identical(other.floatingLabelAlignment, floatingLabelAlignment) || - other.floatingLabelAlignment == floatingLabelAlignment) && - (identical(other.isDense, isDense) || other.isDense == isDense) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - (identical(other.isCollapsed, isCollapsed) || - other.isCollapsed == isCollapsed) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.prefixStyle, prefixStyle) || - other.prefixStyle == prefixStyle) && - (identical(other.prefixIconColor, prefixIconColor) || - other.prefixIconColor == prefixIconColor) && - (identical(other.suffixStyle, suffixStyle) || - other.suffixStyle == suffixStyle) && - (identical(other.suffixIconColor, suffixIconColor) || - other.suffixIconColor == suffixIconColor) && - (identical(other.counterStyle, counterStyle) || - other.counterStyle == counterStyle) && - (identical(other.filled, filled) || other.filled == filled) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.activeIndicatorBorder, activeIndicatorBorder) || - other.activeIndicatorBorder == activeIndicatorBorder) && - (identical(other.outlineBorder, outlineBorder) || - other.outlineBorder == outlineBorder) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.errorBorder, errorBorder) || - other.errorBorder == errorBorder) && - (identical(other.focusedBorder, focusedBorder) || - other.focusedBorder == focusedBorder) && - (identical(other.focusedErrorBorder, focusedErrorBorder) || - other.focusedErrorBorder == focusedErrorBorder) && - (identical(other.disabledBorder, disabledBorder) || - other.disabledBorder == disabledBorder) && - (identical(other.enabledBorder, enabledBorder) || - other.enabledBorder == enabledBorder) && - (identical(other.border, border) || other.border == border) && - (identical(other.alignLabelWithHint, alignLabelWithHint) || - other.alignLabelWithHint == alignLabelWithHint) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - labelStyle, - floatingLabelStyle, - helperStyle, - helperMaxLines, - hintStyle, - errorStyle, - errorMaxLines, - floatingLabelBehavior, - floatingLabelAlignment, - isDense, - contentPadding, - isCollapsed, - iconColor, - prefixStyle, - prefixIconColor, - suffixStyle, - suffixIconColor, - counterStyle, - filled, - fillColor, - activeIndicatorBorder, - outlineBorder, - focusColor, - hoverColor, - errorBorder, - focusedBorder, - focusedErrorBorder, - disabledBorder, - enabledBorder, - border, - alignLabelWithHint, - constraints - ]); - - @override - String toString() { - return 'StacInputDecorationTheme(labelStyle: $labelStyle, floatingLabelStyle: $floatingLabelStyle, helperStyle: $helperStyle, helperMaxLines: $helperMaxLines, hintStyle: $hintStyle, errorStyle: $errorStyle, errorMaxLines: $errorMaxLines, floatingLabelBehavior: $floatingLabelBehavior, floatingLabelAlignment: $floatingLabelAlignment, isDense: $isDense, contentPadding: $contentPadding, isCollapsed: $isCollapsed, iconColor: $iconColor, prefixStyle: $prefixStyle, prefixIconColor: $prefixIconColor, suffixStyle: $suffixStyle, suffixIconColor: $suffixIconColor, counterStyle: $counterStyle, filled: $filled, fillColor: $fillColor, activeIndicatorBorder: $activeIndicatorBorder, outlineBorder: $outlineBorder, focusColor: $focusColor, hoverColor: $hoverColor, errorBorder: $errorBorder, focusedBorder: $focusedBorder, focusedErrorBorder: $focusedErrorBorder, disabledBorder: $disabledBorder, enabledBorder: $enabledBorder, border: $border, alignLabelWithHint: $alignLabelWithHint, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class _$StacInputDecorationThemeCopyWith<$Res> - implements $StacInputDecorationThemeCopyWith<$Res> { - factory _$StacInputDecorationThemeCopyWith(_StacInputDecorationTheme value, - $Res Function(_StacInputDecorationTheme) _then) = - __$StacInputDecorationThemeCopyWithImpl; - @override - @useResult - $Res call( - {StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - StacTextStyle? helperStyle, - int? helperMaxLines, - StacTextStyle? hintStyle, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isDense, - StacEdgeInsets? contentPadding, - bool isCollapsed, - String? iconColor, - StacTextStyle? prefixStyle, - String? prefixIconColor, - StacTextStyle? suffixStyle, - String? suffixIconColor, - StacTextStyle? counterStyle, - bool filled, - String? fillColor, - StacBorderSide? activeIndicatorBorder, - StacBorderSide? outlineBorder, - String? focusColor, - String? hoverColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool alignLabelWithHint, - StacBoxConstraints? constraints}); - - @override - $StacInputBorderCopyWith<$Res>? get errorBorder; - @override - $StacInputBorderCopyWith<$Res>? get focusedBorder; - @override - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder; - @override - $StacInputBorderCopyWith<$Res>? get disabledBorder; - @override - $StacInputBorderCopyWith<$Res>? get enabledBorder; - @override - $StacInputBorderCopyWith<$Res>? get border; -} - -/// @nodoc -class __$StacInputDecorationThemeCopyWithImpl<$Res> - implements _$StacInputDecorationThemeCopyWith<$Res> { - __$StacInputDecorationThemeCopyWithImpl(this._self, this._then); - - final _StacInputDecorationTheme _self; - final $Res Function(_StacInputDecorationTheme) _then; - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? labelStyle = freezed, - Object? floatingLabelStyle = freezed, - Object? helperStyle = freezed, - Object? helperMaxLines = freezed, - Object? hintStyle = freezed, - Object? errorStyle = freezed, - Object? errorMaxLines = freezed, - Object? floatingLabelBehavior = freezed, - Object? floatingLabelAlignment = freezed, - Object? isDense = null, - Object? contentPadding = freezed, - Object? isCollapsed = null, - Object? iconColor = freezed, - Object? prefixStyle = freezed, - Object? prefixIconColor = freezed, - Object? suffixStyle = freezed, - Object? suffixIconColor = freezed, - Object? counterStyle = freezed, - Object? filled = null, - Object? fillColor = freezed, - Object? activeIndicatorBorder = freezed, - Object? outlineBorder = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? errorBorder = freezed, - Object? focusedBorder = freezed, - Object? focusedErrorBorder = freezed, - Object? disabledBorder = freezed, - Object? enabledBorder = freezed, - Object? border = freezed, - Object? alignLabelWithHint = null, - Object? constraints = freezed, - }) { - return _then(_StacInputDecorationTheme( - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - floatingLabelStyle: freezed == floatingLabelStyle - ? _self.floatingLabelStyle - : floatingLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperStyle: freezed == helperStyle - ? _self.helperStyle - : helperStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperMaxLines: freezed == helperMaxLines - ? _self.helperMaxLines - : helperMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - hintStyle: freezed == hintStyle - ? _self.hintStyle - : hintStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorStyle: freezed == errorStyle - ? _self.errorStyle - : errorStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorMaxLines: freezed == errorMaxLines - ? _self.errorMaxLines - : errorMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - floatingLabelBehavior: freezed == floatingLabelBehavior - ? _self.floatingLabelBehavior - : floatingLabelBehavior // ignore: cast_nullable_to_non_nullable - as FloatingLabelBehavior?, - floatingLabelAlignment: freezed == floatingLabelAlignment - ? _self.floatingLabelAlignment - : floatingLabelAlignment // ignore: cast_nullable_to_non_nullable - as StacFloatingLabelAlignment?, - isDense: null == isDense - ? _self.isDense - : isDense // ignore: cast_nullable_to_non_nullable - as bool, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - isCollapsed: null == isCollapsed - ? _self.isCollapsed - : isCollapsed // ignore: cast_nullable_to_non_nullable - as bool, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - prefixStyle: freezed == prefixStyle - ? _self.prefixStyle - : prefixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - prefixIconColor: freezed == prefixIconColor - ? _self.prefixIconColor - : prefixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - suffixStyle: freezed == suffixStyle - ? _self.suffixStyle - : suffixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - suffixIconColor: freezed == suffixIconColor - ? _self.suffixIconColor - : suffixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - counterStyle: freezed == counterStyle - ? _self.counterStyle - : counterStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - filled: null == filled - ? _self.filled - : filled // ignore: cast_nullable_to_non_nullable - as bool, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - activeIndicatorBorder: freezed == activeIndicatorBorder - ? _self.activeIndicatorBorder - : activeIndicatorBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - outlineBorder: freezed == outlineBorder - ? _self.outlineBorder - : outlineBorder // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - errorBorder: freezed == errorBorder - ? _self.errorBorder - : errorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedBorder: freezed == focusedBorder - ? _self.focusedBorder - : focusedBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedErrorBorder: freezed == focusedErrorBorder - ? _self.focusedErrorBorder - : focusedErrorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - disabledBorder: freezed == disabledBorder - ? _self.disabledBorder - : disabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabledBorder: freezed == enabledBorder - ? _self.enabledBorder - : enabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - border: freezed == border - ? _self.border - : border // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - alignLabelWithHint: null == alignLabelWithHint - ? _self.alignLabelWithHint - : alignLabelWithHint // ignore: cast_nullable_to_non_nullable - as bool, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get errorBorder { - if (_self.errorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.errorBorder!, (value) { - return _then(_self.copyWith(errorBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedBorder { - if (_self.focusedBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedBorder!, (value) { - return _then(_self.copyWith(focusedBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder { - if (_self.focusedErrorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedErrorBorder!, (value) { - return _then(_self.copyWith(focusedErrorBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get disabledBorder { - if (_self.disabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.disabledBorder!, (value) { - return _then(_self.copyWith(disabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get enabledBorder { - if (_self.enabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.enabledBorder!, (value) { - return _then(_self.copyWith(enabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecorationTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get border { - if (_self.border == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.border!, (value) { - return _then(_self.copyWith(border: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart b/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart deleted file mode 100644 index 3f12c603..00000000 --- a/packages/stac/lib/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart +++ /dev/null @@ -1,142 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_input_decoration_theme.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacInputDecorationTheme _$StacInputDecorationThemeFromJson( - Map json) => - _StacInputDecorationTheme( - labelStyle: json['labelStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelStyle'] as Map), - floatingLabelStyle: json['floatingLabelStyle'] == null - ? null - : StacTextStyle.fromJson( - json['floatingLabelStyle'] as Map), - helperStyle: json['helperStyle'] == null - ? null - : StacTextStyle.fromJson(json['helperStyle'] as Map), - helperMaxLines: (json['helperMaxLines'] as num?)?.toInt(), - hintStyle: json['hintStyle'] == null - ? null - : StacTextStyle.fromJson(json['hintStyle'] as Map), - errorStyle: json['errorStyle'] == null - ? null - : StacTextStyle.fromJson(json['errorStyle'] as Map), - errorMaxLines: (json['errorMaxLines'] as num?)?.toInt(), - floatingLabelBehavior: $enumDecodeNullable( - _$FloatingLabelBehaviorEnumMap, json['floatingLabelBehavior']), - floatingLabelAlignment: $enumDecodeNullable( - _$StacFloatingLabelAlignmentEnumMap, json['floatingLabelAlignment']), - isDense: json['isDense'] as bool? ?? false, - contentPadding: json['contentPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['contentPadding']), - isCollapsed: json['isCollapsed'] as bool? ?? false, - iconColor: json['iconColor'] as String?, - prefixStyle: json['prefixStyle'] == null - ? null - : StacTextStyle.fromJson(json['prefixStyle'] as Map), - prefixIconColor: json['prefixIconColor'] as String?, - suffixStyle: json['suffixStyle'] == null - ? null - : StacTextStyle.fromJson(json['suffixStyle'] as Map), - suffixIconColor: json['suffixIconColor'] as String?, - counterStyle: json['counterStyle'] == null - ? null - : StacTextStyle.fromJson( - json['counterStyle'] as Map), - filled: json['filled'] as bool? ?? false, - fillColor: json['fillColor'] as String?, - activeIndicatorBorder: json['activeIndicatorBorder'] == null - ? null - : StacBorderSide.fromJson( - json['activeIndicatorBorder'] as Map), - outlineBorder: json['outlineBorder'] == null - ? null - : StacBorderSide.fromJson( - json['outlineBorder'] as Map), - focusColor: json['focusColor'] as String?, - hoverColor: json['hoverColor'] as String?, - errorBorder: json['errorBorder'] == null - ? null - : StacInputBorder.fromJson( - json['errorBorder'] as Map), - focusedBorder: json['focusedBorder'] == null - ? null - : StacInputBorder.fromJson( - json['focusedBorder'] as Map), - focusedErrorBorder: json['focusedErrorBorder'] == null - ? null - : StacInputBorder.fromJson( - json['focusedErrorBorder'] as Map), - disabledBorder: json['disabledBorder'] == null - ? null - : StacInputBorder.fromJson( - json['disabledBorder'] as Map), - enabledBorder: json['enabledBorder'] == null - ? null - : StacInputBorder.fromJson( - json['enabledBorder'] as Map), - border: json['border'] == null - ? null - : StacInputBorder.fromJson(json['border'] as Map), - alignLabelWithHint: json['alignLabelWithHint'] as bool? ?? false, - constraints: json['constraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['constraints'] as Map), - ); - -Map _$StacInputDecorationThemeToJson( - _StacInputDecorationTheme instance) => - { - 'labelStyle': instance.labelStyle, - 'floatingLabelStyle': instance.floatingLabelStyle, - 'helperStyle': instance.helperStyle, - 'helperMaxLines': instance.helperMaxLines, - 'hintStyle': instance.hintStyle, - 'errorStyle': instance.errorStyle, - 'errorMaxLines': instance.errorMaxLines, - 'floatingLabelBehavior': - _$FloatingLabelBehaviorEnumMap[instance.floatingLabelBehavior], - 'floatingLabelAlignment': - _$StacFloatingLabelAlignmentEnumMap[instance.floatingLabelAlignment], - 'isDense': instance.isDense, - 'contentPadding': instance.contentPadding, - 'isCollapsed': instance.isCollapsed, - 'iconColor': instance.iconColor, - 'prefixStyle': instance.prefixStyle, - 'prefixIconColor': instance.prefixIconColor, - 'suffixStyle': instance.suffixStyle, - 'suffixIconColor': instance.suffixIconColor, - 'counterStyle': instance.counterStyle, - 'filled': instance.filled, - 'fillColor': instance.fillColor, - 'activeIndicatorBorder': instance.activeIndicatorBorder, - 'outlineBorder': instance.outlineBorder, - 'focusColor': instance.focusColor, - 'hoverColor': instance.hoverColor, - 'errorBorder': instance.errorBorder, - 'focusedBorder': instance.focusedBorder, - 'focusedErrorBorder': instance.focusedErrorBorder, - 'disabledBorder': instance.disabledBorder, - 'enabledBorder': instance.enabledBorder, - 'border': instance.border, - 'alignLabelWithHint': instance.alignLabelWithHint, - 'constraints': instance.constraints, - }; - -const _$FloatingLabelBehaviorEnumMap = { - FloatingLabelBehavior.never: 'never', - FloatingLabelBehavior.auto: 'auto', - FloatingLabelBehavior.always: 'always', -}; - -const _$StacFloatingLabelAlignmentEnumMap = { - StacFloatingLabelAlignment.start: 'start', - StacFloatingLabelAlignment.center: 'center', -}; diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart index 0d80f48f..63bcee33 100644 --- a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart @@ -3,12 +3,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_visual_density/stac_visual_density.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_shadow/stac_shadow.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_list_tile_theme_data.freezed.dart'; part 'stac_list_tile_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart index 04928d40..1f5df04b 100644 --- a/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.freezed.dart @@ -145,8 +145,6 @@ abstract mixin class $StacListTileThemeDataCopyWith<$Res> { StacVisualDensity? visualDensity, ListTileTitleAlignment? titleAlignment, List? shadows}); - - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -261,20 +259,6 @@ class _$StacListTileThemeDataCopyWithImpl<$Res> as List?, )); } - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } /// Adds pattern-matching-related methods to [StacListTileThemeData]. @@ -742,9 +726,6 @@ abstract mixin class _$StacListTileThemeDataCopyWith<$Res> StacVisualDensity? visualDensity, ListTileTitleAlignment? titleAlignment, List? shadows}); - - @override - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -859,20 +840,6 @@ class __$StacListTileThemeDataCopyWithImpl<$Res> as List?, )); } - - /// Create a copy of StacListTileThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart index afac3500..59fe02d7 100644 --- a/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart @@ -3,8 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_material_banner_theme_data.freezed.dart'; part 'stac_material_banner_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart index 59cce741..23cbf098 100644 --- a/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_material_color/stac_material_color.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -181,6 +180,232 @@ class _$StacMaterialColorCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacMaterialColor]. +extension StacMaterialColorPatterns on StacMaterialColor { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacMaterialColor value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacMaterialColor() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacMaterialColor value) $default, + ) { + final _that = this; + switch (_that) { + case _StacMaterialColor(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacMaterialColor value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacMaterialColor() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + String primary, + String shade50, + String shade100, + String shade200, + String shade300, + String shade400, + String shade500, + String shade600, + String shade700, + String shade800, + String shade900)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacMaterialColor() when $default != null: + return $default( + _that.primary, + _that.shade50, + _that.shade100, + _that.shade200, + _that.shade300, + _that.shade400, + _that.shade500, + _that.shade600, + _that.shade700, + _that.shade800, + _that.shade900); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + String primary, + String shade50, + String shade100, + String shade200, + String shade300, + String shade400, + String shade500, + String shade600, + String shade700, + String shade800, + String shade900) + $default, + ) { + final _that = this; + switch (_that) { + case _StacMaterialColor(): + return $default( + _that.primary, + _that.shade50, + _that.shade100, + _that.shade200, + _that.shade300, + _that.shade400, + _that.shade500, + _that.shade600, + _that.shade700, + _that.shade800, + _that.shade900); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + String primary, + String shade50, + String shade100, + String shade200, + String shade300, + String shade400, + String shade500, + String shade600, + String shade700, + String shade800, + String shade900)? + $default, + ) { + final _that = this; + switch (_that) { + case _StacMaterialColor() when $default != null: + return $default( + _that.primary, + _that.shade50, + _that.shade100, + _that.shade200, + _that.shade300, + _that.shade400, + _that.shade500, + _that.shade600, + _that.shade700, + _that.shade800, + _that.shade900); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacMaterialColor implements StacMaterialColor { diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart index bddc745b..fc3c5200 100644 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart @@ -4,8 +4,7 @@ import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_navigation_bar_theme_data.freezed.dart'; part 'stac_navigation_bar_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart index 1bf3b263..d17b6720 100644 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.dart @@ -3,10 +3,8 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_size/stac_size.dart'; import 'package:stac/src/utils/utils.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_navigation_drawer_theme_data.freezed.dart'; part 'stac_navigation_drawer_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart index fc616b56..0e51dd21 100644 --- a/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_navigation_drawer_theme_data/stac_navigation_drawer_theme_data.freezed.dart @@ -104,7 +104,6 @@ abstract mixin class $StacNavigationDrawerThemeDataCopyWith<$Res> { StacTextStyle? labelTextStyle, StacIconThemeData? iconTheme}); - $StacSizeCopyWith<$Res>? get indicatorSize; $StacIconThemeDataCopyWith<$Res>? get iconTheme; } @@ -176,20 +175,6 @@ class _$StacNavigationDrawerThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get indicatorSize { - if (_self.indicatorSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.indicatorSize!, (value) { - return _then(_self.copyWith(indicatorSize: value)); - }); - } - /// Create a copy of StacNavigationDrawerThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -549,8 +534,6 @@ abstract mixin class _$StacNavigationDrawerThemeDataCopyWith<$Res> StacTextStyle? labelTextStyle, StacIconThemeData? iconTheme}); - @override - $StacSizeCopyWith<$Res>? get indicatorSize; @override $StacIconThemeDataCopyWith<$Res>? get iconTheme; } @@ -623,20 +606,6 @@ class __$StacNavigationDrawerThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacNavigationDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get indicatorSize { - if (_self.indicatorSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.indicatorSize!, (value) { - return _then(_self.copyWith(indicatorSize: value)); - }); - } - /// Create a copy of StacNavigationDrawerThemeData /// with the given fields replaced by the non-null parameter values. @override diff --git a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart index 14d4fbe7..60c5fc3b 100644 --- a/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_theme_data.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -182,6 +181,232 @@ class _$StacScrollbarThemeDataCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacScrollbarThemeData]. +extension StacScrollbarThemeDataPatterns on StacScrollbarThemeData { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacScrollbarThemeData value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacScrollbarThemeData value) $default, + ) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacScrollbarThemeData value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function( + bool? thumbVisibility, + double? thickness, + bool? trackVisibility, + double? radius, + String? thumbColor, + String? trackColor, + String? trackBorderColor, + double? crossAxisMargin, + double? mainAxisMargin, + double? minThumbLength, + bool? interactive)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData() when $default != null: + return $default( + _that.thumbVisibility, + _that.thickness, + _that.trackVisibility, + _that.radius, + _that.thumbColor, + _that.trackColor, + _that.trackBorderColor, + _that.crossAxisMargin, + _that.mainAxisMargin, + _that.minThumbLength, + _that.interactive); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function( + bool? thumbVisibility, + double? thickness, + bool? trackVisibility, + double? radius, + String? thumbColor, + String? trackColor, + String? trackBorderColor, + double? crossAxisMargin, + double? mainAxisMargin, + double? minThumbLength, + bool? interactive) + $default, + ) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData(): + return $default( + _that.thumbVisibility, + _that.thickness, + _that.trackVisibility, + _that.radius, + _that.thumbColor, + _that.trackColor, + _that.trackBorderColor, + _that.crossAxisMargin, + _that.mainAxisMargin, + _that.minThumbLength, + _that.interactive); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function( + bool? thumbVisibility, + double? thickness, + bool? trackVisibility, + double? radius, + String? thumbColor, + String? trackColor, + String? trackBorderColor, + double? crossAxisMargin, + double? mainAxisMargin, + double? minThumbLength, + bool? interactive)? + $default, + ) { + final _that = this; + switch (_that) { + case _StacScrollbarThemeData() when $default != null: + return $default( + _that.thumbVisibility, + _that.thickness, + _that.trackVisibility, + _that.radius, + _that.thumbColor, + _that.trackColor, + _that.trackBorderColor, + _that.crossAxisMargin, + _that.mainAxisMargin, + _that.minThumbLength, + _that.interactive); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacScrollbarThemeData implements StacScrollbarThemeData { diff --git a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart index 626dffdd..86d26de6 100644 --- a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart @@ -4,9 +4,7 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_snack_bar_theme_data.freezed.dart'; part 'stac_snack_bar_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart index 3fdef714..424e3711 100644 --- a/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart +++ b/packages/stac/lib/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart @@ -4,9 +4,7 @@ import 'package:stac/src/parsers/painting/stac_box_decoration_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_box_decoration/stac_box_decoration.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_tab_bar_theme_data.freezed.dart'; part 'stac_tab_bar_theme_data.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart b/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart index 6e91e4dc..1bff7b71 100644 --- a/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_text_theme/stac_text_theme.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_text_theme.freezed.dart'; part 'stac_text_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart index 588e4e0f..10eb74d4 100644 --- a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart +++ b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.dart @@ -17,7 +17,6 @@ import 'package:stac/src/parsers/theme/stac_divider_theme_data/stac_divider_them import 'package:stac/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_floating_action_button_theme_data/stac_floating_action_button_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; import 'package:stac/src/parsers/theme/stac_list_tile_theme_data/stac_list_tile_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_material_banner_theme_data/stac_material_banner_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_material_color/stac_material_color.dart'; @@ -27,8 +26,9 @@ import 'package:stac/src/parsers/theme/stac_scrollbar_theme_data/stac_scrollbar_ import 'package:stac/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_text_theme/stac_text_theme.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_theme.freezed.dart'; part 'stac_theme.g.dart'; diff --git a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart index 121093ab..75abfe82 100644 --- a/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_theme/stac_theme.freezed.dart @@ -336,7 +336,6 @@ abstract mixin class $StacThemeCopyWith<$Res> { StacTabBarThemeData? tabBarTheme, StacButtonStyle? textButtonTheme}); - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme; $StacColorSchemeCopyWith<$Res>? get colorScheme; $StacMaterialColorCopyWith<$Res>? get primarySwatch; @@ -684,21 +683,6 @@ class _$StacThemeCopyWithImpl<$Res> implements $StacThemeCopyWith<$Res> { )); } - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { - if (_self.inputDecorationTheme == null) { - return null; - } - - return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, - (value) { - return _then(_self.copyWith(inputDecorationTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -2082,8 +2066,6 @@ abstract mixin class _$StacThemeCopyWith<$Res> StacTabBarThemeData? tabBarTheme, StacButtonStyle? textButtonTheme}); - @override - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; @override $StacScrollbarThemeDataCopyWith<$Res>? get scrollbarTheme; @override @@ -2458,21 +2440,6 @@ class __$StacThemeCopyWithImpl<$Res> implements _$StacThemeCopyWith<$Res> { )); } - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme { - if (_self.inputDecorationTheme == null) { - return null; - } - - return $StacInputDecorationThemeCopyWith<$Res>(_self.inputDecorationTheme!, - (value) { - return _then(_self.copyWith(inputDecorationTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override diff --git a/packages/stac/lib/src/parsers/theme/themes.dart b/packages/stac/lib/src/parsers/theme/themes.dart index 5e433e71..8c1f90cf 100644 --- a/packages/stac/lib/src/parsers/theme/themes.dart +++ b/packages/stac/lib/src/parsers/theme/themes.dart @@ -6,7 +6,6 @@ export 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parse export 'package:stac/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart'; export 'package:stac/src/parsers/theme/stac_dialog_theme/stac_dialog_theme.dart'; export 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -export 'package:stac/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; export 'package:stac/src/parsers/theme/stac_material_color/stac_material_color.dart'; export 'package:stac/src/parsers/theme/stac_navigation_bar_theme_data/stac_navigation_bar_theme_data.dart'; export 'package:stac/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.dart'; diff --git a/packages/stac/lib/src/parsers/types/type_parser.dart b/packages/stac/lib/src/parsers/types/type_parser.dart index be1ccd77..423880ae 100644 --- a/packages/stac/lib/src/parsers/types/type_parser.dart +++ b/packages/stac/lib/src/parsers/types/type_parser.dart @@ -13,31 +13,6 @@ import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parse import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/input_formatters.dart'; import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; -import 'package:stac_core/types/stac_blur_style.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; -import 'package:stac_core/types/stac_box_fit.dart'; -import 'package:stac_core/types/stac_box_shadow/stac_box_shadow.dart'; -import 'package:stac_core/types/stac_box_shape.dart'; -import 'package:stac_core/types/stac_circle_border/stac_circle_border.dart'; -import 'package:stac_core/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; -import 'package:stac_core/types/stac_cross_axis_alignment.dart'; -import 'package:stac_core/types/stac_filter_quality.dart'; -import 'package:stac_core/types/stac_flex_fit.dart'; -import 'package:stac_core/types/stac_gradient/stac_gradient.dart'; -import 'package:stac_core/types/stac_image_repeat.dart'; -import 'package:stac_core/types/stac_main_axis_alignment.dart'; -import 'package:stac_core/types/stac_main_axis_size.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; -import 'package:stac_core/types/stac_stack_fit.dart'; -import 'package:stac_core/types/stac_vertical_direction.dart'; -import 'package:stac_core/types/stac_wrap_alignment.dart'; -import 'package:stac_core/types/stac_wrap_cross_alignment.dart'; extension StacFloatingActionButtonLocationParser on StacFloatingActionButtonLocation { @@ -114,7 +89,7 @@ extension StacOverflowBarAlignmentParser on StacOverflowBarAlignment { extension StacInputDecorationParser on StacInputDecoration { InputDecoration parse(BuildContext context) { return InputDecoration( - icon: icon.parse(context), + icon: icon?.parse(context), labelText: labelText, labelStyle: labelStyle?.parse(context), hintText: hintText, @@ -123,7 +98,7 @@ extension StacInputDecorationParser on StacInputDecoration { helperStyle: helperStyle?.parse(context), errorText: errorText, errorStyle: errorStyle?.parse(context), - prefixIcon: prefixIcon.parse(context), + prefixIcon: prefixIcon?.parse(context), prefixText: prefixText, prefixStyle: prefixStyle?.parse(context), suffixIcon: suffixIcon.parse(context), diff --git a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart index bfc41e70..d49f2141 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog_parser.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac_core/widgets/alert_dialog/stac_alert_dialog.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacAlertDialogParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart index 71e4de92..0d0b8362 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_align/stac_align_parser.dart @@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/widgets/stac_align/stac_align.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; - -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacAlignParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.freezed.dart index 66309f81..fcc659cb 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -86,6 +85,163 @@ class _$StacAlignmentGeometryCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [StacAlignmentGeometry]. +extension StacAlignmentGeometryPatterns on StacAlignmentGeometry { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_StacAlignmentGeometry value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_StacAlignmentGeometry value) $default, + ) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_StacAlignmentGeometry value)? $default, + ) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(StacDouble dx, StacDouble dy)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry() when $default != null: + return $default(_that.dx, _that.dy); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(StacDouble dx, StacDouble dy) $default, + ) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry(): + return $default(_that.dx, _that.dy); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(StacDouble dx, StacDouble dy)? $default, + ) { + final _that = this; + switch (_that) { + case _StacAlignmentGeometry() when $default != null: + return $default(_that.dx, _that.dy); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _StacAlignmentGeometry implements StacAlignmentGeometry { diff --git a/packages/stac/lib/src/parsers/widgets/stac_app_bar/stac_app_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_app_bar/stac_app_bar_parser.dart index 9833d338..25411d2d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_app_bar/stac_app_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_app_bar/stac_app_bar_parser.dart @@ -4,7 +4,6 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_system_ui_overlay_style_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; import 'package:stac_core/stac_core.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_aspect_ratio/stac_aspect_ratio_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_aspect_ratio/stac_aspect_ratio_parser.dart index a792160d..2db6396f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_aspect_ratio/stac_aspect_ratio_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_aspect_ratio/stac_aspect_ratio_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/aspect_ratio/stac_aspect_ratio.dart'; class StacAspectRatioParser extends StacParser { const StacAspectRatioParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_auto_complete/stac_auto_complete_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_auto_complete/stac_auto_complete_parser.dart index f1b162a2..e0da1b08 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_auto_complete/stac_auto_complete_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_auto_complete/stac_auto_complete_parser.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/auto_complete/stac_auto_complete.dart'; -import 'package:stac_core/types/stac_options_view_open_direction.dart'; class StacAutoCompleteParser extends StacParser { const StacAutoCompleteParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_backdrop_filter/stac_backdrop_filter_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_backdrop_filter/stac_backdrop_filter_parser.dart index 5e5745ac..d0e2cd3c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_backdrop_filter/stac_backdrop_filter_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_backdrop_filter/stac_backdrop_filter_parser.dart @@ -1,9 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/types/stac_blend_mode.dart'; -import 'package:stac_core/widgets/backdrop_filter/stac_backdrop_filter.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacBackdropFilterParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart index 414b3683..849d68be 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_bar/stac_bottom_navigation_bar_parser.dart @@ -1,12 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/bottom_navigation_bar/stac_bottom_navigation_bar.dart'; class StacBottomNavigationBarParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_view/stac_bottom_navigation_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_view/stac_bottom_navigation_view_parser.dart index ef4f9966..9e0ef8bc 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_view/stac_bottom_navigation_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_bottom_navigation_view/stac_bottom_navigation_view_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/bottom_navigation_view/stac_bottom_navigation_view.dart'; import '../stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card_parser.dart index 1314295f..ff1d43ec 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card_parser.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/widgets/card/stac_card.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacCardParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart index 27102115..49e402ac 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_carousel_view/stac_carousel_view_parser.dart @@ -1,13 +1,11 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/carousel_view/stac_carousel_view.dart'; -import 'package:stac_core/types/stac_carousel_view_type.dart'; class StacCarouselViewParser extends StacParser { const StacCarouselViewParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_center/stac_center_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_center/stac_center_parser.dart index 622c755f..40f01a56 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_center/stac_center_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_center/stac_center_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/center/stac_center.dart'; class StacCenterParser extends StacParser { const StacCenterParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart index d74f446d..036f50fd 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_check_box/stac_check_box_parser.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:stac/src/framework/stac.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac/src/framework/stac.dart'; -import 'package:stac_core/widgets/check_box/stac_check_box.dart'; class StacCheckBoxParser extends StacParser { const StacCheckBoxParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_chip/stac_chip_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_chip/stac_chip_parser.dart index d65f47ed..8f45f1f5 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_chip/stac_chip_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_chip/stac_chip_parser.dart @@ -1,12 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/widgets/chip/stac_chip.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac/src/parsers/core/stac_action_parser.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacChipParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_circle_avatar/stac_circle_avatar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_circle_avatar/stac_circle_avatar_parser.dart index b57102df..74deba06 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_circle_avatar/stac_circle_avatar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_circle_avatar/stac_circle_avatar_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/widgets/circle_avatar/stac_circle_avatar.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacCircleAvatarParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_circular_progress_indicator/stac_circular_progress_indicator_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_circular_progress_indicator/stac_circular_progress_indicator_parser.dart index e2e551fe..62c68fde 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_circular_progress_indicator/stac_circular_progress_indicator_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_circular_progress_indicator/stac_circular_progress_indicator_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/widgets/circular_progress_indicator/stac_circular_progress_indicator.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacCircularProgressIndicatorParser diff --git a/packages/stac/lib/src/parsers/widgets/stac_clip_oval/stac_clip_oval_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_clip_oval/stac_clip_oval_parser.dart index 7c844c83..6bcac404 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_clip_oval/stac_clip_oval_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_clip_oval/stac_clip_oval_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/widgets/clip_oval/stac_clip_oval.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacClipOvalParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_clip_rrect/stac_clip_rrect_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_clip_rrect/stac_clip_rrect_parser.dart index a251dcfb..1bd90d2f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_clip_rrect/stac_clip_rrect_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_clip_rrect/stac_clip_rrect_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/widgets/clip_rrect/stac_clip_rrect.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacClipRRectParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_colored_box/stac_colored_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_colored_box/stac_colored_box_parser.dart index e3feb56b..7921635a 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_colored_box/stac_colored_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_colored_box/stac_colored_box_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/cupertino.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/colored_box/stac_colored_box.dart'; class StacColoredBoxParser extends StacParser { const StacColoredBoxParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_conditional/stac_conditional_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_conditional/stac_conditional_parser.dart index 2cc39f30..1fc4d410 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_conditional/stac_conditional_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_conditional/stac_conditional_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/utils/expression_resolver.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/conditional/stac_conditional.dart'; class StacConditionalParser extends StacParser { const StacConditionalParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_container/stac_container_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_container/stac_container_parser.dart index 1100842a..2e15dac8 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_container/stac_container_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_container/stac_container_parser.dart @@ -3,7 +3,6 @@ import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_box_decoration_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; import 'package:stac_core/stac_core.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart index 222e4742..c148b04c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view_parser.dart @@ -1,14 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/custom_scroll_view/stac_custom_scroll_view.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_view_keyboard_dismiss_behavior.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_hit_test_behavior.dart'; class StacCustomScrollViewParser extends StacParser { const StacCustomScrollViewParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart index ebc1d6bb..85d2e506 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller_parser.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_logger/stac_logger.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_default_tab_controller/stac_default_tab_controller_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_default_tab_controller/stac_default_tab_controller_parser.dart index bed55f62..89d23039 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_default_tab_controller/stac_default_tab_controller_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_default_tab_controller/stac_default_tab_controller_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/default_tab_controller/stac_default_tab_controller.dart'; class StacDefaultTabControllerParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_divider/stac_divider_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_divider/stac_divider_parser.dart index 5d4986f5..06470415 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_divider/stac_divider_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_divider/stac_divider_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/divider/stac_divider.dart'; class StacDividerParser extends StacParser { const StacDividerParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart index 5435ab50..dc841601 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/drawer/stac_drawer.dart'; class StacDrawerParser extends StacParser { const StacDrawerParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart index 4ab26300..a77ab6e1 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart @@ -1,14 +1,12 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/dropdown_menu/stac_dropdown_menu.dart'; -import 'package:stac_core/types/stac_input_formatter/stac_input_formatter.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/input_formatters.dart'; +import 'package:stac_core/stac_core.dart'; +import 'package:stac_framework/stac_framework.dart'; class StacDropdownMenuParser extends StacParser { const StacDropdownMenuParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.dart b/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.dart deleted file mode 100644 index 8a44b793..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'stac_duration.freezed.dart'; -part 'stac_duration.g.dart'; - -@freezed -abstract class StacDuration with _$StacDuration { - const factory StacDuration({ - @Default(0) int days, - @Default(0) int hours, - @Default(0) int minutes, - @Default(0) int seconds, - @Default(0) int milliseconds, - @Default(0) int microseconds, - }) = _StacDuration; - - factory StacDuration.fromJson(Map json) => - _$StacDurationFromJson(json); -} - -extension StacDurationParser on StacDuration { - Duration get parse { - return Duration( - days: days, - hours: hours, - minutes: minutes, - seconds: seconds, - milliseconds: milliseconds, - microseconds: microseconds, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.freezed.dart deleted file mode 100644 index 03cb970a..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.freezed.dart +++ /dev/null @@ -1,264 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_duration.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacDuration { - int get days; - int get hours; - int get minutes; - int get seconds; - int get milliseconds; - int get microseconds; - - /// Create a copy of StacDuration - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacDurationCopyWith get copyWith => - _$StacDurationCopyWithImpl( - this as StacDuration, _$identity); - - /// Serializes this StacDuration to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacDuration && - (identical(other.days, days) || other.days == days) && - (identical(other.hours, hours) || other.hours == hours) && - (identical(other.minutes, minutes) || other.minutes == minutes) && - (identical(other.seconds, seconds) || other.seconds == seconds) && - (identical(other.milliseconds, milliseconds) || - other.milliseconds == milliseconds) && - (identical(other.microseconds, microseconds) || - other.microseconds == microseconds)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, days, hours, minutes, seconds, milliseconds, microseconds); - - @override - String toString() { - return 'StacDuration(days: $days, hours: $hours, minutes: $minutes, seconds: $seconds, milliseconds: $milliseconds, microseconds: $microseconds)'; - } -} - -/// @nodoc -abstract mixin class $StacDurationCopyWith<$Res> { - factory $StacDurationCopyWith( - StacDuration value, $Res Function(StacDuration) _then) = - _$StacDurationCopyWithImpl; - @useResult - $Res call( - {int days, - int hours, - int minutes, - int seconds, - int milliseconds, - int microseconds}); -} - -/// @nodoc -class _$StacDurationCopyWithImpl<$Res> implements $StacDurationCopyWith<$Res> { - _$StacDurationCopyWithImpl(this._self, this._then); - - final StacDuration _self; - final $Res Function(StacDuration) _then; - - /// Create a copy of StacDuration - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? days = null, - Object? hours = null, - Object? minutes = null, - Object? seconds = null, - Object? milliseconds = null, - Object? microseconds = null, - }) { - return _then(_self.copyWith( - days: null == days - ? _self.days - : days // ignore: cast_nullable_to_non_nullable - as int, - hours: null == hours - ? _self.hours - : hours // ignore: cast_nullable_to_non_nullable - as int, - minutes: null == minutes - ? _self.minutes - : minutes // ignore: cast_nullable_to_non_nullable - as int, - seconds: null == seconds - ? _self.seconds - : seconds // ignore: cast_nullable_to_non_nullable - as int, - milliseconds: null == milliseconds - ? _self.milliseconds - : milliseconds // ignore: cast_nullable_to_non_nullable - as int, - microseconds: null == microseconds - ? _self.microseconds - : microseconds // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacDuration implements StacDuration { - const _StacDuration( - {this.days = 0, - this.hours = 0, - this.minutes = 0, - this.seconds = 0, - this.milliseconds = 0, - this.microseconds = 0}); - factory _StacDuration.fromJson(Map json) => - _$StacDurationFromJson(json); - - @override - @JsonKey() - final int days; - @override - @JsonKey() - final int hours; - @override - @JsonKey() - final int minutes; - @override - @JsonKey() - final int seconds; - @override - @JsonKey() - final int milliseconds; - @override - @JsonKey() - final int microseconds; - - /// Create a copy of StacDuration - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacDurationCopyWith<_StacDuration> get copyWith => - __$StacDurationCopyWithImpl<_StacDuration>(this, _$identity); - - @override - Map toJson() { - return _$StacDurationToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacDuration && - (identical(other.days, days) || other.days == days) && - (identical(other.hours, hours) || other.hours == hours) && - (identical(other.minutes, minutes) || other.minutes == minutes) && - (identical(other.seconds, seconds) || other.seconds == seconds) && - (identical(other.milliseconds, milliseconds) || - other.milliseconds == milliseconds) && - (identical(other.microseconds, microseconds) || - other.microseconds == microseconds)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, days, hours, minutes, seconds, milliseconds, microseconds); - - @override - String toString() { - return 'StacDuration(days: $days, hours: $hours, minutes: $minutes, seconds: $seconds, milliseconds: $milliseconds, microseconds: $microseconds)'; - } -} - -/// @nodoc -abstract mixin class _$StacDurationCopyWith<$Res> - implements $StacDurationCopyWith<$Res> { - factory _$StacDurationCopyWith( - _StacDuration value, $Res Function(_StacDuration) _then) = - __$StacDurationCopyWithImpl; - @override - @useResult - $Res call( - {int days, - int hours, - int minutes, - int seconds, - int milliseconds, - int microseconds}); -} - -/// @nodoc -class __$StacDurationCopyWithImpl<$Res> - implements _$StacDurationCopyWith<$Res> { - __$StacDurationCopyWithImpl(this._self, this._then); - - final _StacDuration _self; - final $Res Function(_StacDuration) _then; - - /// Create a copy of StacDuration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? days = null, - Object? hours = null, - Object? minutes = null, - Object? seconds = null, - Object? milliseconds = null, - Object? microseconds = null, - }) { - return _then(_StacDuration( - days: null == days - ? _self.days - : days // ignore: cast_nullable_to_non_nullable - as int, - hours: null == hours - ? _self.hours - : hours // ignore: cast_nullable_to_non_nullable - as int, - minutes: null == minutes - ? _self.minutes - : minutes // ignore: cast_nullable_to_non_nullable - as int, - seconds: null == seconds - ? _self.seconds - : seconds // ignore: cast_nullable_to_non_nullable - as int, - milliseconds: null == milliseconds - ? _self.milliseconds - : milliseconds // ignore: cast_nullable_to_non_nullable - as int, - microseconds: null == microseconds - ? _self.microseconds - : microseconds // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.g.dart b/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.g.dart deleted file mode 100644 index 3301274c..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_duration/stac_duration.g.dart +++ /dev/null @@ -1,27 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_duration.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacDuration _$StacDurationFromJson(Map json) => - _StacDuration( - days: (json['days'] as num?)?.toInt() ?? 0, - hours: (json['hours'] as num?)?.toInt() ?? 0, - minutes: (json['minutes'] as num?)?.toInt() ?? 0, - seconds: (json['seconds'] as num?)?.toInt() ?? 0, - milliseconds: (json['milliseconds'] as num?)?.toInt() ?? 0, - microseconds: (json['microseconds'] as num?)?.toInt() ?? 0, - ); - -Map _$StacDurationToJson(_StacDuration instance) => - { - 'days': instance.days, - 'hours': instance.hours, - 'minutes': instance.minutes, - 'seconds': instance.seconds, - 'milliseconds': instance.milliseconds, - 'microseconds': instance.microseconds, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart index 27c57a0a..eeed4c20 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/services/stac_network_service.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_logger/stac_logger.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart index 5acc2a7c..620ab10e 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart @@ -3,9 +3,8 @@ import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/elevated_button/stac_elevated_button.dart'; class StacElevatedButtonParser extends StacParser { const StacElevatedButtonParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_expanded/stac_expanded_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_expanded/stac_expanded_parser.dart index 5ac36def..418ad859 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_expanded/stac_expanded_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_expanded/stac_expanded_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/expanded/stac_expanded.dart'; class StacExpandedParser extends StacParser { const StacExpandedParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart index b1193988..3fe9d4f6 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart @@ -3,9 +3,8 @@ import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/filled_button/stac_filled_button.dart'; class StacFilledButtonParser extends StacParser { const StacFilledButtonParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_fitted_box/stac_fitted_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_fitted_box/stac_fitted_box_parser.dart index 00896ee9..1f6536f4 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_fitted_box/stac_fitted_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_fitted_box/stac_fitted_box_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/fitted_box/stac_fitted_box.dart'; class StacFittedBoxParser extends StacParser { const StacFittedBoxParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_flexible/stac_flexible_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_flexible/stac_flexible_parser.dart index 95de08a5..3a9345a7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_flexible/stac_flexible_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_flexible/stac_flexible_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/flexible/stac_flexible.dart'; class StacFlexibleParser extends StacParser { const StacFlexibleParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button_parser.dart index 634289c6..1cae5cd7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button_parser.dart @@ -3,10 +3,8 @@ import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/types/stac_floating_action_button_type.dart'; -import 'package:stac_core/widgets/floating_action_button/stac_floating_action_button.dart'; class StacFloatingActionButtonParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_parser.dart index ed2ed3cd..00dc65ff 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_form/stac_form_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:stac_core/widgets/form/stac_form.dart'; -import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacFormParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.dart b/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.dart deleted file mode 100644 index df00f4d9..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; - -part 'stac_form_validator.freezed.dart'; -part 'stac_form_validator.g.dart'; - -@freezed -abstract class StacFormFieldValidator with _$StacFormFieldValidator { - const factory StacFormFieldValidator({ - required String rule, - String? message, - }) = _StacFormFieldValidator; - - factory StacFormFieldValidator.fromJson(Map json) => - _$StacFormFieldValidatorFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.freezed.dart deleted file mode 100644 index 6824c37f..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.freezed.dart +++ /dev/null @@ -1,176 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_form_validator.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacFormFieldValidator { - String get rule; - String? get message; - - /// Create a copy of StacFormFieldValidator - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacFormFieldValidatorCopyWith get copyWith => - _$StacFormFieldValidatorCopyWithImpl( - this as StacFormFieldValidator, _$identity); - - /// Serializes this StacFormFieldValidator to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacFormFieldValidator && - (identical(other.rule, rule) || other.rule == rule) && - (identical(other.message, message) || other.message == message)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, rule, message); - - @override - String toString() { - return 'StacFormFieldValidator(rule: $rule, message: $message)'; - } -} - -/// @nodoc -abstract mixin class $StacFormFieldValidatorCopyWith<$Res> { - factory $StacFormFieldValidatorCopyWith(StacFormFieldValidator value, - $Res Function(StacFormFieldValidator) _then) = - _$StacFormFieldValidatorCopyWithImpl; - @useResult - $Res call({String rule, String? message}); -} - -/// @nodoc -class _$StacFormFieldValidatorCopyWithImpl<$Res> - implements $StacFormFieldValidatorCopyWith<$Res> { - _$StacFormFieldValidatorCopyWithImpl(this._self, this._then); - - final StacFormFieldValidator _self; - final $Res Function(StacFormFieldValidator) _then; - - /// Create a copy of StacFormFieldValidator - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? rule = null, - Object? message = freezed, - }) { - return _then(_self.copyWith( - rule: null == rule - ? _self.rule - : rule // ignore: cast_nullable_to_non_nullable - as String, - message: freezed == message - ? _self.message - : message // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacFormFieldValidator implements StacFormFieldValidator { - const _StacFormFieldValidator({required this.rule, this.message}); - factory _StacFormFieldValidator.fromJson(Map json) => - _$StacFormFieldValidatorFromJson(json); - - @override - final String rule; - @override - final String? message; - - /// Create a copy of StacFormFieldValidator - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacFormFieldValidatorCopyWith<_StacFormFieldValidator> get copyWith => - __$StacFormFieldValidatorCopyWithImpl<_StacFormFieldValidator>( - this, _$identity); - - @override - Map toJson() { - return _$StacFormFieldValidatorToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacFormFieldValidator && - (identical(other.rule, rule) || other.rule == rule) && - (identical(other.message, message) || other.message == message)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, rule, message); - - @override - String toString() { - return 'StacFormFieldValidator(rule: $rule, message: $message)'; - } -} - -/// @nodoc -abstract mixin class _$StacFormFieldValidatorCopyWith<$Res> - implements $StacFormFieldValidatorCopyWith<$Res> { - factory _$StacFormFieldValidatorCopyWith(_StacFormFieldValidator value, - $Res Function(_StacFormFieldValidator) _then) = - __$StacFormFieldValidatorCopyWithImpl; - @override - @useResult - $Res call({String rule, String? message}); -} - -/// @nodoc -class __$StacFormFieldValidatorCopyWithImpl<$Res> - implements _$StacFormFieldValidatorCopyWith<$Res> { - __$StacFormFieldValidatorCopyWithImpl(this._self, this._then); - - final _StacFormFieldValidator _self; - final $Res Function(_StacFormFieldValidator) _then; - - /// Create a copy of StacFormFieldValidator - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? rule = null, - Object? message = freezed, - }) { - return _then(_StacFormFieldValidator( - rule: null == rule - ? _self.rule - : rule // ignore: cast_nullable_to_non_nullable - as String, - message: freezed == message - ? _self.message - : message // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.g.dart b/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.g.dart deleted file mode 100644 index e6fd61d2..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_form_field_validator/stac_form_validator.g.dart +++ /dev/null @@ -1,21 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_form_validator.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacFormFieldValidator _$StacFormFieldValidatorFromJson( - Map json) => - _StacFormFieldValidator( - rule: json['rule'] as String, - message: json['message'] as String?, - ); - -Map _$StacFormFieldValidatorToJson( - _StacFormFieldValidator instance) => - { - 'rule': instance.rule, - 'message': instance.message, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_fractionally_sized_box/stac_fractionally_sized_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_fractionally_sized_box/stac_fractionally_sized_box_parser.dart index 75a8a58a..49a266f2 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_fractionally_sized_box/stac_fractionally_sized_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_fractionally_sized_box/stac_fractionally_sized_box_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/fractionally_sized_box/stac_fractionally_sized_box.dart'; class StacFractionallySizedBoxParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart index 21d5aa67..5286b572 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_core/widgets/gesture_detector/stac_gesture_detector.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart index 6f8e8493..b2b891f9 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.dart @@ -1,11 +1,10 @@ -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/grid_view/stac_grid_view.dart'; class StacGridViewParser extends StacParser { const StacGridViewParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart index 5c08f6d5..5531de3f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_hero/stac_hero_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/widgets.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/widgets/hero/stac_hero.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacHeroParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon/stac_icon_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_icon/stac_icon_parser.dart index 95c07a7e..cadfd90b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_icon/stac_icon_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_icon/stac_icon_parser.dart @@ -3,11 +3,9 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/icon_utils.dart'; import 'package:stac/src/utils/utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_logger/stac_logger.dart'; -import 'package:stac_core/types/stac_icon_type.dart'; -import 'package:stac_core/widgets/icon/stac_icon.dart'; class StacIconParser extends StacParser { const StacIconParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart index 318b4676..ab77fb64 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart @@ -5,9 +5,8 @@ import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/icon_button/stac_icon_button.dart'; class StacIconButtonParser extends StacParser { const StacIconButtonParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.dart deleted file mode 100644 index 5794adc4..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.dart +++ /dev/null @@ -1,27 +0,0 @@ -// import 'package:flutter/material.dart'; -// import 'package:freezed_annotation/freezed_annotation.dart'; -// import 'package:stac/src/parsers/widgets/stac_alignment/stac_alignment.dart'; -// import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; - -// export 'stac_image_parser.dart'; - -// part 'stac_image.freezed.dart'; -// part 'stac_image.g.dart'; - -// enum StacImageType { file, network, asset } - -// @freezed -// abstract class StacImage with _$StacImage { -// const factory StacImage({ -// required String src, -// @Default(StacAlignment.center) StacAlignment alignment, -// @Default(StacImageType.network) StacImageType imageType, -// String? color, -// StacDouble? width, -// StacDouble? height, -// BoxFit? fit, -// }) = _StacImage; - -// factory StacImage.fromJson(Map json) => -// _$StacImageFromJson(json); -// } diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_io.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_io.dart index 32fe254c..adbe7ebc 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_io.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_io.dart @@ -4,10 +4,8 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/types/stac_image_type.dart'; -import 'package:stac_core/widgets/image/stac_image.dart'; +import 'package:stac_core/stac_core.dart'; class StacImageParser extends StacParser { const StacImageParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_stub.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_stub.dart index 68642f7b..eeea57a0 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_stub.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_stub.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/widgets/image/stac_image.dart'; +import 'package:stac_core/stac_core.dart'; class StacImageParser extends StacParser { const StacImageParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_web.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_web.dart index aabdf4a1..2848e4fe 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_web.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image_parser_web.dart @@ -1,11 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_logger/stac_logger.dart'; -import 'package:stac_core/types/stac_image_type.dart'; -import 'package:stac_core/widgets/image/stac_image.dart'; class StacImageParser extends StacParser { const StacImageParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart index f268e44e..8bd897ff 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_inkwell/stac_inkwell_parser.dart @@ -2,9 +2,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/widgets/ink_well/stac_ink_well.dart'; +import 'package:stac_core/stac_core.dart'; class StacInkwellParser extends StacParser { const StacInkwellParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_border/stac_input_border.dart b/packages/stac/lib/src/parsers/widgets/stac_input_border/stac_input_border.dart index 8e95139c..346b557d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_input_border/stac_input_border.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_input_border/stac_input_border.dart @@ -4,8 +4,7 @@ import 'package:stac/src/framework/ui/stac_outline_input_border.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_gradient/stac_gradient.dart'; +import 'package:stac_core/stac_core.dart'; part 'stac_input_border.freezed.dart'; part 'stac_input_border.g.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.dart b/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.dart deleted file mode 100644 index ed0b8821..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.dart +++ /dev/null @@ -1,132 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_input_border/stac_input_border.dart'; -import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; - -import '../../../framework/framework.dart'; - -part 'stac_input_decoration.freezed.dart'; -part 'stac_input_decoration.g.dart'; - -@freezed -abstract class StacInputDecoration with _$StacInputDecoration { - const factory StacInputDecoration({ - Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - @Default(false) bool isCollapsed, - @Default(false) bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - @Default(true) bool enabled, - String? semanticCounterText, - @Default(false) bool alignLabelWithHint, - StacBoxConstraints? constraints, - }) = _StacInputDecoration; - - factory StacInputDecoration.fromJson(Map json) => - _$StacInputDecorationFromJson(json); -} - -extension StacInputDecorationParser on StacInputDecoration? { - InputDecoration parse(BuildContext context) { - return InputDecoration( - icon: Stac.fromJson(this?.icon, context), - iconColor: this?.iconColor.toColor(context), - label: Stac.fromJson(this?.label, context), - labelText: this?.labelText, - labelStyle: this?.labelStyle?.parse(context), - floatingLabelStyle: this?.floatingLabelStyle?.parse(context), - helperText: this?.helperText, - helperStyle: this?.helperStyle?.parse(context), - helperMaxLines: this?.helperMaxLines, - hintText: this?.hintText, - hintStyle: this?.hintStyle?.parse(context), - hintTextDirection: this?.hintTextDirection, - hintMaxLines: this?.hintMaxLines, - errorText: this?.errorText, - errorStyle: this?.errorStyle?.parse(context), - errorMaxLines: this?.errorMaxLines, - floatingLabelBehavior: this?.floatingLabelBehavior, - floatingLabelAlignment: this?.floatingLabelAlignment?.parse, - isCollapsed: this?.isCollapsed ?? false, - isDense: this?.isDense, - contentPadding: this?.contentPadding?.parse, - prefixIcon: Stac.fromJson(this?.prefixIcon, context), - prefixIconConstraints: this?.prefixIconConstraints?.parse, - prefix: Stac.fromJson(this?.prefix, context), - prefixText: this?.prefixText, - prefixStyle: this?.prefixStyle?.parse(context), - prefixIconColor: this?.prefixIconColor?.toColor(context), - suffixIcon: Stac.fromJson(this?.suffixIcon, context), - suffix: Stac.fromJson(this?.suffix, context), - suffixText: this?.suffixText, - suffixStyle: this?.suffixStyle?.parse(context), - suffixIconColor: this?.suffixIconColor?.toColor(context), - suffixIconConstraints: this?.suffixIconConstraints?.parse, - counter: Stac.fromJson(this?.counter, context), - counterText: this?.counterText, - counterStyle: this?.counterStyle?.parse(context), - filled: this?.filled, - fillColor: this?.fillColor.toColor(context), - focusColor: this?.focusColor.toColor(context), - hoverColor: this?.hoverColor.toColor(context), - errorBorder: this?.errorBorder?.parse(context), - focusedBorder: this?.focusedBorder?.parse(context), - focusedErrorBorder: this?.focusedErrorBorder?.parse(context), - disabledBorder: this?.disabledBorder?.parse(context), - enabledBorder: this?.enabledBorder?.parse(context), - border: this?.border?.parse(context), - enabled: this?.enabled ?? true, - semanticCounterText: this?.semanticCounterText, - alignLabelWithHint: this?.alignLabelWithHint, - constraints: this?.constraints?.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.freezed.dart deleted file mode 100644 index 00138ef3..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.freezed.dart +++ /dev/null @@ -1,1946 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_input_decoration.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacInputDecoration { - Map? get icon; - String? get iconColor; - Map? get label; - String? get labelText; - StacTextStyle? get labelStyle; - StacTextStyle? get floatingLabelStyle; - String? get helperText; - StacTextStyle? get helperStyle; - String? get hintText; - StacTextStyle? get hintStyle; - int? get helperMaxLines; - TextDirection? get hintTextDirection; - int? get hintMaxLines; - String? get errorText; - StacTextStyle? get errorStyle; - int? get errorMaxLines; - FloatingLabelBehavior? get floatingLabelBehavior; - StacFloatingLabelAlignment? get floatingLabelAlignment; - bool get isCollapsed; - bool get isDense; - StacEdgeInsets? get contentPadding; - Map? get prefixIcon; - StacBoxConstraints? get prefixIconConstraints; - Map? get prefix; - String? get prefixText; - StacTextStyle? get prefixStyle; - String? get prefixIconColor; - Map? get suffix; - Map? get suffixIcon; - StacBoxConstraints? get suffixIconConstraints; - String? get suffixText; - StacTextStyle? get suffixStyle; - String? get suffixIconColor; - Map? get counter; - String? get counterText; - StacTextStyle? get counterStyle; - bool? get filled; - String? get fillColor; - String? get hoverColor; - String? get focusColor; - StacInputBorder? get errorBorder; - StacInputBorder? get focusedBorder; - StacInputBorder? get focusedErrorBorder; - StacInputBorder? get disabledBorder; - StacInputBorder? get enabledBorder; - StacInputBorder? get border; - bool get enabled; - String? get semanticCounterText; - bool get alignLabelWithHint; - StacBoxConstraints? get constraints; - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacInputDecorationCopyWith get copyWith => - _$StacInputDecorationCopyWithImpl( - this as StacInputDecoration, _$identity); - - /// Serializes this StacInputDecoration to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacInputDecoration && - const DeepCollectionEquality().equals(other.icon, icon) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - const DeepCollectionEquality().equals(other.label, label) && - (identical(other.labelText, labelText) || - other.labelText == labelText) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.floatingLabelStyle, floatingLabelStyle) || - other.floatingLabelStyle == floatingLabelStyle) && - (identical(other.helperText, helperText) || - other.helperText == helperText) && - (identical(other.helperStyle, helperStyle) || - other.helperStyle == helperStyle) && - (identical(other.hintText, hintText) || - other.hintText == hintText) && - (identical(other.hintStyle, hintStyle) || - other.hintStyle == hintStyle) && - (identical(other.helperMaxLines, helperMaxLines) || - other.helperMaxLines == helperMaxLines) && - (identical(other.hintTextDirection, hintTextDirection) || - other.hintTextDirection == hintTextDirection) && - (identical(other.hintMaxLines, hintMaxLines) || - other.hintMaxLines == hintMaxLines) && - (identical(other.errorText, errorText) || - other.errorText == errorText) && - (identical(other.errorStyle, errorStyle) || - other.errorStyle == errorStyle) && - (identical(other.errorMaxLines, errorMaxLines) || - other.errorMaxLines == errorMaxLines) && - (identical(other.floatingLabelBehavior, floatingLabelBehavior) || - other.floatingLabelBehavior == floatingLabelBehavior) && - (identical(other.floatingLabelAlignment, floatingLabelAlignment) || - other.floatingLabelAlignment == floatingLabelAlignment) && - (identical(other.isCollapsed, isCollapsed) || - other.isCollapsed == isCollapsed) && - (identical(other.isDense, isDense) || other.isDense == isDense) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - const DeepCollectionEquality() - .equals(other.prefixIcon, prefixIcon) && - (identical(other.prefixIconConstraints, prefixIconConstraints) || - other.prefixIconConstraints == prefixIconConstraints) && - const DeepCollectionEquality().equals(other.prefix, prefix) && - (identical(other.prefixText, prefixText) || - other.prefixText == prefixText) && - (identical(other.prefixStyle, prefixStyle) || - other.prefixStyle == prefixStyle) && - (identical(other.prefixIconColor, prefixIconColor) || - other.prefixIconColor == prefixIconColor) && - const DeepCollectionEquality().equals(other.suffix, suffix) && - const DeepCollectionEquality() - .equals(other.suffixIcon, suffixIcon) && - (identical(other.suffixIconConstraints, suffixIconConstraints) || - other.suffixIconConstraints == suffixIconConstraints) && - (identical(other.suffixText, suffixText) || - other.suffixText == suffixText) && - (identical(other.suffixStyle, suffixStyle) || - other.suffixStyle == suffixStyle) && - (identical(other.suffixIconColor, suffixIconColor) || - other.suffixIconColor == suffixIconColor) && - const DeepCollectionEquality().equals(other.counter, counter) && - (identical(other.counterText, counterText) || - other.counterText == counterText) && - (identical(other.counterStyle, counterStyle) || - other.counterStyle == counterStyle) && - (identical(other.filled, filled) || other.filled == filled) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.errorBorder, errorBorder) || - other.errorBorder == errorBorder) && - (identical(other.focusedBorder, focusedBorder) || - other.focusedBorder == focusedBorder) && - (identical(other.focusedErrorBorder, focusedErrorBorder) || - other.focusedErrorBorder == focusedErrorBorder) && - (identical(other.disabledBorder, disabledBorder) || - other.disabledBorder == disabledBorder) && - (identical(other.enabledBorder, enabledBorder) || - other.enabledBorder == enabledBorder) && - (identical(other.border, border) || other.border == border) && - (identical(other.enabled, enabled) || other.enabled == enabled) && - (identical(other.semanticCounterText, semanticCounterText) || - other.semanticCounterText == semanticCounterText) && - (identical(other.alignLabelWithHint, alignLabelWithHint) || - other.alignLabelWithHint == alignLabelWithHint) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - const DeepCollectionEquality().hash(icon), - iconColor, - const DeepCollectionEquality().hash(label), - labelText, - labelStyle, - floatingLabelStyle, - helperText, - helperStyle, - hintText, - hintStyle, - helperMaxLines, - hintTextDirection, - hintMaxLines, - errorText, - errorStyle, - errorMaxLines, - floatingLabelBehavior, - floatingLabelAlignment, - isCollapsed, - isDense, - contentPadding, - const DeepCollectionEquality().hash(prefixIcon), - prefixIconConstraints, - const DeepCollectionEquality().hash(prefix), - prefixText, - prefixStyle, - prefixIconColor, - const DeepCollectionEquality().hash(suffix), - const DeepCollectionEquality().hash(suffixIcon), - suffixIconConstraints, - suffixText, - suffixStyle, - suffixIconColor, - const DeepCollectionEquality().hash(counter), - counterText, - counterStyle, - filled, - fillColor, - hoverColor, - focusColor, - errorBorder, - focusedBorder, - focusedErrorBorder, - disabledBorder, - enabledBorder, - border, - enabled, - semanticCounterText, - alignLabelWithHint, - constraints - ]); - - @override - String toString() { - return 'StacInputDecoration(icon: $icon, iconColor: $iconColor, label: $label, labelText: $labelText, labelStyle: $labelStyle, floatingLabelStyle: $floatingLabelStyle, helperText: $helperText, helperStyle: $helperStyle, hintText: $hintText, hintStyle: $hintStyle, helperMaxLines: $helperMaxLines, hintTextDirection: $hintTextDirection, hintMaxLines: $hintMaxLines, errorText: $errorText, errorStyle: $errorStyle, errorMaxLines: $errorMaxLines, floatingLabelBehavior: $floatingLabelBehavior, floatingLabelAlignment: $floatingLabelAlignment, isCollapsed: $isCollapsed, isDense: $isDense, contentPadding: $contentPadding, prefixIcon: $prefixIcon, prefixIconConstraints: $prefixIconConstraints, prefix: $prefix, prefixText: $prefixText, prefixStyle: $prefixStyle, prefixIconColor: $prefixIconColor, suffix: $suffix, suffixIcon: $suffixIcon, suffixIconConstraints: $suffixIconConstraints, suffixText: $suffixText, suffixStyle: $suffixStyle, suffixIconColor: $suffixIconColor, counter: $counter, counterText: $counterText, counterStyle: $counterStyle, filled: $filled, fillColor: $fillColor, hoverColor: $hoverColor, focusColor: $focusColor, errorBorder: $errorBorder, focusedBorder: $focusedBorder, focusedErrorBorder: $focusedErrorBorder, disabledBorder: $disabledBorder, enabledBorder: $enabledBorder, border: $border, enabled: $enabled, semanticCounterText: $semanticCounterText, alignLabelWithHint: $alignLabelWithHint, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class $StacInputDecorationCopyWith<$Res> { - factory $StacInputDecorationCopyWith( - StacInputDecoration value, $Res Function(StacInputDecoration) _then) = - _$StacInputDecorationCopyWithImpl; - @useResult - $Res call( - {Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isCollapsed, - bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool enabled, - String? semanticCounterText, - bool alignLabelWithHint, - StacBoxConstraints? constraints}); - - $StacInputBorderCopyWith<$Res>? get errorBorder; - $StacInputBorderCopyWith<$Res>? get focusedBorder; - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder; - $StacInputBorderCopyWith<$Res>? get disabledBorder; - $StacInputBorderCopyWith<$Res>? get enabledBorder; - $StacInputBorderCopyWith<$Res>? get border; -} - -/// @nodoc -class _$StacInputDecorationCopyWithImpl<$Res> - implements $StacInputDecorationCopyWith<$Res> { - _$StacInputDecorationCopyWithImpl(this._self, this._then); - - final StacInputDecoration _self; - final $Res Function(StacInputDecoration) _then; - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? icon = freezed, - Object? iconColor = freezed, - Object? label = freezed, - Object? labelText = freezed, - Object? labelStyle = freezed, - Object? floatingLabelStyle = freezed, - Object? helperText = freezed, - Object? helperStyle = freezed, - Object? hintText = freezed, - Object? hintStyle = freezed, - Object? helperMaxLines = freezed, - Object? hintTextDirection = freezed, - Object? hintMaxLines = freezed, - Object? errorText = freezed, - Object? errorStyle = freezed, - Object? errorMaxLines = freezed, - Object? floatingLabelBehavior = freezed, - Object? floatingLabelAlignment = freezed, - Object? isCollapsed = null, - Object? isDense = null, - Object? contentPadding = freezed, - Object? prefixIcon = freezed, - Object? prefixIconConstraints = freezed, - Object? prefix = freezed, - Object? prefixText = freezed, - Object? prefixStyle = freezed, - Object? prefixIconColor = freezed, - Object? suffix = freezed, - Object? suffixIcon = freezed, - Object? suffixIconConstraints = freezed, - Object? suffixText = freezed, - Object? suffixStyle = freezed, - Object? suffixIconColor = freezed, - Object? counter = freezed, - Object? counterText = freezed, - Object? counterStyle = freezed, - Object? filled = freezed, - Object? fillColor = freezed, - Object? hoverColor = freezed, - Object? focusColor = freezed, - Object? errorBorder = freezed, - Object? focusedBorder = freezed, - Object? focusedErrorBorder = freezed, - Object? disabledBorder = freezed, - Object? enabledBorder = freezed, - Object? border = freezed, - Object? enabled = null, - Object? semanticCounterText = freezed, - Object? alignLabelWithHint = null, - Object? constraints = freezed, - }) { - return _then(_self.copyWith( - icon: freezed == icon - ? _self.icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - label: freezed == label - ? _self.label - : label // ignore: cast_nullable_to_non_nullable - as Map?, - labelText: freezed == labelText - ? _self.labelText - : labelText // ignore: cast_nullable_to_non_nullable - as String?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - floatingLabelStyle: freezed == floatingLabelStyle - ? _self.floatingLabelStyle - : floatingLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperText: freezed == helperText - ? _self.helperText - : helperText // ignore: cast_nullable_to_non_nullable - as String?, - helperStyle: freezed == helperStyle - ? _self.helperStyle - : helperStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - hintText: freezed == hintText - ? _self.hintText - : hintText // ignore: cast_nullable_to_non_nullable - as String?, - hintStyle: freezed == hintStyle - ? _self.hintStyle - : hintStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperMaxLines: freezed == helperMaxLines - ? _self.helperMaxLines - : helperMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - hintTextDirection: freezed == hintTextDirection - ? _self.hintTextDirection - : hintTextDirection // ignore: cast_nullable_to_non_nullable - as TextDirection?, - hintMaxLines: freezed == hintMaxLines - ? _self.hintMaxLines - : hintMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - errorText: freezed == errorText - ? _self.errorText - : errorText // ignore: cast_nullable_to_non_nullable - as String?, - errorStyle: freezed == errorStyle - ? _self.errorStyle - : errorStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorMaxLines: freezed == errorMaxLines - ? _self.errorMaxLines - : errorMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - floatingLabelBehavior: freezed == floatingLabelBehavior - ? _self.floatingLabelBehavior - : floatingLabelBehavior // ignore: cast_nullable_to_non_nullable - as FloatingLabelBehavior?, - floatingLabelAlignment: freezed == floatingLabelAlignment - ? _self.floatingLabelAlignment - : floatingLabelAlignment // ignore: cast_nullable_to_non_nullable - as StacFloatingLabelAlignment?, - isCollapsed: null == isCollapsed - ? _self.isCollapsed - : isCollapsed // ignore: cast_nullable_to_non_nullable - as bool, - isDense: null == isDense - ? _self.isDense - : isDense // ignore: cast_nullable_to_non_nullable - as bool, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - prefixIcon: freezed == prefixIcon - ? _self.prefixIcon - : prefixIcon // ignore: cast_nullable_to_non_nullable - as Map?, - prefixIconConstraints: freezed == prefixIconConstraints - ? _self.prefixIconConstraints - : prefixIconConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - prefix: freezed == prefix - ? _self.prefix - : prefix // ignore: cast_nullable_to_non_nullable - as Map?, - prefixText: freezed == prefixText - ? _self.prefixText - : prefixText // ignore: cast_nullable_to_non_nullable - as String?, - prefixStyle: freezed == prefixStyle - ? _self.prefixStyle - : prefixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - prefixIconColor: freezed == prefixIconColor - ? _self.prefixIconColor - : prefixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - suffix: freezed == suffix - ? _self.suffix - : suffix // ignore: cast_nullable_to_non_nullable - as Map?, - suffixIcon: freezed == suffixIcon - ? _self.suffixIcon - : suffixIcon // ignore: cast_nullable_to_non_nullable - as Map?, - suffixIconConstraints: freezed == suffixIconConstraints - ? _self.suffixIconConstraints - : suffixIconConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - suffixText: freezed == suffixText - ? _self.suffixText - : suffixText // ignore: cast_nullable_to_non_nullable - as String?, - suffixStyle: freezed == suffixStyle - ? _self.suffixStyle - : suffixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - suffixIconColor: freezed == suffixIconColor - ? _self.suffixIconColor - : suffixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - counter: freezed == counter - ? _self.counter - : counter // ignore: cast_nullable_to_non_nullable - as Map?, - counterText: freezed == counterText - ? _self.counterText - : counterText // ignore: cast_nullable_to_non_nullable - as String?, - counterStyle: freezed == counterStyle - ? _self.counterStyle - : counterStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - filled: freezed == filled - ? _self.filled - : filled // ignore: cast_nullable_to_non_nullable - as bool?, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - errorBorder: freezed == errorBorder - ? _self.errorBorder - : errorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedBorder: freezed == focusedBorder - ? _self.focusedBorder - : focusedBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedErrorBorder: freezed == focusedErrorBorder - ? _self.focusedErrorBorder - : focusedErrorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - disabledBorder: freezed == disabledBorder - ? _self.disabledBorder - : disabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabledBorder: freezed == enabledBorder - ? _self.enabledBorder - : enabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - border: freezed == border - ? _self.border - : border // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabled: null == enabled - ? _self.enabled - : enabled // ignore: cast_nullable_to_non_nullable - as bool, - semanticCounterText: freezed == semanticCounterText - ? _self.semanticCounterText - : semanticCounterText // ignore: cast_nullable_to_non_nullable - as String?, - alignLabelWithHint: null == alignLabelWithHint - ? _self.alignLabelWithHint - : alignLabelWithHint // ignore: cast_nullable_to_non_nullable - as bool, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get errorBorder { - if (_self.errorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.errorBorder!, (value) { - return _then(_self.copyWith(errorBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedBorder { - if (_self.focusedBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedBorder!, (value) { - return _then(_self.copyWith(focusedBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder { - if (_self.focusedErrorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedErrorBorder!, (value) { - return _then(_self.copyWith(focusedErrorBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get disabledBorder { - if (_self.disabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.disabledBorder!, (value) { - return _then(_self.copyWith(disabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get enabledBorder { - if (_self.enabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.enabledBorder!, (value) { - return _then(_self.copyWith(enabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get border { - if (_self.border == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.border!, (value) { - return _then(_self.copyWith(border: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [StacInputDecoration]. -extension StacInputDecorationPatterns on StacInputDecoration { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_StacInputDecoration value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacInputDecoration() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_StacInputDecoration value) $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecoration(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_StacInputDecoration value)? $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecoration() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function( - Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isCollapsed, - bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool enabled, - String? semanticCounterText, - bool alignLabelWithHint, - StacBoxConstraints? constraints)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _StacInputDecoration() when $default != null: - return $default( - _that.icon, - _that.iconColor, - _that.label, - _that.labelText, - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperText, - _that.helperStyle, - _that.hintText, - _that.hintStyle, - _that.helperMaxLines, - _that.hintTextDirection, - _that.hintMaxLines, - _that.errorText, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isCollapsed, - _that.isDense, - _that.contentPadding, - _that.prefixIcon, - _that.prefixIconConstraints, - _that.prefix, - _that.prefixText, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffix, - _that.suffixIcon, - _that.suffixIconConstraints, - _that.suffixText, - _that.suffixStyle, - _that.suffixIconColor, - _that.counter, - _that.counterText, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.hoverColor, - _that.focusColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.enabled, - _that.semanticCounterText, - _that.alignLabelWithHint, - _that.constraints); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function( - Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isCollapsed, - bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool enabled, - String? semanticCounterText, - bool alignLabelWithHint, - StacBoxConstraints? constraints) - $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecoration(): - return $default( - _that.icon, - _that.iconColor, - _that.label, - _that.labelText, - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperText, - _that.helperStyle, - _that.hintText, - _that.hintStyle, - _that.helperMaxLines, - _that.hintTextDirection, - _that.hintMaxLines, - _that.errorText, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isCollapsed, - _that.isDense, - _that.contentPadding, - _that.prefixIcon, - _that.prefixIconConstraints, - _that.prefix, - _that.prefixText, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffix, - _that.suffixIcon, - _that.suffixIconConstraints, - _that.suffixText, - _that.suffixStyle, - _that.suffixIconColor, - _that.counter, - _that.counterText, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.hoverColor, - _that.focusColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.enabled, - _that.semanticCounterText, - _that.alignLabelWithHint, - _that.constraints); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function( - Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isCollapsed, - bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool enabled, - String? semanticCounterText, - bool alignLabelWithHint, - StacBoxConstraints? constraints)? - $default, - ) { - final _that = this; - switch (_that) { - case _StacInputDecoration() when $default != null: - return $default( - _that.icon, - _that.iconColor, - _that.label, - _that.labelText, - _that.labelStyle, - _that.floatingLabelStyle, - _that.helperText, - _that.helperStyle, - _that.hintText, - _that.hintStyle, - _that.helperMaxLines, - _that.hintTextDirection, - _that.hintMaxLines, - _that.errorText, - _that.errorStyle, - _that.errorMaxLines, - _that.floatingLabelBehavior, - _that.floatingLabelAlignment, - _that.isCollapsed, - _that.isDense, - _that.contentPadding, - _that.prefixIcon, - _that.prefixIconConstraints, - _that.prefix, - _that.prefixText, - _that.prefixStyle, - _that.prefixIconColor, - _that.suffix, - _that.suffixIcon, - _that.suffixIconConstraints, - _that.suffixText, - _that.suffixStyle, - _that.suffixIconColor, - _that.counter, - _that.counterText, - _that.counterStyle, - _that.filled, - _that.fillColor, - _that.hoverColor, - _that.focusColor, - _that.errorBorder, - _that.focusedBorder, - _that.focusedErrorBorder, - _that.disabledBorder, - _that.enabledBorder, - _that.border, - _that.enabled, - _that.semanticCounterText, - _that.alignLabelWithHint, - _that.constraints); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _StacInputDecoration implements StacInputDecoration { - const _StacInputDecoration( - {final Map? icon, - this.iconColor, - final Map? label, - this.labelText, - this.labelStyle, - this.floatingLabelStyle, - this.helperText, - this.helperStyle, - this.hintText, - this.hintStyle, - this.helperMaxLines, - this.hintTextDirection, - this.hintMaxLines, - this.errorText, - this.errorStyle, - this.errorMaxLines, - this.floatingLabelBehavior, - this.floatingLabelAlignment, - this.isCollapsed = false, - this.isDense = false, - this.contentPadding, - final Map? prefixIcon, - this.prefixIconConstraints, - final Map? prefix, - this.prefixText, - this.prefixStyle, - this.prefixIconColor, - final Map? suffix, - final Map? suffixIcon, - this.suffixIconConstraints, - this.suffixText, - this.suffixStyle, - this.suffixIconColor, - final Map? counter, - this.counterText, - this.counterStyle, - this.filled, - this.fillColor, - this.hoverColor, - this.focusColor, - this.errorBorder, - this.focusedBorder, - this.focusedErrorBorder, - this.disabledBorder, - this.enabledBorder, - this.border, - this.enabled = true, - this.semanticCounterText, - this.alignLabelWithHint = false, - this.constraints}) - : _icon = icon, - _label = label, - _prefixIcon = prefixIcon, - _prefix = prefix, - _suffix = suffix, - _suffixIcon = suffixIcon, - _counter = counter; - factory _StacInputDecoration.fromJson(Map json) => - _$StacInputDecorationFromJson(json); - - final Map? _icon; - @override - Map? get icon { - final value = _icon; - if (value == null) return null; - if (_icon is EqualUnmodifiableMapView) return _icon; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final String? iconColor; - final Map? _label; - @override - Map? get label { - final value = _label; - if (value == null) return null; - if (_label is EqualUnmodifiableMapView) return _label; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final String? labelText; - @override - final StacTextStyle? labelStyle; - @override - final StacTextStyle? floatingLabelStyle; - @override - final String? helperText; - @override - final StacTextStyle? helperStyle; - @override - final String? hintText; - @override - final StacTextStyle? hintStyle; - @override - final int? helperMaxLines; - @override - final TextDirection? hintTextDirection; - @override - final int? hintMaxLines; - @override - final String? errorText; - @override - final StacTextStyle? errorStyle; - @override - final int? errorMaxLines; - @override - final FloatingLabelBehavior? floatingLabelBehavior; - @override - final StacFloatingLabelAlignment? floatingLabelAlignment; - @override - @JsonKey() - final bool isCollapsed; - @override - @JsonKey() - final bool isDense; - @override - final StacEdgeInsets? contentPadding; - final Map? _prefixIcon; - @override - Map? get prefixIcon { - final value = _prefixIcon; - if (value == null) return null; - if (_prefixIcon is EqualUnmodifiableMapView) return _prefixIcon; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacBoxConstraints? prefixIconConstraints; - final Map? _prefix; - @override - Map? get prefix { - final value = _prefix; - if (value == null) return null; - if (_prefix is EqualUnmodifiableMapView) return _prefix; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final String? prefixText; - @override - final StacTextStyle? prefixStyle; - @override - final String? prefixIconColor; - final Map? _suffix; - @override - Map? get suffix { - final value = _suffix; - if (value == null) return null; - if (_suffix is EqualUnmodifiableMapView) return _suffix; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _suffixIcon; - @override - Map? get suffixIcon { - final value = _suffixIcon; - if (value == null) return null; - if (_suffixIcon is EqualUnmodifiableMapView) return _suffixIcon; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacBoxConstraints? suffixIconConstraints; - @override - final String? suffixText; - @override - final StacTextStyle? suffixStyle; - @override - final String? suffixIconColor; - final Map? _counter; - @override - Map? get counter { - final value = _counter; - if (value == null) return null; - if (_counter is EqualUnmodifiableMapView) return _counter; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final String? counterText; - @override - final StacTextStyle? counterStyle; - @override - final bool? filled; - @override - final String? fillColor; - @override - final String? hoverColor; - @override - final String? focusColor; - @override - final StacInputBorder? errorBorder; - @override - final StacInputBorder? focusedBorder; - @override - final StacInputBorder? focusedErrorBorder; - @override - final StacInputBorder? disabledBorder; - @override - final StacInputBorder? enabledBorder; - @override - final StacInputBorder? border; - @override - @JsonKey() - final bool enabled; - @override - final String? semanticCounterText; - @override - @JsonKey() - final bool alignLabelWithHint; - @override - final StacBoxConstraints? constraints; - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacInputDecorationCopyWith<_StacInputDecoration> get copyWith => - __$StacInputDecorationCopyWithImpl<_StacInputDecoration>( - this, _$identity); - - @override - Map toJson() { - return _$StacInputDecorationToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacInputDecoration && - const DeepCollectionEquality().equals(other._icon, _icon) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - const DeepCollectionEquality().equals(other._label, _label) && - (identical(other.labelText, labelText) || - other.labelText == labelText) && - (identical(other.labelStyle, labelStyle) || - other.labelStyle == labelStyle) && - (identical(other.floatingLabelStyle, floatingLabelStyle) || - other.floatingLabelStyle == floatingLabelStyle) && - (identical(other.helperText, helperText) || - other.helperText == helperText) && - (identical(other.helperStyle, helperStyle) || - other.helperStyle == helperStyle) && - (identical(other.hintText, hintText) || - other.hintText == hintText) && - (identical(other.hintStyle, hintStyle) || - other.hintStyle == hintStyle) && - (identical(other.helperMaxLines, helperMaxLines) || - other.helperMaxLines == helperMaxLines) && - (identical(other.hintTextDirection, hintTextDirection) || - other.hintTextDirection == hintTextDirection) && - (identical(other.hintMaxLines, hintMaxLines) || - other.hintMaxLines == hintMaxLines) && - (identical(other.errorText, errorText) || - other.errorText == errorText) && - (identical(other.errorStyle, errorStyle) || - other.errorStyle == errorStyle) && - (identical(other.errorMaxLines, errorMaxLines) || - other.errorMaxLines == errorMaxLines) && - (identical(other.floatingLabelBehavior, floatingLabelBehavior) || - other.floatingLabelBehavior == floatingLabelBehavior) && - (identical(other.floatingLabelAlignment, floatingLabelAlignment) || - other.floatingLabelAlignment == floatingLabelAlignment) && - (identical(other.isCollapsed, isCollapsed) || - other.isCollapsed == isCollapsed) && - (identical(other.isDense, isDense) || other.isDense == isDense) && - (identical(other.contentPadding, contentPadding) || - other.contentPadding == contentPadding) && - const DeepCollectionEquality() - .equals(other._prefixIcon, _prefixIcon) && - (identical(other.prefixIconConstraints, prefixIconConstraints) || - other.prefixIconConstraints == prefixIconConstraints) && - const DeepCollectionEquality().equals(other._prefix, _prefix) && - (identical(other.prefixText, prefixText) || - other.prefixText == prefixText) && - (identical(other.prefixStyle, prefixStyle) || - other.prefixStyle == prefixStyle) && - (identical(other.prefixIconColor, prefixIconColor) || - other.prefixIconColor == prefixIconColor) && - const DeepCollectionEquality().equals(other._suffix, _suffix) && - const DeepCollectionEquality() - .equals(other._suffixIcon, _suffixIcon) && - (identical(other.suffixIconConstraints, suffixIconConstraints) || - other.suffixIconConstraints == suffixIconConstraints) && - (identical(other.suffixText, suffixText) || - other.suffixText == suffixText) && - (identical(other.suffixStyle, suffixStyle) || - other.suffixStyle == suffixStyle) && - (identical(other.suffixIconColor, suffixIconColor) || - other.suffixIconColor == suffixIconColor) && - const DeepCollectionEquality().equals(other._counter, _counter) && - (identical(other.counterText, counterText) || - other.counterText == counterText) && - (identical(other.counterStyle, counterStyle) || - other.counterStyle == counterStyle) && - (identical(other.filled, filled) || other.filled == filled) && - (identical(other.fillColor, fillColor) || - other.fillColor == fillColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.errorBorder, errorBorder) || - other.errorBorder == errorBorder) && - (identical(other.focusedBorder, focusedBorder) || - other.focusedBorder == focusedBorder) && - (identical(other.focusedErrorBorder, focusedErrorBorder) || - other.focusedErrorBorder == focusedErrorBorder) && - (identical(other.disabledBorder, disabledBorder) || - other.disabledBorder == disabledBorder) && - (identical(other.enabledBorder, enabledBorder) || - other.enabledBorder == enabledBorder) && - (identical(other.border, border) || other.border == border) && - (identical(other.enabled, enabled) || other.enabled == enabled) && - (identical(other.semanticCounterText, semanticCounterText) || - other.semanticCounterText == semanticCounterText) && - (identical(other.alignLabelWithHint, alignLabelWithHint) || - other.alignLabelWithHint == alignLabelWithHint) && - (identical(other.constraints, constraints) || - other.constraints == constraints)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - const DeepCollectionEquality().hash(_icon), - iconColor, - const DeepCollectionEquality().hash(_label), - labelText, - labelStyle, - floatingLabelStyle, - helperText, - helperStyle, - hintText, - hintStyle, - helperMaxLines, - hintTextDirection, - hintMaxLines, - errorText, - errorStyle, - errorMaxLines, - floatingLabelBehavior, - floatingLabelAlignment, - isCollapsed, - isDense, - contentPadding, - const DeepCollectionEquality().hash(_prefixIcon), - prefixIconConstraints, - const DeepCollectionEquality().hash(_prefix), - prefixText, - prefixStyle, - prefixIconColor, - const DeepCollectionEquality().hash(_suffix), - const DeepCollectionEquality().hash(_suffixIcon), - suffixIconConstraints, - suffixText, - suffixStyle, - suffixIconColor, - const DeepCollectionEquality().hash(_counter), - counterText, - counterStyle, - filled, - fillColor, - hoverColor, - focusColor, - errorBorder, - focusedBorder, - focusedErrorBorder, - disabledBorder, - enabledBorder, - border, - enabled, - semanticCounterText, - alignLabelWithHint, - constraints - ]); - - @override - String toString() { - return 'StacInputDecoration(icon: $icon, iconColor: $iconColor, label: $label, labelText: $labelText, labelStyle: $labelStyle, floatingLabelStyle: $floatingLabelStyle, helperText: $helperText, helperStyle: $helperStyle, hintText: $hintText, hintStyle: $hintStyle, helperMaxLines: $helperMaxLines, hintTextDirection: $hintTextDirection, hintMaxLines: $hintMaxLines, errorText: $errorText, errorStyle: $errorStyle, errorMaxLines: $errorMaxLines, floatingLabelBehavior: $floatingLabelBehavior, floatingLabelAlignment: $floatingLabelAlignment, isCollapsed: $isCollapsed, isDense: $isDense, contentPadding: $contentPadding, prefixIcon: $prefixIcon, prefixIconConstraints: $prefixIconConstraints, prefix: $prefix, prefixText: $prefixText, prefixStyle: $prefixStyle, prefixIconColor: $prefixIconColor, suffix: $suffix, suffixIcon: $suffixIcon, suffixIconConstraints: $suffixIconConstraints, suffixText: $suffixText, suffixStyle: $suffixStyle, suffixIconColor: $suffixIconColor, counter: $counter, counterText: $counterText, counterStyle: $counterStyle, filled: $filled, fillColor: $fillColor, hoverColor: $hoverColor, focusColor: $focusColor, errorBorder: $errorBorder, focusedBorder: $focusedBorder, focusedErrorBorder: $focusedErrorBorder, disabledBorder: $disabledBorder, enabledBorder: $enabledBorder, border: $border, enabled: $enabled, semanticCounterText: $semanticCounterText, alignLabelWithHint: $alignLabelWithHint, constraints: $constraints)'; - } -} - -/// @nodoc -abstract mixin class _$StacInputDecorationCopyWith<$Res> - implements $StacInputDecorationCopyWith<$Res> { - factory _$StacInputDecorationCopyWith(_StacInputDecoration value, - $Res Function(_StacInputDecoration) _then) = - __$StacInputDecorationCopyWithImpl; - @override - @useResult - $Res call( - {Map? icon, - String? iconColor, - Map? label, - String? labelText, - StacTextStyle? labelStyle, - StacTextStyle? floatingLabelStyle, - String? helperText, - StacTextStyle? helperStyle, - String? hintText, - StacTextStyle? hintStyle, - int? helperMaxLines, - TextDirection? hintTextDirection, - int? hintMaxLines, - String? errorText, - StacTextStyle? errorStyle, - int? errorMaxLines, - FloatingLabelBehavior? floatingLabelBehavior, - StacFloatingLabelAlignment? floatingLabelAlignment, - bool isCollapsed, - bool isDense, - StacEdgeInsets? contentPadding, - Map? prefixIcon, - StacBoxConstraints? prefixIconConstraints, - Map? prefix, - String? prefixText, - StacTextStyle? prefixStyle, - String? prefixIconColor, - Map? suffix, - Map? suffixIcon, - StacBoxConstraints? suffixIconConstraints, - String? suffixText, - StacTextStyle? suffixStyle, - String? suffixIconColor, - Map? counter, - String? counterText, - StacTextStyle? counterStyle, - bool? filled, - String? fillColor, - String? hoverColor, - String? focusColor, - StacInputBorder? errorBorder, - StacInputBorder? focusedBorder, - StacInputBorder? focusedErrorBorder, - StacInputBorder? disabledBorder, - StacInputBorder? enabledBorder, - StacInputBorder? border, - bool enabled, - String? semanticCounterText, - bool alignLabelWithHint, - StacBoxConstraints? constraints}); - - @override - $StacInputBorderCopyWith<$Res>? get errorBorder; - @override - $StacInputBorderCopyWith<$Res>? get focusedBorder; - @override - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder; - @override - $StacInputBorderCopyWith<$Res>? get disabledBorder; - @override - $StacInputBorderCopyWith<$Res>? get enabledBorder; - @override - $StacInputBorderCopyWith<$Res>? get border; -} - -/// @nodoc -class __$StacInputDecorationCopyWithImpl<$Res> - implements _$StacInputDecorationCopyWith<$Res> { - __$StacInputDecorationCopyWithImpl(this._self, this._then); - - final _StacInputDecoration _self; - final $Res Function(_StacInputDecoration) _then; - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? icon = freezed, - Object? iconColor = freezed, - Object? label = freezed, - Object? labelText = freezed, - Object? labelStyle = freezed, - Object? floatingLabelStyle = freezed, - Object? helperText = freezed, - Object? helperStyle = freezed, - Object? hintText = freezed, - Object? hintStyle = freezed, - Object? helperMaxLines = freezed, - Object? hintTextDirection = freezed, - Object? hintMaxLines = freezed, - Object? errorText = freezed, - Object? errorStyle = freezed, - Object? errorMaxLines = freezed, - Object? floatingLabelBehavior = freezed, - Object? floatingLabelAlignment = freezed, - Object? isCollapsed = null, - Object? isDense = null, - Object? contentPadding = freezed, - Object? prefixIcon = freezed, - Object? prefixIconConstraints = freezed, - Object? prefix = freezed, - Object? prefixText = freezed, - Object? prefixStyle = freezed, - Object? prefixIconColor = freezed, - Object? suffix = freezed, - Object? suffixIcon = freezed, - Object? suffixIconConstraints = freezed, - Object? suffixText = freezed, - Object? suffixStyle = freezed, - Object? suffixIconColor = freezed, - Object? counter = freezed, - Object? counterText = freezed, - Object? counterStyle = freezed, - Object? filled = freezed, - Object? fillColor = freezed, - Object? hoverColor = freezed, - Object? focusColor = freezed, - Object? errorBorder = freezed, - Object? focusedBorder = freezed, - Object? focusedErrorBorder = freezed, - Object? disabledBorder = freezed, - Object? enabledBorder = freezed, - Object? border = freezed, - Object? enabled = null, - Object? semanticCounterText = freezed, - Object? alignLabelWithHint = null, - Object? constraints = freezed, - }) { - return _then(_StacInputDecoration( - icon: freezed == icon - ? _self._icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - label: freezed == label - ? _self._label - : label // ignore: cast_nullable_to_non_nullable - as Map?, - labelText: freezed == labelText - ? _self.labelText - : labelText // ignore: cast_nullable_to_non_nullable - as String?, - labelStyle: freezed == labelStyle - ? _self.labelStyle - : labelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - floatingLabelStyle: freezed == floatingLabelStyle - ? _self.floatingLabelStyle - : floatingLabelStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperText: freezed == helperText - ? _self.helperText - : helperText // ignore: cast_nullable_to_non_nullable - as String?, - helperStyle: freezed == helperStyle - ? _self.helperStyle - : helperStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - hintText: freezed == hintText - ? _self.hintText - : hintText // ignore: cast_nullable_to_non_nullable - as String?, - hintStyle: freezed == hintStyle - ? _self.hintStyle - : hintStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - helperMaxLines: freezed == helperMaxLines - ? _self.helperMaxLines - : helperMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - hintTextDirection: freezed == hintTextDirection - ? _self.hintTextDirection - : hintTextDirection // ignore: cast_nullable_to_non_nullable - as TextDirection?, - hintMaxLines: freezed == hintMaxLines - ? _self.hintMaxLines - : hintMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - errorText: freezed == errorText - ? _self.errorText - : errorText // ignore: cast_nullable_to_non_nullable - as String?, - errorStyle: freezed == errorStyle - ? _self.errorStyle - : errorStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - errorMaxLines: freezed == errorMaxLines - ? _self.errorMaxLines - : errorMaxLines // ignore: cast_nullable_to_non_nullable - as int?, - floatingLabelBehavior: freezed == floatingLabelBehavior - ? _self.floatingLabelBehavior - : floatingLabelBehavior // ignore: cast_nullable_to_non_nullable - as FloatingLabelBehavior?, - floatingLabelAlignment: freezed == floatingLabelAlignment - ? _self.floatingLabelAlignment - : floatingLabelAlignment // ignore: cast_nullable_to_non_nullable - as StacFloatingLabelAlignment?, - isCollapsed: null == isCollapsed - ? _self.isCollapsed - : isCollapsed // ignore: cast_nullable_to_non_nullable - as bool, - isDense: null == isDense - ? _self.isDense - : isDense // ignore: cast_nullable_to_non_nullable - as bool, - contentPadding: freezed == contentPadding - ? _self.contentPadding - : contentPadding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - prefixIcon: freezed == prefixIcon - ? _self._prefixIcon - : prefixIcon // ignore: cast_nullable_to_non_nullable - as Map?, - prefixIconConstraints: freezed == prefixIconConstraints - ? _self.prefixIconConstraints - : prefixIconConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - prefix: freezed == prefix - ? _self._prefix - : prefix // ignore: cast_nullable_to_non_nullable - as Map?, - prefixText: freezed == prefixText - ? _self.prefixText - : prefixText // ignore: cast_nullable_to_non_nullable - as String?, - prefixStyle: freezed == prefixStyle - ? _self.prefixStyle - : prefixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - prefixIconColor: freezed == prefixIconColor - ? _self.prefixIconColor - : prefixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - suffix: freezed == suffix - ? _self._suffix - : suffix // ignore: cast_nullable_to_non_nullable - as Map?, - suffixIcon: freezed == suffixIcon - ? _self._suffixIcon - : suffixIcon // ignore: cast_nullable_to_non_nullable - as Map?, - suffixIconConstraints: freezed == suffixIconConstraints - ? _self.suffixIconConstraints - : suffixIconConstraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - suffixText: freezed == suffixText - ? _self.suffixText - : suffixText // ignore: cast_nullable_to_non_nullable - as String?, - suffixStyle: freezed == suffixStyle - ? _self.suffixStyle - : suffixStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - suffixIconColor: freezed == suffixIconColor - ? _self.suffixIconColor - : suffixIconColor // ignore: cast_nullable_to_non_nullable - as String?, - counter: freezed == counter - ? _self._counter - : counter // ignore: cast_nullable_to_non_nullable - as Map?, - counterText: freezed == counterText - ? _self.counterText - : counterText // ignore: cast_nullable_to_non_nullable - as String?, - counterStyle: freezed == counterStyle - ? _self.counterStyle - : counterStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - filled: freezed == filled - ? _self.filled - : filled // ignore: cast_nullable_to_non_nullable - as bool?, - fillColor: freezed == fillColor - ? _self.fillColor - : fillColor // ignore: cast_nullable_to_non_nullable - as String?, - hoverColor: freezed == hoverColor - ? _self.hoverColor - : hoverColor // ignore: cast_nullable_to_non_nullable - as String?, - focusColor: freezed == focusColor - ? _self.focusColor - : focusColor // ignore: cast_nullable_to_non_nullable - as String?, - errorBorder: freezed == errorBorder - ? _self.errorBorder - : errorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedBorder: freezed == focusedBorder - ? _self.focusedBorder - : focusedBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - focusedErrorBorder: freezed == focusedErrorBorder - ? _self.focusedErrorBorder - : focusedErrorBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - disabledBorder: freezed == disabledBorder - ? _self.disabledBorder - : disabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabledBorder: freezed == enabledBorder - ? _self.enabledBorder - : enabledBorder // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - border: freezed == border - ? _self.border - : border // ignore: cast_nullable_to_non_nullable - as StacInputBorder?, - enabled: null == enabled - ? _self.enabled - : enabled // ignore: cast_nullable_to_non_nullable - as bool, - semanticCounterText: freezed == semanticCounterText - ? _self.semanticCounterText - : semanticCounterText // ignore: cast_nullable_to_non_nullable - as String?, - alignLabelWithHint: null == alignLabelWithHint - ? _self.alignLabelWithHint - : alignLabelWithHint // ignore: cast_nullable_to_non_nullable - as bool, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - )); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get errorBorder { - if (_self.errorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.errorBorder!, (value) { - return _then(_self.copyWith(errorBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedBorder { - if (_self.focusedBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedBorder!, (value) { - return _then(_self.copyWith(focusedBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get focusedErrorBorder { - if (_self.focusedErrorBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.focusedErrorBorder!, (value) { - return _then(_self.copyWith(focusedErrorBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get disabledBorder { - if (_self.disabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.disabledBorder!, (value) { - return _then(_self.copyWith(disabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get enabledBorder { - if (_self.enabledBorder == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.enabledBorder!, (value) { - return _then(_self.copyWith(enabledBorder: value)); - }); - } - - /// Create a copy of StacInputDecoration - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacInputBorderCopyWith<$Res>? get border { - if (_self.border == null) { - return null; - } - - return $StacInputBorderCopyWith<$Res>(_self.border!, (value) { - return _then(_self.copyWith(border: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.g.dart b/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.g.dart deleted file mode 100644 index fdb4a0c9..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_decoration/stac_input_decoration.g.dart +++ /dev/null @@ -1,183 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_input_decoration.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacInputDecoration _$StacInputDecorationFromJson(Map json) => - _StacInputDecoration( - icon: json['icon'] as Map?, - iconColor: json['iconColor'] as String?, - label: json['label'] as Map?, - labelText: json['labelText'] as String?, - labelStyle: json['labelStyle'] == null - ? null - : StacTextStyle.fromJson(json['labelStyle'] as Map), - floatingLabelStyle: json['floatingLabelStyle'] == null - ? null - : StacTextStyle.fromJson( - json['floatingLabelStyle'] as Map), - helperText: json['helperText'] as String?, - helperStyle: json['helperStyle'] == null - ? null - : StacTextStyle.fromJson(json['helperStyle'] as Map), - hintText: json['hintText'] as String?, - hintStyle: json['hintStyle'] == null - ? null - : StacTextStyle.fromJson(json['hintStyle'] as Map), - helperMaxLines: (json['helperMaxLines'] as num?)?.toInt(), - hintTextDirection: $enumDecodeNullable( - _$TextDirectionEnumMap, json['hintTextDirection']), - hintMaxLines: (json['hintMaxLines'] as num?)?.toInt(), - errorText: json['errorText'] as String?, - errorStyle: json['errorStyle'] == null - ? null - : StacTextStyle.fromJson(json['errorStyle'] as Map), - errorMaxLines: (json['errorMaxLines'] as num?)?.toInt(), - floatingLabelBehavior: $enumDecodeNullable( - _$FloatingLabelBehaviorEnumMap, json['floatingLabelBehavior']), - floatingLabelAlignment: $enumDecodeNullable( - _$StacFloatingLabelAlignmentEnumMap, json['floatingLabelAlignment']), - isCollapsed: json['isCollapsed'] as bool? ?? false, - isDense: json['isDense'] as bool? ?? false, - contentPadding: json['contentPadding'] == null - ? null - : StacEdgeInsets.fromJson(json['contentPadding']), - prefixIcon: json['prefixIcon'] as Map?, - prefixIconConstraints: json['prefixIconConstraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['prefixIconConstraints'] as Map), - prefix: json['prefix'] as Map?, - prefixText: json['prefixText'] as String?, - prefixStyle: json['prefixStyle'] == null - ? null - : StacTextStyle.fromJson(json['prefixStyle'] as Map), - prefixIconColor: json['prefixIconColor'] as String?, - suffix: json['suffix'] as Map?, - suffixIcon: json['suffixIcon'] as Map?, - suffixIconConstraints: json['suffixIconConstraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['suffixIconConstraints'] as Map), - suffixText: json['suffixText'] as String?, - suffixStyle: json['suffixStyle'] == null - ? null - : StacTextStyle.fromJson(json['suffixStyle'] as Map), - suffixIconColor: json['suffixIconColor'] as String?, - counter: json['counter'] as Map?, - counterText: json['counterText'] as String?, - counterStyle: json['counterStyle'] == null - ? null - : StacTextStyle.fromJson( - json['counterStyle'] as Map), - filled: json['filled'] as bool?, - fillColor: json['fillColor'] as String?, - hoverColor: json['hoverColor'] as String?, - focusColor: json['focusColor'] as String?, - errorBorder: json['errorBorder'] == null - ? null - : StacInputBorder.fromJson( - json['errorBorder'] as Map), - focusedBorder: json['focusedBorder'] == null - ? null - : StacInputBorder.fromJson( - json['focusedBorder'] as Map), - focusedErrorBorder: json['focusedErrorBorder'] == null - ? null - : StacInputBorder.fromJson( - json['focusedErrorBorder'] as Map), - disabledBorder: json['disabledBorder'] == null - ? null - : StacInputBorder.fromJson( - json['disabledBorder'] as Map), - enabledBorder: json['enabledBorder'] == null - ? null - : StacInputBorder.fromJson( - json['enabledBorder'] as Map), - border: json['border'] == null - ? null - : StacInputBorder.fromJson(json['border'] as Map), - enabled: json['enabled'] as bool? ?? true, - semanticCounterText: json['semanticCounterText'] as String?, - alignLabelWithHint: json['alignLabelWithHint'] as bool? ?? false, - constraints: json['constraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['constraints'] as Map), - ); - -Map _$StacInputDecorationToJson( - _StacInputDecoration instance) => - { - 'icon': instance.icon, - 'iconColor': instance.iconColor, - 'label': instance.label, - 'labelText': instance.labelText, - 'labelStyle': instance.labelStyle, - 'floatingLabelStyle': instance.floatingLabelStyle, - 'helperText': instance.helperText, - 'helperStyle': instance.helperStyle, - 'hintText': instance.hintText, - 'hintStyle': instance.hintStyle, - 'helperMaxLines': instance.helperMaxLines, - 'hintTextDirection': _$TextDirectionEnumMap[instance.hintTextDirection], - 'hintMaxLines': instance.hintMaxLines, - 'errorText': instance.errorText, - 'errorStyle': instance.errorStyle, - 'errorMaxLines': instance.errorMaxLines, - 'floatingLabelBehavior': - _$FloatingLabelBehaviorEnumMap[instance.floatingLabelBehavior], - 'floatingLabelAlignment': - _$StacFloatingLabelAlignmentEnumMap[instance.floatingLabelAlignment], - 'isCollapsed': instance.isCollapsed, - 'isDense': instance.isDense, - 'contentPadding': instance.contentPadding, - 'prefixIcon': instance.prefixIcon, - 'prefixIconConstraints': instance.prefixIconConstraints, - 'prefix': instance.prefix, - 'prefixText': instance.prefixText, - 'prefixStyle': instance.prefixStyle, - 'prefixIconColor': instance.prefixIconColor, - 'suffix': instance.suffix, - 'suffixIcon': instance.suffixIcon, - 'suffixIconConstraints': instance.suffixIconConstraints, - 'suffixText': instance.suffixText, - 'suffixStyle': instance.suffixStyle, - 'suffixIconColor': instance.suffixIconColor, - 'counter': instance.counter, - 'counterText': instance.counterText, - 'counterStyle': instance.counterStyle, - 'filled': instance.filled, - 'fillColor': instance.fillColor, - 'hoverColor': instance.hoverColor, - 'focusColor': instance.focusColor, - 'errorBorder': instance.errorBorder, - 'focusedBorder': instance.focusedBorder, - 'focusedErrorBorder': instance.focusedErrorBorder, - 'disabledBorder': instance.disabledBorder, - 'enabledBorder': instance.enabledBorder, - 'border': instance.border, - 'enabled': instance.enabled, - 'semanticCounterText': instance.semanticCounterText, - 'alignLabelWithHint': instance.alignLabelWithHint, - 'constraints': instance.constraints, - }; - -const _$TextDirectionEnumMap = { - TextDirection.rtl: 'rtl', - TextDirection.ltr: 'ltr', -}; - -const _$FloatingLabelBehaviorEnumMap = { - FloatingLabelBehavior.never: 'never', - FloatingLabelBehavior.auto: 'auto', - FloatingLabelBehavior.always: 'always', -}; - -const _$StacFloatingLabelAlignmentEnumMap = { - StacFloatingLabelAlignment.start: 'start', - StacFloatingLabelAlignment.center: 'center', -}; diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.dart b/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.dart deleted file mode 100644 index 32bf0a77..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/utils/input_formatters.dart'; - -part 'stac_input_formatter.freezed.dart'; -part 'stac_input_formatter.g.dart'; - -@freezed -abstract class StacInputFormatter with _$StacInputFormatter { - const factory StacInputFormatter({ - required InputFormatterType type, - String? rule, - }) = _StacInputFormatter; - - factory StacInputFormatter.fromJson(Map json) => - _$StacInputFormatterFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.freezed.dart deleted file mode 100644 index 9af8a0aa..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.freezed.dart +++ /dev/null @@ -1,175 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_input_formatter.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacInputFormatter { - InputFormatterType get type; - String? get rule; - - /// Create a copy of StacInputFormatter - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacInputFormatterCopyWith get copyWith => - _$StacInputFormatterCopyWithImpl( - this as StacInputFormatter, _$identity); - - /// Serializes this StacInputFormatter to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacInputFormatter && - (identical(other.type, type) || other.type == type) && - (identical(other.rule, rule) || other.rule == rule)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, type, rule); - - @override - String toString() { - return 'StacInputFormatter(type: $type, rule: $rule)'; - } -} - -/// @nodoc -abstract mixin class $StacInputFormatterCopyWith<$Res> { - factory $StacInputFormatterCopyWith( - StacInputFormatter value, $Res Function(StacInputFormatter) _then) = - _$StacInputFormatterCopyWithImpl; - @useResult - $Res call({InputFormatterType type, String? rule}); -} - -/// @nodoc -class _$StacInputFormatterCopyWithImpl<$Res> - implements $StacInputFormatterCopyWith<$Res> { - _$StacInputFormatterCopyWithImpl(this._self, this._then); - - final StacInputFormatter _self; - final $Res Function(StacInputFormatter) _then; - - /// Create a copy of StacInputFormatter - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? type = null, - Object? rule = freezed, - }) { - return _then(_self.copyWith( - type: null == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as InputFormatterType, - rule: freezed == rule - ? _self.rule - : rule // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacInputFormatter implements StacInputFormatter { - const _StacInputFormatter({required this.type, this.rule}); - factory _StacInputFormatter.fromJson(Map json) => - _$StacInputFormatterFromJson(json); - - @override - final InputFormatterType type; - @override - final String? rule; - - /// Create a copy of StacInputFormatter - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacInputFormatterCopyWith<_StacInputFormatter> get copyWith => - __$StacInputFormatterCopyWithImpl<_StacInputFormatter>(this, _$identity); - - @override - Map toJson() { - return _$StacInputFormatterToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacInputFormatter && - (identical(other.type, type) || other.type == type) && - (identical(other.rule, rule) || other.rule == rule)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, type, rule); - - @override - String toString() { - return 'StacInputFormatter(type: $type, rule: $rule)'; - } -} - -/// @nodoc -abstract mixin class _$StacInputFormatterCopyWith<$Res> - implements $StacInputFormatterCopyWith<$Res> { - factory _$StacInputFormatterCopyWith( - _StacInputFormatter value, $Res Function(_StacInputFormatter) _then) = - __$StacInputFormatterCopyWithImpl; - @override - @useResult - $Res call({InputFormatterType type, String? rule}); -} - -/// @nodoc -class __$StacInputFormatterCopyWithImpl<$Res> - implements _$StacInputFormatterCopyWith<$Res> { - __$StacInputFormatterCopyWithImpl(this._self, this._then); - - final _StacInputFormatter _self; - final $Res Function(_StacInputFormatter) _then; - - /// Create a copy of StacInputFormatter - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? type = null, - Object? rule = freezed, - }) { - return _then(_StacInputFormatter( - type: null == type - ? _self.type - : type // ignore: cast_nullable_to_non_nullable - as InputFormatterType, - rule: freezed == rule - ? _self.rule - : rule // ignore: cast_nullable_to_non_nullable - as String?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.g.dart b/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.g.dart deleted file mode 100644 index 1c726dea..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_input_formatters/stac_input_formatter.g.dart +++ /dev/null @@ -1,24 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_input_formatter.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacInputFormatter _$StacInputFormatterFromJson(Map json) => - _StacInputFormatter( - type: $enumDecode(_$InputFormatterTypeEnumMap, json['type']), - rule: json['rule'] as String?, - ); - -Map _$StacInputFormatterToJson(_StacInputFormatter instance) => - { - 'type': _$InputFormatterTypeEnumMap[instance.type]!, - 'rule': instance.rule, - }; - -const _$InputFormatterTypeEnumMap = { - InputFormatterType.allow: 'allow', - InputFormatterType.deny: 'deny', -}; diff --git a/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart b/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart index 96d217db..6e4d1978 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart @@ -1,6 +1,6 @@ import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/stac_core.dart'; export 'stac_linear_progress_indicator_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart index e844c7f8..9261ebf0 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator_parser.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac/stac.dart'; class StacLinearProgressIndicatorParser diff --git a/packages/stac/lib/src/parsers/widgets/stac_list_tile/stac_list_tile_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_list_tile/stac_list_tile_parser.dart index b02fb308..11176a7b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_list_tile/stac_list_tile_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_list_tile/stac_list_tile_parser.dart @@ -4,7 +4,7 @@ import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_core/widgets/list_tile/stac_list_tile.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart index 77a51fb6..fab9a2ae 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_list_view/stac_list_view_parser.dart @@ -2,7 +2,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_core/widgets/list_view/stac_list_view.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart b/packages/stac/lib/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart deleted file mode 100644 index dd7b6b05..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/services.dart'; - -enum StacMouseCursor { - none, - basic, - click, - forbidden, - wait, - progress, - contextMenu, - help, - text, - verticalText, - cell, - precise, - move, - grab, - grabbing, - noDrop, - alias, - copy, - disappearing, - allScroll, - resizeLeftRight, - resizeUpDown, - resizeUpLeftDownRight, - resizeUpRightDownLeft, - resizeUp, - resizeDown, - resizeLeft, - resizeRight, - resizeUpLeft, - resizeUpRight, - resizeDownLeft, - resizeDownRight, - resizeColumn, - resizeRow, - zoomIn, - zoomOut; - - SystemMouseCursor get value { - switch (this) { - case StacMouseCursor.none: - return SystemMouseCursors.none; - case StacMouseCursor.basic: - return SystemMouseCursors.basic; - case StacMouseCursor.click: - return SystemMouseCursors.click; - case StacMouseCursor.forbidden: - return SystemMouseCursors.forbidden; - case StacMouseCursor.wait: - return SystemMouseCursors.wait; - case StacMouseCursor.progress: - return SystemMouseCursors.progress; - case StacMouseCursor.contextMenu: - return SystemMouseCursors.contextMenu; - case StacMouseCursor.help: - return SystemMouseCursors.help; - case StacMouseCursor.text: - return SystemMouseCursors.text; - case StacMouseCursor.verticalText: - return SystemMouseCursors.verticalText; - case StacMouseCursor.cell: - return SystemMouseCursors.cell; - case StacMouseCursor.precise: - return SystemMouseCursors.precise; - case StacMouseCursor.move: - return SystemMouseCursors.move; - case StacMouseCursor.grab: - return SystemMouseCursors.grab; - case StacMouseCursor.grabbing: - return SystemMouseCursors.grabbing; - case StacMouseCursor.noDrop: - return SystemMouseCursors.noDrop; - case StacMouseCursor.alias: - return SystemMouseCursors.alias; - case StacMouseCursor.copy: - return SystemMouseCursors.copy; - case StacMouseCursor.disappearing: - return SystemMouseCursors.disappearing; - case StacMouseCursor.allScroll: - return SystemMouseCursors.allScroll; - case StacMouseCursor.resizeLeftRight: - return SystemMouseCursors.resizeLeftRight; - case StacMouseCursor.resizeUpDown: - return SystemMouseCursors.resizeUpDown; - case StacMouseCursor.resizeUpLeftDownRight: - return SystemMouseCursors.resizeUpLeftDownRight; - case StacMouseCursor.resizeUpRightDownLeft: - return SystemMouseCursors.resizeUpRightDownLeft; - case StacMouseCursor.resizeUp: - return SystemMouseCursors.resizeUp; - case StacMouseCursor.resizeDown: - return SystemMouseCursors.resizeDown; - case StacMouseCursor.resizeLeft: - return SystemMouseCursors.resizeLeft; - case StacMouseCursor.resizeRight: - return SystemMouseCursors.resizeRight; - case StacMouseCursor.resizeUpLeft: - return SystemMouseCursors.resizeUpLeft; - case StacMouseCursor.resizeUpRight: - return SystemMouseCursors.resizeUpRight; - case StacMouseCursor.resizeDownLeft: - return SystemMouseCursors.resizeDownLeft; - case StacMouseCursor.resizeDownRight: - return SystemMouseCursors.resizeDownRight; - case StacMouseCursor.resizeColumn: - return SystemMouseCursors.resizeColumn; - case StacMouseCursor.resizeRow: - return SystemMouseCursors.resizeRow; - case StacMouseCursor.zoomIn: - return SystemMouseCursors.zoomIn; - case StacMouseCursor.zoomOut: - return SystemMouseCursors.zoomOut; - } - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_network_widget/stac_network_widget_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_network_widget/stac_network_widget_parser.dart index ed03151a..23a66e62 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_network_widget/stac_network_widget_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_network_widget/stac_network_widget_parser.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/widgets/network_widget/stac_network_widget.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacNetworkWidgetParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_opacity/stac_opacity_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_opacity/stac_opacity_parser.dart index 19213661..f5b145df 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_opacity/stac_opacity_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_opacity/stac_opacity_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:stac_core/widgets/opacity/stac_opacity.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac/src/utils/widget_type.dart'; class StacOpacityParser extends StacParser { const StacOpacityParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart index 59421516..a97d8d71 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart @@ -3,9 +3,8 @@ import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/outlined_button/stac_outlined_button.dart'; class StacOutlinedButtonParser extends StacParser { const StacOutlinedButtonParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_padding/stac_padding_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_padding/stac_padding_parser.dart index c7bc86f7..58443179 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_padding/stac_padding_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_padding/stac_padding_parser.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart index be981784..58ab1caa 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_page_view/stac_page_view_parser.dart @@ -1,11 +1,10 @@ -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/page_view/stac_page_view.dart'; -import 'package:stac/src/parsers/core/stac_action_parser.dart'; class StacPageViewParser extends StacParser { const StacPageViewParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_placeholder/stac_placeholder_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_placeholder/stac_placeholder_parser.dart index 739fbaa4..6dcc8963 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_placeholder/stac_placeholder_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_placeholder/stac_placeholder_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac_core/widgets/placeholder/stac_placeholder.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacPlaceholderParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart index da0e28cc..2aa763fb 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_positioned/stac_positioned_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/positioned/stac_positioned.dart'; class StacPositionedParser extends StacParser { const StacPositionedParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.dart b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.dart index 5bdb095b..8bc793a7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart'; -import 'package:stac/src/parsers/widgets/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/stac_core.dart'; export 'stac_radio_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.freezed.dart index ce769b13..4b56ce5a 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio.freezed.dart @@ -130,8 +130,6 @@ abstract mixin class $StacRadioCopyWith<$Res> { bool autofocus, bool useCheckmarkStyle, bool useCupertinoCheckmarkStyle}); - - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -230,20 +228,6 @@ class _$StacRadioCopyWithImpl<$Res> implements $StacRadioCopyWith<$Res> { as bool, )); } - - /// Create a copy of StacRadio - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } /// Adds pattern-matching-related methods to [StacRadio]. @@ -670,9 +654,6 @@ abstract mixin class _$StacRadioCopyWith<$Res> bool autofocus, bool useCheckmarkStyle, bool useCupertinoCheckmarkStyle}); - - @override - $StacVisualDensityCopyWith<$Res>? get visualDensity; } /// @nodoc @@ -771,20 +752,6 @@ class __$StacRadioCopyWithImpl<$Res> implements _$StacRadioCopyWith<$Res> { as bool, )); } - - /// Create a copy of StacRadio - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith<$Res>? get visualDensity { - if (_self.visualDensity == null) { - return null; - } - - return $StacVisualDensityCopyWith<$Res>(_self.visualDensity!, (value) { - return _then(_self.copyWith(visualDensity: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio_parser.dart index 5f614d12..58ec13a3 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_radio/stac_radio_parser.dart @@ -3,10 +3,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_radio_group/stac_radio_group_scope.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/types/stac_radio_type.dart'; -import 'package:stac_core/widgets/radio/stac_radio.dart'; class StacRadioParser extends StacParser { const StacRadioParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_radio_group/stac_radio_group_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_radio_group/stac_radio_group_parser.dart index bcde5e1f..0d3412ba 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_radio_group/stac_radio_group_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_radio_group/stac_radio_group_parser.dart @@ -1,10 +1,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/widgets/stac_radio_group/stac_radio_group_scope.dart'; -import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/widgets/radio_group/stac_radio_group.dart'; +import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; +import 'package:stac/src/parsers/widgets/stac_radio_group/stac_radio_group_scope.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacRadioGroupParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart index 03ca5dcc..3cd9ee5d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_refresh_indicator/stac_refresh_indicator_parser.dart @@ -6,9 +6,7 @@ import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/core/core.dart'; -import 'package:stac_core/widgets/refresh_indicator/stac_refresh_indicator.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacRefreshIndicatorParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart index 10031f57..88200f40 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; part 'stac_rounded_rectangle_border.freezed.dart'; part 'stac_rounded_rectangle_border.g.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_safe_area/stac_safe_area_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_safe_area/stac_safe_area_parser.dart index 4160a562..b2d425f9 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_safe_area/stac_safe_area_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_safe_area/stac_safe_area_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac_core/widgets/safe_area/stac_safe_area.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac/src/parsers/core/stac_widget_parser.dart'; class StacSafeAreaParser extends StacParser { const StacSafeAreaParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart index e469bc70..8d3db67b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart index e33c8dd0..b4e72420 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_set_value/stac_set_value_parser.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/utils/variable_resolver.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'stac_set_value.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart index 89d16462..48296e1c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view_parser.dart @@ -3,9 +3,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart'; class StacSingleChildScrollViewParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.dart b/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.dart deleted file mode 100644 index 15a51e46..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'dart:ui'; - -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; - -part 'stac_size.freezed.dart'; -part 'stac_size.g.dart'; - -@freezed -abstract class StacSize with _$StacSize { - const factory StacSize({ - required StacDouble width, - required StacDouble height, - }) = _StacSize; - - factory StacSize.fromJson(Map json) => - _$StacSizeFromJson(json); -} - -extension StacSizeParser on StacSize? { - Size get parse { - return Size(this?.width.parse ?? 0, this?.height.parse ?? 0); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.freezed.dart deleted file mode 100644 index 302f259f..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.freezed.dart +++ /dev/null @@ -1,170 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_size.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacSize { - StacDouble get width; - StacDouble get height; - - /// Create a copy of StacSize - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacSizeCopyWith get copyWith => - _$StacSizeCopyWithImpl(this as StacSize, _$identity); - - /// Serializes this StacSize to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacSize && - (identical(other.width, width) || other.width == width) && - (identical(other.height, height) || other.height == height)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, width, height); - - @override - String toString() { - return 'StacSize(width: $width, height: $height)'; - } -} - -/// @nodoc -abstract mixin class $StacSizeCopyWith<$Res> { - factory $StacSizeCopyWith(StacSize value, $Res Function(StacSize) _then) = - _$StacSizeCopyWithImpl; - @useResult - $Res call({StacDouble width, StacDouble height}); -} - -/// @nodoc -class _$StacSizeCopyWithImpl<$Res> implements $StacSizeCopyWith<$Res> { - _$StacSizeCopyWithImpl(this._self, this._then); - - final StacSize _self; - final $Res Function(StacSize) _then; - - /// Create a copy of StacSize - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? width = null, - Object? height = null, - }) { - return _then(_self.copyWith( - width: null == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as StacDouble, - height: null == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacSize implements StacSize { - const _StacSize({required this.width, required this.height}); - factory _StacSize.fromJson(Map json) => - _$StacSizeFromJson(json); - - @override - final StacDouble width; - @override - final StacDouble height; - - /// Create a copy of StacSize - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacSizeCopyWith<_StacSize> get copyWith => - __$StacSizeCopyWithImpl<_StacSize>(this, _$identity); - - @override - Map toJson() { - return _$StacSizeToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacSize && - (identical(other.width, width) || other.width == width) && - (identical(other.height, height) || other.height == height)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, width, height); - - @override - String toString() { - return 'StacSize(width: $width, height: $height)'; - } -} - -/// @nodoc -abstract mixin class _$StacSizeCopyWith<$Res> - implements $StacSizeCopyWith<$Res> { - factory _$StacSizeCopyWith(_StacSize value, $Res Function(_StacSize) _then) = - __$StacSizeCopyWithImpl; - @override - @useResult - $Res call({StacDouble width, StacDouble height}); -} - -/// @nodoc -class __$StacSizeCopyWithImpl<$Res> implements _$StacSizeCopyWith<$Res> { - __$StacSizeCopyWithImpl(this._self, this._then); - - final _StacSize _self; - final $Res Function(_StacSize) _then; - - /// Create a copy of StacSize - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? width = null, - Object? height = null, - }) { - return _then(_StacSize( - width: null == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as StacDouble, - height: null == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.g.dart b/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.g.dart deleted file mode 100644 index 9893c51e..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_size/stac_size.g.dart +++ /dev/null @@ -1,17 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_size.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacSize _$StacSizeFromJson(Map json) => _StacSize( - width: StacDouble.fromJson(json['width']), - height: StacDouble.fromJson(json['height']), - ); - -Map _$StacSizeToJson(_StacSize instance) => { - 'width': instance.width, - 'height': instance.height, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_sized_box/stac_sized_box_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_sized_box/stac_sized_box_parser.dart index f457226b..ee481634 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_sized_box/stac_sized_box_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_sized_box/stac_sized_box_parser.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_slider/stac_slider_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_slider/stac_slider_parser.dart index fe68856c..973862d2 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_slider/stac_slider_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_slider/stac_slider_parser.dart @@ -1,13 +1,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/core/stac_action_parser.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/slider/stac_slider.dart'; -import 'package:stac_core/types/stac_slider_type.dart'; class StacSliderParser extends StacParser { const StacSliderParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart index 4d6041c8..2c36e443 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar_parser.dart @@ -5,9 +5,8 @@ import 'package:stac/src/parsers/painting/stac_system_ui_overlay_style_parser.da import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/sliver_app_bar/stac_sliver_app_bar.dart'; class StacSliverAppBarParser extends StacParser { const StacSliverAppBarParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_spacer/stac_spacer_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_spacer/stac_spacer_parser.dart index c6afeff0..e4b06622 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_spacer/stac_spacer_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_spacer/stac_spacer_parser.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/spacer/stac_spacer.dart'; class StacSpacerParser extends StacParser { const StacSpacerParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_stack/stac_stack_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_stack/stac_stack_parser.dart index e78ce2e8..1c77ff2b 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_stack/stac_stack_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_stack/stac_stack_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/stack/stac_stack.dart'; class StacStackParser extends StacParser { const StacStackParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_switch/stac_switch_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_switch/stac_switch_parser.dart index b1fbd780..f652cea0 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_switch/stac_switch_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_switch/stac_switch_parser.dart @@ -5,8 +5,7 @@ import 'package:stac/src/parsers/core/stac_action_parser.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/stac.dart'; -import 'package:stac_core/types/stac_switch_type.dart'; -import 'package:stac_core/widgets/switch/stac_switch.dart'; +import 'package:stac_core/stac_core.dart'; class StacSwitchParser extends StacParser { const StacSwitchParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab/stac_tab_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_tab/stac_tab_parser.dart index 51bbf53e..79b2aacc 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab/stac_tab_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab/stac_tab_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/tab/stac_tab.dart'; class StacTabParser extends StacParser { const StacTabParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart index 3717543a..321df566 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart @@ -1,14 +1,13 @@ -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/painting/stac_box_decoration_parser.dart'; import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/tab_bar/stac_tab_bar.dart'; class StacTabBarParser extends StacParser { const StacTabBarParser({this.controller}); diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar_view/stac_tab_bar_view_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar_view/stac_tab_bar_view_parser.dart index 8192429f..fc9861a3 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar_view/stac_tab_bar_view_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar_view/stac_tab_bar_view_parser.dart @@ -1,10 +1,9 @@ -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/tab_bar_view/stac_tab_bar_view.dart'; class StacTabBarViewParser extends StacParser { const StacTabBarViewParser({this.controller}); diff --git a/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart index 17091b26..ff9394fe 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_table/stac_table_parser.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/widgets/table/stac_table.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacTableParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_table_cell/stac_table_cell_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_table_cell/stac_table_cell_parser.dart index 2d29e5d8..cb71e0fd 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_table_cell/stac_table_cell_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_table_cell/stac_table_cell_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac_core/widgets/table_cell/stac_table_cell.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; class StacTableCellParser extends StacParser { diff --git a/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart index aa021b4b..88b4c6c0 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text/stac_text_parser.dart @@ -4,9 +4,8 @@ import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/text/stac_text.dart'; class StacTextParser extends StacParser { const StacTextParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart index 17eb2377..f3b2d2b1 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart @@ -3,9 +3,8 @@ import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/text_button/stac_text_button.dart'; class StacTextButtonParser extends StacParser { const StacTextButtonParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart index 306507e8..60360838 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_field/stac_text_field_parser.dart @@ -1,13 +1,12 @@ -import 'package:flutter/material.dart'; import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_action_parser.dart'; +import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; import 'package:stac/src/parsers/painting/stac_text_style_parser.dart'; -import 'package:stac_core/widgets/text_field/stac_text_field.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac/src/parsers/core/stac_action_parser.dart'; -import 'package:stac/src/parsers/painting/stac_edge_insets_parser.dart'; class StacTextFieldParser extends StacParser { const StacTextFieldParser({ diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart index 0807c41e..2a0e3984 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_text_form_field/stac_text_form_field_parser.dart @@ -5,8 +5,7 @@ import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/input_validations.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_core/widgets/text_form_field/stac_text_form_field.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; import 'package:stac_logger/stac_logger.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_vertical_divider/stac_vertical_divider_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_vertical_divider/stac_vertical_divider_parser.dart index 7b8911e5..534d4985 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_vertical_divider/stac_vertical_divider_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_vertical_divider/stac_vertical_divider_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac_core/widgets/vertical_divider/stac_vertical_divider.dart'; class StacVerticalDividerParser extends StacParser { const StacVerticalDividerParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart index 5399ad2e..775b37a2 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_visibility/stac_visibility_parser.dart @@ -1,8 +1,7 @@ import 'package:flutter/material.dart'; -import 'package:stac/src/utils/widget_type.dart'; -import 'package:stac_framework/stac_framework.dart'; import 'package:stac/src/parsers/core/stac_widget_parser.dart'; -import 'package:stac_core/widgets/visibility/stac_visibility.dart'; +import 'package:stac_core/stac_core.dart'; +import 'package:stac_framework/stac_framework.dart'; class StacVisibilityParser extends StacParser { const StacVisibilityParser(); diff --git a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.dart b/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.dart deleted file mode 100644 index a692fa4e..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.dart +++ /dev/null @@ -1,24 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; - -part 'stac_visual_density.freezed.dart'; -part 'stac_visual_density.g.dart'; - -@freezed -abstract class StacVisualDensity with _$StacVisualDensity { - const factory StacVisualDensity({ - required StacDouble horizontal, - required StacDouble vertical, - }) = _StacVisualDensity; - - factory StacVisualDensity.fromJson(Map json) => - _$StacVisualDensityFromJson(json); -} - -extension StacVisualDensityExt on StacVisualDensity { - VisualDensity get parse => VisualDensity( - horizontal: horizontal.parse, - vertical: vertical.parse, - ); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.freezed.dart deleted file mode 100644 index 41d05c46..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.freezed.dart +++ /dev/null @@ -1,179 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'stac_visual_density.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacVisualDensity { - StacDouble get horizontal; - StacDouble get vertical; - - /// Create a copy of StacVisualDensity - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacVisualDensityCopyWith get copyWith => - _$StacVisualDensityCopyWithImpl( - this as StacVisualDensity, _$identity); - - /// Serializes this StacVisualDensity to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacVisualDensity && - (identical(other.horizontal, horizontal) || - other.horizontal == horizontal) && - (identical(other.vertical, vertical) || - other.vertical == vertical)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, horizontal, vertical); - - @override - String toString() { - return 'StacVisualDensity(horizontal: $horizontal, vertical: $vertical)'; - } -} - -/// @nodoc -abstract mixin class $StacVisualDensityCopyWith<$Res> { - factory $StacVisualDensityCopyWith( - StacVisualDensity value, $Res Function(StacVisualDensity) _then) = - _$StacVisualDensityCopyWithImpl; - @useResult - $Res call({StacDouble horizontal, StacDouble vertical}); -} - -/// @nodoc -class _$StacVisualDensityCopyWithImpl<$Res> - implements $StacVisualDensityCopyWith<$Res> { - _$StacVisualDensityCopyWithImpl(this._self, this._then); - - final StacVisualDensity _self; - final $Res Function(StacVisualDensity) _then; - - /// Create a copy of StacVisualDensity - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? horizontal = null, - Object? vertical = null, - }) { - return _then(_self.copyWith( - horizontal: null == horizontal - ? _self.horizontal - : horizontal // ignore: cast_nullable_to_non_nullable - as StacDouble, - vertical: null == vertical - ? _self.vertical - : vertical // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacVisualDensity implements StacVisualDensity { - const _StacVisualDensity({required this.horizontal, required this.vertical}); - factory _StacVisualDensity.fromJson(Map json) => - _$StacVisualDensityFromJson(json); - - @override - final StacDouble horizontal; - @override - final StacDouble vertical; - - /// Create a copy of StacVisualDensity - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacVisualDensityCopyWith<_StacVisualDensity> get copyWith => - __$StacVisualDensityCopyWithImpl<_StacVisualDensity>(this, _$identity); - - @override - Map toJson() { - return _$StacVisualDensityToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacVisualDensity && - (identical(other.horizontal, horizontal) || - other.horizontal == horizontal) && - (identical(other.vertical, vertical) || - other.vertical == vertical)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, horizontal, vertical); - - @override - String toString() { - return 'StacVisualDensity(horizontal: $horizontal, vertical: $vertical)'; - } -} - -/// @nodoc -abstract mixin class _$StacVisualDensityCopyWith<$Res> - implements $StacVisualDensityCopyWith<$Res> { - factory _$StacVisualDensityCopyWith( - _StacVisualDensity value, $Res Function(_StacVisualDensity) _then) = - __$StacVisualDensityCopyWithImpl; - @override - @useResult - $Res call({StacDouble horizontal, StacDouble vertical}); -} - -/// @nodoc -class __$StacVisualDensityCopyWithImpl<$Res> - implements _$StacVisualDensityCopyWith<$Res> { - __$StacVisualDensityCopyWithImpl(this._self, this._then); - - final _StacVisualDensity _self; - final $Res Function(_StacVisualDensity) _then; - - /// Create a copy of StacVisualDensity - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? horizontal = null, - Object? vertical = null, - }) { - return _then(_StacVisualDensity( - horizontal: null == horizontal - ? _self.horizontal - : horizontal // ignore: cast_nullable_to_non_nullable - as StacDouble, - vertical: null == vertical - ? _self.vertical - : vertical // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.g.dart b/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.g.dart deleted file mode 100644 index 1e1e7208..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_visual_density/stac_visual_density.g.dart +++ /dev/null @@ -1,19 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_visual_density.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacVisualDensity _$StacVisualDensityFromJson(Map json) => - _StacVisualDensity( - horizontal: StacDouble.fromJson(json['horizontal']), - vertical: StacDouble.fromJson(json['vertical']), - ); - -Map _$StacVisualDensityToJson(_StacVisualDensity instance) => - { - 'horizontal': instance.horizontal, - 'vertical': instance.vertical, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart index c69033f4..2edea816 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_wrap/stac_wrap_parser.dart @@ -1,9 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:stac/src/parsers/core/stac_widget_parser.dart'; import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_core/widgets/wrap/stac_wrap.dart'; -import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac_core/stac_core.dart'; import 'package:stac_framework/stac_framework.dart'; -import 'package:stac/src/parsers/core/stac_widget_parser.dart'; class StacWrapParser extends StacParser { const StacWrapParser(); diff --git a/packages/stac/lib/src/parsers/widgets/widgets.dart b/packages/stac/lib/src/parsers/widgets/widgets.dart index 7fdb1dda..418e31aa 100644 --- a/packages/stac/lib/src/parsers/widgets/widgets.dart +++ b/packages/stac/lib/src/parsers/widgets/widgets.dart @@ -29,7 +29,6 @@ export 'package:stac/src/parsers/widgets/stac_default_tab_controller/stac_defaul export 'package:stac/src/parsers/widgets/stac_divider/stac_divider_parser.dart'; export 'package:stac/src/parsers/widgets/stac_drawer/stac_drawer_parser.dart'; export 'package:stac/src/parsers/widgets/stac_dropdown_menu/stac_dropdown_menu_parser.dart'; -export 'package:stac/src/parsers/widgets/stac_duration/stac_duration.dart'; export 'package:stac/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view_parser.dart'; export 'package:stac/src/parsers/widgets/stac_edge_insets/stac_edge_insets.dart'; export 'package:stac/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart'; @@ -41,7 +40,6 @@ export 'package:stac/src/parsers/widgets/stac_floating_action_button/stac_floati export 'package:stac/src/parsers/widgets/stac_font_weight/stac_font_weight.dart'; export 'package:stac/src/parsers/widgets/stac_form/stac_form_parser.dart'; export 'package:stac/src/parsers/widgets/stac_form/stac_form_scope.dart'; -export 'package:stac/src/parsers/widgets/stac_form_field_validator/stac_form_validator.dart'; export 'package:stac/src/parsers/widgets/stac_fractionally_sized_box/stac_fractionally_sized_box_parser.dart'; export 'package:stac/src/parsers/widgets/stac_gesture_detector/stac_gesture_detector_parser.dart'; export 'package:stac/src/parsers/widgets/stac_gradient/stac_gradient.dart'; @@ -49,9 +47,7 @@ export 'package:stac/src/parsers/widgets/stac_grid_view/stac_grid_view_parser.da export 'package:stac/src/parsers/widgets/stac_hero/stac_hero_parser.dart'; export 'package:stac/src/parsers/widgets/stac_icon/stac_icon_parser.dart'; export 'package:stac/src/parsers/widgets/stac_icon_button/stac_icon_button_parser.dart'; -export 'package:stac/src/parsers/widgets/stac_image/stac_image.dart'; -export 'package:stac/src/parsers/widgets/stac_input_decoration/stac_input_decoration.dart'; -export 'package:stac/src/parsers/widgets/stac_input_formatters/stac_input_formatter.dart'; +export 'package:stac/src/parsers/widgets/stac_image/stac_image_parser.dart'; export 'package:stac/src/parsers/widgets/stac_limited_box/stac_limited_box_parser.dart'; export 'package:stac/src/parsers/widgets/stac_linear_progress_indicator/stac_linear_progress_indicator.dart'; export 'package:stac/src/parsers/widgets/stac_list_tile/stac_list_tile_parser.dart'; diff --git a/packages/stac/lib/src/utils/action_type.dart b/packages/stac/lib/src/utils/action_type.dart deleted file mode 100644 index bca0211f..00000000 --- a/packages/stac/lib/src/utils/action_type.dart +++ /dev/null @@ -1,13 +0,0 @@ -enum ActionType { - navigate, - none, - networkRequest, - showModalBottomSheet, - showDialog, - getFormValue, - validateForm, - showSnackBar, - setValue, - multiAction, - delay, -} diff --git a/packages/stac/lib/src/utils/widget_type.dart b/packages/stac/lib/src/utils/widget_type.dart deleted file mode 100644 index 74483969..00000000 --- a/packages/stac/lib/src/utils/widget_type.dart +++ /dev/null @@ -1,82 +0,0 @@ -enum WidgetType { - alertDialog, - align, - appBar, - aspectRatio, - autocomplete, - backdropFilter, - bottomNavigationBar, - bottomNavigationView, - card, - carouselView, - center, - checkBox, - chip, - clipOval, - clipRRect, - circleAvatar, - circularProgressIndicator, - coloredBox, - column, - conditional, - container, - drawer, - dropdownMenu, - customScrollView, - defaultBottomNavigationController, - defaultTabController, - divider, - dynamicView, - elevatedButton, - expanded, - filledButton, - fittedBox, - flexible, - floatingActionButton, - form, - formField, - fractionallySizedBox, - gestureDetector, - gridView, - hero, - icon, - iconButton, - image, - inkWell, - limitedBox, - linearProgressIndicator, - listTile, - listView, - networkWidget, - opacity, - outlinedButton, - padding, - pageView, - placeholder, - positioned, - radio, - radioGroup, - refreshIndicator, - row, - safeArea, - scaffold, - setValue, - singleChildScrollView, - sizedBox, - slider, - sliverAppBar, - spacer, - stack, - tab, - tabBar, - tabBarView, - table, - tableCell, - text, - textButton, - textField, - textFormField, - wrap, - visibility, - verticalDivider, -} diff --git a/packages/stac/pubspec_overrides.yaml b/packages/stac/pubspec_overrides.yaml index 0aafb845..fc86afda 100644 --- a/packages/stac/pubspec_overrides.yaml +++ b/packages/stac/pubspec_overrides.yaml @@ -1,4 +1,4 @@ -# melos_managed_dependency_overrides: stac_framework,stac_logger,stac_core +# melos_managed_dependency_overrides: stac_core,stac_framework,stac_logger dependency_overrides: stac_core: path: ../stac_core diff --git a/packages/stac_core/CHANGELOG.md b/packages/stac_core/CHANGELOG.md index 41cc7d81..43d2fd39 100644 --- a/packages/stac_core/CHANGELOG.md +++ b/packages/stac_core/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.1.0 -* TODO: Describe initial release. +- Initial release. Supports core functionalities and common interfaces for Stac. diff --git a/packages/stac_core/LICENSE b/packages/stac_core/LICENSE index ba75c69f..e2649df8 100644 --- a/packages/stac_core/LICENSE +++ b/packages/stac_core/LICENSE @@ -1 +1,21 @@ -TODO: Add your license here. +MIT License + +Copyright (c) 2024 Stac + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/stac_core/README.md b/packages/stac_core/README.md index 4a260d8d..65dbef33 100644 --- a/packages/stac_core/README.md +++ b/packages/stac_core/README.md @@ -1,39 +1,5 @@ - - -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. - -## Features - -TODO: List what your package can do. Maybe include images, gifs, or videos. - -## Getting started - -TODO: List prerequisites and provide or point to information on how to -start using the package. - -## Usage - -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. - -```dart -const like = 'sample'; -``` - -## Additional information - -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more. +This package serves as the foundation for building server-driven UIs with Stac by defining core models, functionalities, and common interfaces that stac package depend upon. \ No newline at end of file diff --git a/packages/stac_core/analysis_options.yaml b/packages/stac_core/analysis_options.yaml index a5744c1c..882376a1 100644 --- a/packages/stac_core/analysis_options.yaml +++ b/packages/stac_core/analysis_options.yaml @@ -2,3 +2,13 @@ include: package:flutter_lints/flutter.yaml # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options + +linter: + rules: + # Documentation rules + public_member_api_docs: true + +analyzer: + exclude: + # Exclude generated files from documentation requirements + - "lib/widgets/icon/stac_icons.dart" diff --git a/packages/stac_core/example/README.md b/packages/stac_core/example/README.md new file mode 100644 index 00000000..3a58d478 --- /dev/null +++ b/packages/stac_core/example/README.md @@ -0,0 +1,7 @@ +# Example + +A pure Dart package that provides the core functionalities and common interfaces for the [Stac](https://pub.dev/packages/stac). + +This package serves as the foundation for building server-driven UIs with Stac by defining core models, functionalities, and common interfaces that stac package depend upon. + +For example please refer to [Stac](https://pub.dev/packages/stac). \ No newline at end of file diff --git a/packages/stac_core/lib/actions/delay/stac_delay_action.dart b/packages/stac_core/lib/actions/delay/stac_delay_action.dart index 90a04fcf..80d80370 100644 --- a/packages/stac_core/lib/actions/delay/stac_delay_action.dart +++ b/packages/stac_core/lib/actions/delay/stac_delay_action.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_delay_action.g.dart'; @@ -18,6 +19,7 @@ part 'stac_delay_action.g.dart'; /// ``` @JsonSerializable() class StacDelayAction extends StacAction { + /// Creates a [StacDelayAction] that waits for a specified duration. const StacDelayAction({this.milliseconds}); /// Delay in milliseconds to wait. @@ -25,9 +27,9 @@ class StacDelayAction extends StacAction { /// Type: `int?` (defaults applied in parser). final int? milliseconds; - /// Unique action type string used for routing. + /// Action type identifier. @override - String get actionType => 'delay'; + String get actionType => ActionType.delay.name; /// Creates a `StacDelayAction` from JSON. factory StacDelayAction.fromJson(Map json) => diff --git a/packages/stac_core/lib/actions/delay/stac_delay_action.g.dart b/packages/stac_core/lib/actions/delay/stac_delay_action.g.dart index be35f878..3d67604f 100644 --- a/packages/stac_core/lib/actions/delay/stac_delay_action.g.dart +++ b/packages/stac_core/lib/actions/delay/stac_delay_action.g.dart @@ -7,9 +7,7 @@ part of 'stac_delay_action.dart'; // ************************************************************************** StacDelayAction _$StacDelayActionFromJson(Map json) => - StacDelayAction( - milliseconds: (json['milliseconds'] as num?)?.toInt() ?? 1000, - ); + StacDelayAction(milliseconds: (json['milliseconds'] as num?)?.toInt()); Map _$StacDelayActionToJson(StacDelayAction instance) => { diff --git a/packages/stac_core/lib/actions/dialog/stac_dialog_action.dart b/packages/stac_core/lib/actions/dialog/stac_dialog_action.dart index 8e9a49ec..2d6cd1d9 100644 --- a/packages/stac_core/lib/actions/dialog/stac_dialog_action.dart +++ b/packages/stac_core/lib/actions/dialog/stac_dialog_action.dart @@ -1,7 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/network_request/stac_network_request.dart'; import 'package:stac_core/core/stac_action.dart'; -import 'package:stac_core/types/stac_dialog_traversal_edge_behavior.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; +import 'package:stac_core/foundation/ui_components/stac_dialog_traversal_edge_behavior.dart'; part 'stac_dialog_action.g.dart'; @@ -26,6 +27,7 @@ part 'stac_dialog_action.g.dart'; /// ``` @JsonSerializable() class StacDialogAction extends StacAction { + /// Creates a [StacDialogAction] that shows a dialog. const StacDialogAction({ this.widget, this.request, @@ -79,7 +81,7 @@ class StacDialogAction extends StacAction { /// Unique action type string used for routing. @override - String get actionType => 'showDialog'; + String get actionType => ActionType.showDialog.name; /// Creates a `StacDialogAction` from JSON. factory StacDialogAction.fromJson(Map json) => diff --git a/packages/stac_core/lib/actions/dialog/stac_dialog_action.g.dart b/packages/stac_core/lib/actions/dialog/stac_dialog_action.g.dart index 463e4bb3..77faff99 100644 --- a/packages/stac_core/lib/actions/dialog/stac_dialog_action.g.dart +++ b/packages/stac_core/lib/actions/dialog/stac_dialog_action.g.dart @@ -15,10 +15,10 @@ StacDialogAction _$StacDialogActionFromJson(Map json) => json['request'] as Map, ), assetPath: json['assetPath'] as String?, - barrierDismissible: json['barrierDismissible'] as bool? ?? true, + barrierDismissible: json['barrierDismissible'] as bool?, barrierColor: json['barrierColor'] as String?, barrierLabel: json['barrierLabel'] as String?, - useSafeArea: json['useSafeArea'] as bool? ?? true, + useSafeArea: json['useSafeArea'] as bool?, traversalEdgeBehavior: $enumDecodeNullable( _$StacDialogTraversalEdgeBehaviorEnumMap, json['traversalEdgeBehavior'], diff --git a/packages/stac_core/lib/actions/form_validate/stac_form_validate.dart b/packages/stac_core/lib/actions/form_validate/stac_form_validate.dart index a88123b9..0b862123 100644 --- a/packages/stac_core/lib/actions/form_validate/stac_form_validate.dart +++ b/packages/stac_core/lib/actions/form_validate/stac_form_validate.dart @@ -1,21 +1,61 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_form_validate.g.dart'; +/// A Stac action that validates form data and executes conditional actions. +/// +/// This action validates the current form state and executes different actions +/// based on whether the form is valid or not. Use [isValid] to specify the +/// action to execute when validation passes, and [isNotValid] for when it fails. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacFormValidate( +/// isValid: StacNavigateAction(routeName: '/success'), +/// isNotValid: StacSnackBarAction(message: 'Please fix errors'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "validateForm", +/// "isValid": { +/// "type": "navigate", +/// "routeName": "/success" +/// }, +/// "isNotValid": { +/// "type": "showSnackBar", +/// "message": "Please fix errors" +/// } +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacFormValidate extends StacAction { + /// Creates a [StacFormValidate] action with conditional execution. const StacFormValidate({this.isValid, this.isNotValid}); + /// Action to execute when form validation passes. final StacAction? isValid; + + /// Action to execute when form validation fails. final StacAction? isNotValid; + /// Action type identifier. @override - String get actionType => 'validateForm'; + String get actionType => ActionType.validateForm.name; + /// Creates a [StacFormValidate] from a JSON map. factory StacFormValidate.fromJson(Map json) => _$StacFormValidateFromJson(json); + /// Converts this [StacFormValidate] instance to a JSON map. @override Map toJson() => _$StacFormValidateToJson(this); } diff --git a/packages/stac_core/lib/actions/get_form_value/stac_get_form_value.dart b/packages/stac_core/lib/actions/get_form_value/stac_get_form_value.dart index ee0a5f94..221b2b3e 100644 --- a/packages/stac_core/lib/actions/get_form_value/stac_get_form_value.dart +++ b/packages/stac_core/lib/actions/get_form_value/stac_get_form_value.dart @@ -1,20 +1,50 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_get_form_value.g.dart'; +/// A Stac action that retrieves the value of a specific form field. +/// +/// This action extracts the current value from a form field identified by [id]. +/// The retrieved value can be used by other actions or stored in the application +/// state for further processing. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacGetFormValue( +/// id: 'email_field', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "getFormValue", +/// "id": "email_field" +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacGetFormValue extends StacAction { + /// Creates a [StacGetFormValue] action to retrieve a form field value. const StacGetFormValue({required this.id}); + /// The unique identifier of the form field to retrieve the value from. final String id; + /// Action type identifier. @override - String get actionType => 'getFormValue'; + String get actionType => ActionType.getFormValue.name; + /// Creates a [StacGetFormValue] from a JSON map. factory StacGetFormValue.fromJson(Map json) => _$StacGetFormValueFromJson(json); + /// Converts this [StacGetFormValue] instance to a JSON map. @override Map toJson() => _$StacGetFormValueToJson(this); } diff --git a/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.dart b/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.dart index 66dc29a3..c4584e37 100644 --- a/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.dart +++ b/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.dart @@ -1,9 +1,10 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/network_request/stac_network_request.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/geometry/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_modal_bottom_sheet_action.g.dart'; @@ -29,6 +30,7 @@ part 'stac_modal_bottom_sheet_action.g.dart'; /// ``` @JsonSerializable() class StacModalBottomSheetAction extends StacAction { + /// Creates a [StacModalBottomSheetAction] that shows a modal bottom sheet. const StacModalBottomSheetAction({ this.widget, this.request, @@ -124,7 +126,7 @@ class StacModalBottomSheetAction extends StacAction { /// Unique action type string used for routing. @override - String get actionType => 'showModalBottomSheet'; + String get actionType => ActionType.showModalBottomSheet.name; /// Creates a `StacModalBottomSheetAction` from JSON. factory StacModalBottomSheetAction.fromJson(Map json) => diff --git a/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.g.dart b/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.g.dart index f60f0e14..7356d05d 100644 --- a/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.g.dart +++ b/packages/stac_core/lib/actions/modal_bottom_sheet/stac_modal_bottom_sheet_action.g.dart @@ -28,12 +28,12 @@ StacModalBottomSheetAction _$StacModalBottomSheetActionFromJson( json['constraints'] as Map, ), barrierColor: json['barrierColor'] as String?, - isScrollControlled: json['isScrollControlled'] as bool? ?? false, - useRootNavigator: json['useRootNavigator'] as bool? ?? false, - isDismissible: json['isDismissible'] as bool? ?? true, - enableDrag: json['enableDrag'] as bool? ?? true, + isScrollControlled: json['isScrollControlled'] as bool?, + useRootNavigator: json['useRootNavigator'] as bool?, + isDismissible: json['isDismissible'] as bool?, + enableDrag: json['enableDrag'] as bool?, showDragHandle: json['showDragHandle'] as bool?, - useSafeArea: json['useSafeArea'] as bool? ?? false, + useSafeArea: json['useSafeArea'] as bool?, ); Map _$StacModalBottomSheetActionToJson( diff --git a/packages/stac_core/lib/actions/multi/stac_multi_action.dart b/packages/stac_core/lib/actions/multi/stac_multi_action.dart index 044d4e2a..23917645 100644 --- a/packages/stac_core/lib/actions/multi/stac_multi_action.dart +++ b/packages/stac_core/lib/actions/multi/stac_multi_action.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_multi_action.g.dart'; @@ -32,6 +33,7 @@ part 'stac_multi_action.g.dart'; /// ``` @JsonSerializable() class StacMultiAction extends StacAction { + /// Creates a [StacMultiAction] that executes multiple actions. const StacMultiAction({required this.actions, this.sync = false}); /// List of child actions to execute. @@ -45,7 +47,7 @@ class StacMultiAction extends StacAction { final bool sync; @override - String get actionType => 'multiAction'; + String get actionType => ActionType.multiAction.name; /// Creates a `StacMultiAction` from JSON. factory StacMultiAction.fromJson(Map json) => diff --git a/packages/stac_core/lib/actions/navigate/stac_navigate_action.dart b/packages/stac_core/lib/actions/navigate/stac_navigate_action.dart index e3439519..a8de0d5a 100644 --- a/packages/stac_core/lib/actions/navigate/stac_navigate_action.dart +++ b/packages/stac_core/lib/actions/navigate/stac_navigate_action.dart @@ -1,22 +1,70 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/network_request/stac_network_request.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_navigate_action.g.dart'; +/// Navigation styles supported by [StacNavigateAction]. +/// +/// These correspond to common Navigator operations in Flutter. enum NavigationStyle { + /// Push a new route onto the stack. push, + + /// Pop the current route. pop, + + /// Replace the current route by pushing a new one and disposing the previous. pushReplacement, + + /// Push a new route and remove all the previous routes. pushAndRemoveAll, + + /// Pop all routes until the first. popAll, + + /// Push a named route. pushNamed, + + /// Push a named route and remove all previous routes. pushNamedAndRemoveAll, + + /// Replace current route with a named route. pushReplacementNamed, } +/// A Stac action that performs navigation operations. +/// +/// Can navigate using a local `widgetJson`, an `assetPath`, a `routeName`, +/// or a `request` that fetches the destination JSON. The [navigationStyle] +/// determines how the navigation is executed. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacNavigateAction( +/// routeName: '/details', +/// navigationStyle: NavigationStyle.pushNamed, +/// arguments: {'id': 42}, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "navigate", +/// "routeName": "/details", +/// "navigationStyle": "pushNamed", +/// "arguments": {"id": 42} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacNavigateAction extends StacAction { + /// Creates a [StacNavigateAction] to navigate based on the provided inputs. const StacNavigateAction({ this.request, this.widgetJson, @@ -27,20 +75,36 @@ class StacNavigateAction extends StacAction { this.arguments, }); + /// Optional network request to load destination widget JSON. final StacNetworkRequest? request; + + /// Inline widget JSON to navigate to. final Map? widgetJson; + + /// Asset path containing widget JSON to navigate to. final String? assetPath; + + /// Named route to push/pop. final String? routeName; + + /// How navigation should be performed. final NavigationStyle? navigationStyle; + + /// A result to pass back when popping. final Map? result; + + /// Arguments to pass to the new route. final Map? arguments; + /// Action type identifier. @override - String get actionType => 'navigate'; + String get actionType => ActionType.navigate.name; + /// Creates a [StacNavigateAction] from a JSON map. factory StacNavigateAction.fromJson(Map json) => _$StacNavigateActionFromJson(json); + /// Converts this [StacNavigateAction] instance to a JSON map. @override Map toJson() => _$StacNavigateActionToJson(this); } diff --git a/packages/stac_core/lib/actions/network_request/stac_network_request.dart b/packages/stac_core/lib/actions/network_request/stac_network_request.dart index aefa5eff..63c60da5 100644 --- a/packages/stac_core/lib/actions/network_request/stac_network_request.dart +++ b/packages/stac_core/lib/actions/network_request/stac_network_request.dart @@ -1,12 +1,80 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_network_request.g.dart'; -enum Method { get, post, put, delete } +/// HTTP methods for [StacNetworkRequest]. +/// +/// Common verbs used for RESTful requests. +enum Method { + /// HTTP GET request. + get, + /// HTTP POST request. + post, + + /// HTTP PUT request. + put, + + /// HTTP DELETE request. + delete, +} + +/// A Stac action that performs HTTP network requests. +/// +/// This action makes HTTP requests to specified URLs and can execute different +/// actions based on the response status code using [results]. Supports all +/// common HTTP methods (GET, POST, PUT, DELETE) and allows customization of +/// headers, query parameters, and request body. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacNetworkRequest( +/// url: 'https://api.example.com/users', +/// method: Method.post, +/// headers: {'Authorization': 'Bearer token123'}, +/// body: {'name': 'John', 'email': 'john@example.com'}, +/// results: [ +/// StacNetworkResult( +/// statusCode: 200, +/// action: {'type': 'navigate', 'routeName': '/success'} +/// ), +/// StacNetworkResult( +/// statusCode: 400, +/// action: {'type': 'showSnackBar', 'message': 'Invalid data'} +/// ), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "networkRequest", +/// "url": "https://api.example.com/users", +/// "method": "post", +/// "headers": {"Authorization": "Bearer token123"}, +/// "body": {"name": "John", "email": "john@example.com"}, +/// "results": [ +/// { +/// "statusCode": 200, +/// "action": {"type": "navigate", "routeName": "/success"} +/// }, +/// { +/// "statusCode": 400, +/// "action": {"type": "showSnackBar", "message": "Invalid data"} +/// } +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacNetworkRequest extends StacAction { + /// Creates a [StacNetworkRequest] to perform an HTTP call. const StacNetworkRequest({ required this.url, this.method = Method.get, @@ -17,33 +85,89 @@ class StacNetworkRequest extends StacAction { this.results = const [], }); + /// The absolute or relative URL to request. final String url; + + /// The HTTP method to use. Defaults to [Method.get]. final Method method; + + /// Optional key-value pairs appended to the URL as query parameters. final Map? queryParameters; + + /// Optional request headers. final Map? headers; + + /// The Content-Type header value (e.g., `application/json`). final String? contentType; + + /// The request payload. Can be a map, list, string, or bytes depending on encoder. final dynamic body; + + /// List of conditional results that map a response status code to an action. final List results; + /// Action type identifier. @override - String get actionType => 'networkRequest'; + String get actionType => ActionType.networkRequest.name; + /// Creates a [StacNetworkRequest] from a JSON map. factory StacNetworkRequest.fromJson(Map json) => _$StacNetworkRequestFromJson(json); + /// Converts this [StacNetworkRequest] instance to a JSON map. @override Map toJson() => _$StacNetworkRequestToJson(this); } +/// A conditional result that maps HTTP status codes to actions. +/// +/// Used with [StacNetworkRequest] to define different actions to execute +/// based on the HTTP response status code. This allows for sophisticated +/// error handling and conditional flows based on network request outcomes. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacNetworkResult( +/// statusCode: 404, +/// action: { +/// 'type': 'showSnackBar', +/// 'message': 'Resource not found' +/// }, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "statusCode": 404, +/// "action": { +/// "type": "showSnackBar", +/// "message": "Resource not found" +/// } +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacNetworkResult { + /// Creates a mapping from an HTTP [statusCode] to an action payload. const StacNetworkResult({required this.statusCode, required this.action}); + /// The HTTP status code to match (e.g., 200, 400, 500). final int statusCode; + + /// The action to execute when [statusCode] matches. + /// + /// This should be a JSON map that describes a Stac action + /// (e.g., `{ "type": "navigate", ... }`). final Map action; + /// Creates a [StacNetworkResult] from a JSON map. factory StacNetworkResult.fromJson(Map json) => _$StacNetworkResultFromJson(json); + /// Converts this [StacNetworkResult] instance to a JSON map. Map toJson() => _$StacNetworkResultToJson(this); } diff --git a/packages/stac_core/lib/actions/set_value/stac_set_value_action.dart b/packages/stac_core/lib/actions/set_value/stac_set_value_action.dart index 5567c8ed..141d56d4 100644 --- a/packages/stac_core/lib/actions/set_value/stac_set_value_action.dart +++ b/packages/stac_core/lib/actions/set_value/stac_set_value_action.dart @@ -1,21 +1,63 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; part 'stac_set_value_action.g.dart'; +/// A Stac action that sets or updates values in state. +/// +/// Accepts a list of key-value maps in [values] to be written to the +/// application's state. Optionally, an [action] can be executed after +/// the values are set. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacSetValueAction( +/// values: [ +/// {"key": "isLoggedIn", "value": true}, +/// {"key": "token", "value": "abc123"}, +/// ], +/// action: {"type": "navigate", "routeName": "/home"}, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "setValue", +/// "values": [ +/// {"key": "isLoggedIn", "value": true}, +/// {"key": "token", "value": "abc123"} +/// ], +/// "action": {"type": "navigate", "routeName": "/home"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacSetValueAction extends StacAction { + /// Creates a [StacSetValueAction] that writes [values] and optionally runs [action]. const StacSetValueAction({this.values, this.action}); + /// A list of maps representing key-value pairs to write to state. + /// + /// Each item should include at least `key` and `value` fields. final List>? values; + + /// An optional action to execute after the values are written. final Map? action; + /// Action type identifier. @override - String get actionType => 'setValue'; + String get actionType => ActionType.setValue.name; + /// Creates a [StacSetValueAction] from a JSON map. factory StacSetValueAction.fromJson(Map json) => _$StacSetValueActionFromJson(json); + /// Converts this [StacSetValueAction] instance to a JSON map. @override Map toJson() => _$StacSetValueActionToJson(this); } diff --git a/packages/stac_core/lib/actions/snack_bar/stac_snack_bar.dart b/packages/stac_core/lib/actions/snack_bar/stac_snack_bar.dart index 1c6ec07b..1144241d 100644 --- a/packages/stac_core/lib/actions/snack_bar/stac_snack_bar.dart +++ b/packages/stac_core/lib/actions/snack_bar/stac_snack_bar.dart @@ -1,13 +1,14 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/snack_bar/stac_snack_bar_action.dart'; import 'package:stac_core/core/stac_action.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_hit_test_behavior.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; -import 'package:stac_core/types/stac_snack_bar_behavior.dart'; -import 'package:stac_core/types/stac_dismiss_direction.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_duration/stac_duration.dart'; +import 'package:stac_core/foundation/animation/stac_duration/stac_duration.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/interaction/stac_hit_test_behavior.dart'; +import 'package:stac_core/foundation/layout/stac_clip.dart'; +import 'package:stac_core/foundation/specifications/action_type.dart'; +import 'package:stac_core/foundation/ui_components/stac_dismiss_direction.dart'; +import 'package:stac_core/foundation/ui_components/stac_snack_bar_behavior.dart'; part 'stac_snack_bar.g.dart'; @@ -34,6 +35,7 @@ part 'stac_snack_bar.g.dart'; /// ``` @JsonSerializable() class StacSnackBar extends StacAction { + /// Creates a [StacSnackBar] that shows a snack bar. const StacSnackBar({ required this.content, this.backgroundColor, @@ -141,7 +143,7 @@ class StacSnackBar extends StacAction { /// Unique action type string used for routing. @override - String get actionType => 'showSnackBar'; + String get actionType => ActionType.showSnackBar.name; /// Creates a `StacSnackBar` from JSON. factory StacSnackBar.fromJson(Map json) => diff --git a/packages/stac_core/lib/actions/snack_bar/stac_snack_bar_action.dart b/packages/stac_core/lib/actions/snack_bar/stac_snack_bar_action.dart index fe08b50f..0fd0a93f 100644 --- a/packages/stac_core/lib/actions/snack_bar/stac_snack_bar_action.dart +++ b/packages/stac_core/lib/actions/snack_bar/stac_snack_bar_action.dart @@ -25,6 +25,7 @@ part 'stac_snack_bar_action.g.dart'; /// ``` @JsonSerializable() class StacSnackBarAction { + /// Creates a [StacSnackBarAction] that shows a snack bar action. const StacSnackBarAction({ this.textColor, this.disabledTextColor, diff --git a/packages/stac_core/lib/core/converters/double_converter.dart b/packages/stac_core/lib/core/converters/double_converter.dart index 16c6da31..b428d7cf 100644 --- a/packages/stac_core/lib/core/converters/double_converter.dart +++ b/packages/stac_core/lib/core/converters/double_converter.dart @@ -9,6 +9,7 @@ import 'package:json_annotation/json_annotation.dart'; /// - null -> null /// - double values -> pass through class DoubleConverter implements JsonConverter { + /// Creates a [DoubleConverter] that converts string values to double. const DoubleConverter(); @override diff --git a/packages/stac_core/lib/core/stac_options.dart b/packages/stac_core/lib/core/stac_options.dart index fa2799c1..cfb37bb2 100644 --- a/packages/stac_core/lib/core/stac_options.dart +++ b/packages/stac_core/lib/core/stac_options.dart @@ -15,6 +15,7 @@ /// ); /// ``` class StacOptions { + /// Creates a [StacOptions] with the given configuration. const StacOptions({ required this.name, this.description, diff --git a/packages/stac_core/lib/core/stac_widget.dart b/packages/stac_core/lib/core/stac_widget.dart index e4427a76..da7dfbe8 100644 --- a/packages/stac_core/lib/core/stac_widget.dart +++ b/packages/stac_core/lib/core/stac_widget.dart @@ -2,6 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; /// Base interface for all STAC elements that can be serialized to JSON abstract class StacElement { + /// Creates a [StacElement] that represents a base element. const StacElement(); /// Converts this element to a JSON map @@ -13,6 +14,7 @@ abstract class StacElement { /// used primarily by JSON converters for deserialization @JsonSerializable() class StacWidget extends StacElement { + /// Creates a [StacWidget] that represents a widget. const StacWidget({this.jsonData}); /// Raw JSON data for this widget diff --git a/packages/stac_core/lib/foundation/alignment/stac_alignment.dart b/packages/stac_core/lib/foundation/alignment/stac_alignment.dart new file mode 100644 index 00000000..e0ffc9ef --- /dev/null +++ b/packages/stac_core/lib/foundation/alignment/stac_alignment.dart @@ -0,0 +1,37 @@ +/// Fixed alignment options that do not adapt to text direction. +/// +/// This enum provides absolute alignment values that remain constant regardless +/// of the text direction (LTR or RTL). Use these values when you need precise +/// positioning that should not change based on locale. +/// +/// For alignment that adapts to text direction, use [StacAlignmentDirectional] +/// instead, which provides `start` and `end` values that automatically adjust +/// for different languages. +enum StacAlignment { + /// Align to the top-left corner. + topLeft, + + /// Align to the top-center. + topCenter, + + /// Align to the top-right corner. + topRight, + + /// Align to the center-left. + centerLeft, + + /// Align to the center. + center, + + /// Align to the center-right. + centerRight, + + /// Align to the bottom-left corner. + bottomLeft, + + /// Align to the bottom-center. + bottomCenter, + + /// Align to the bottom-right corner. + bottomRight, +} diff --git a/packages/stac_core/lib/foundation/alignment/stac_alignment_directional.dart b/packages/stac_core/lib/foundation/alignment/stac_alignment_directional.dart new file mode 100644 index 00000000..83158157 --- /dev/null +++ b/packages/stac_core/lib/foundation/alignment/stac_alignment_directional.dart @@ -0,0 +1,42 @@ +/// Directional alignment options that adapt to text direction. +/// +/// This enum provides alignment values that automatically adjust based on the +/// text direction (LTR or RTL). Use `start` and `end` values instead of `left` +/// and `right` to ensure proper alignment in both left-to-right and right-to-left +/// languages. +/// +/// In LTR languages: +/// - `start` corresponds to `left` +/// - `end` corresponds to `right` +/// +/// In RTL languages: +/// - `start` corresponds to `right` +/// - `end` corresponds to `left` +enum StacAlignmentDirectional { + /// Align to the top-start corner (top-left in LTR, top-right in RTL). + topStart, + + /// Align to the top-center. + topCenter, + + /// Align to the top-end corner (top-right in LTR, top-left in RTL). + topEnd, + + /// Align to the center-start (center-left in LTR, center-right in RTL). + centerStart, + + /// Align to the center. + center, + + /// Align to the center-end (center-right in LTR, center-left in RTL). + centerEnd, + + /// Align to the bottom-start corner (bottom-left in LTR, bottom-right in RTL). + bottomStart, + + /// Align to the bottom-center. + bottomCenter, + + /// Align to the bottom-end corner (bottom-right in LTR, bottom-left in RTL). + bottomEnd, +} diff --git a/packages/stac_core/lib/foundation/alignment/stac_cross_axis_alignment.dart b/packages/stac_core/lib/foundation/alignment/stac_cross_axis_alignment.dart new file mode 100644 index 00000000..8ecdaa6f --- /dev/null +++ b/packages/stac_core/lib/foundation/alignment/stac_cross_axis_alignment.dart @@ -0,0 +1,36 @@ +/// Cross-axis alignment options for flex layouts. +/// +/// Defines how children are aligned along the cross axis in flex layouts +/// such as [Row] and [Column] widgets. The cross axis is perpendicular to +/// the main axis: +/// - In a [Row], the cross axis is vertical (top to bottom) +/// - In a [Column], the cross axis is horizontal (left to right) +/// +/// These values adapt to text direction for `start` and `end` alignments. +enum StacCrossAxisAlignment { + /// Align children to the start of the cross axis. + /// + /// In a [Row]: aligns to the top + /// In a [Column]: aligns to the start edge (left in LTR, right in RTL) + start, + + /// Align children to the end of the cross axis. + /// + /// In a [Row]: aligns to the bottom + /// In a [Column]: aligns to the end edge (right in LTR, left in RTL) + end, + + /// Center children along the cross axis. + center, + + /// Stretch children to fill the cross axis. + /// + /// Children will be sized to match the cross axis dimension of their parent. + stretch, + + /// Align children along their text baseline. + /// + /// Only applicable to widgets that have a text baseline. If a child doesn't + /// have a baseline, it will be aligned using [start] instead. + baseline, +} diff --git a/packages/stac_core/lib/foundation/alignment/stac_main_axis_alignment.dart b/packages/stac_core/lib/foundation/alignment/stac_main_axis_alignment.dart new file mode 100644 index 00000000..c57d7222 --- /dev/null +++ b/packages/stac_core/lib/foundation/alignment/stac_main_axis_alignment.dart @@ -0,0 +1,44 @@ +/// Main-axis alignment options for flex layouts. +/// +/// Defines how children are aligned along the main axis in flex layouts +/// such as [Row] and [Column] widgets. The main axis is the primary direction +/// of the flex layout: +/// - In a [Row], the main axis is horizontal (left to right) +/// - In a [Column], the main axis is vertical (top to bottom) +/// +/// These values adapt to text direction for `start` and `end` alignments. +enum StacMainAxisAlignment { + /// Align children to the start of the main axis. + /// + /// In a [Row]: aligns to the start edge (left in LTR, right in RTL) + /// In a [Column]: aligns to the top + start, + + /// Align children to the end of the main axis. + /// + /// In a [Row]: aligns to the end edge (right in LTR, left in RTL) + /// In a [Column]: aligns to the bottom + end, + + /// Center children along the main axis. + center, + + /// Place children with equal space between them. + /// + /// The first child is placed at the start, the last child at the end, + /// and remaining children are distributed with equal spacing between them. + /// No space is added before the first or after the last child. + spaceBetween, + + /// Place children with equal space around them. + /// + /// Each child gets equal space on both sides. This means the space between + /// children is twice the space at the edges (start and end). + spaceAround, + + /// Place children with equal space between and around them. + /// + /// All gaps (including before the first and after the last child) have + /// equal spacing, creating a uniform distribution. + spaceEvenly, +} diff --git a/packages/stac_core/lib/foundation/alignment/stac_main_axis_size.dart b/packages/stac_core/lib/foundation/alignment/stac_main_axis_size.dart new file mode 100644 index 00000000..9d0d8c18 --- /dev/null +++ b/packages/stac_core/lib/foundation/alignment/stac_main_axis_size.dart @@ -0,0 +1,23 @@ +/// Main-axis sizing options for flex layouts. +/// +/// Defines how much space a flex layout should occupy along its main axis. +/// This affects the overall size of flex containers like [Row] and [Column]: +/// - In a [Row], controls the horizontal space occupied +/// - In a [Column], controls the vertical space occupied +/// +/// Use [min] to minimize space usage and [max] to expand to fill available space. +enum StacMainAxisSize { + /// Minimize the space occupied along the main axis. + /// + /// The flex layout will only take up as much space as needed to fit + /// its children. This is useful when you want the layout to be as + /// compact as possible. + min, + + /// Maximize the space occupied along the main axis. + /// + /// The flex layout will expand to fill all available space along + /// the main axis. This is useful when you want the layout to take + /// up the full width (Row) or height (Column) of its parent. + max, +} diff --git a/packages/stac_core/lib/types/stac_duration/stac_duration.dart b/packages/stac_core/lib/foundation/animation/stac_duration/stac_duration.dart similarity index 100% rename from packages/stac_core/lib/types/stac_duration/stac_duration.dart rename to packages/stac_core/lib/foundation/animation/stac_duration/stac_duration.dart diff --git a/packages/stac_core/lib/types/stac_duration/stac_duration.g.dart b/packages/stac_core/lib/foundation/animation/stac_duration/stac_duration.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_duration/stac_duration.g.dart rename to packages/stac_core/lib/foundation/animation/stac_duration/stac_duration.g.dart diff --git a/packages/stac_core/lib/types/stac_rect_tween/stac_rect_tween.dart b/packages/stac_core/lib/foundation/animation/stac_rect_tween/stac_rect_tween.dart similarity index 92% rename from packages/stac_core/lib/types/stac_rect_tween/stac_rect_tween.dart rename to packages/stac_core/lib/foundation/animation/stac_rect_tween/stac_rect_tween.dart index a58f6936..d48cb6b0 100644 --- a/packages/stac_core/lib/types/stac_rect_tween/stac_rect_tween.dart +++ b/packages/stac_core/lib/foundation/animation/stac_rect_tween/stac_rect_tween.dart @@ -1,5 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/types/stac_rect/stac_rect.dart'; +import 'package:stac_core/foundation/geometry/stac_rect/stac_rect.dart'; part 'stac_rect_tween.g.dart'; diff --git a/packages/stac_core/lib/types/stac_rect_tween/stac_rect_tween.g.dart b/packages/stac_core/lib/foundation/animation/stac_rect_tween/stac_rect_tween.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_rect_tween/stac_rect_tween.g.dart rename to packages/stac_core/lib/foundation/animation/stac_rect_tween/stac_rect_tween.g.dart diff --git a/packages/stac_core/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart b/packages/stac_core/lib/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart similarity index 82% rename from packages/stac_core/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart rename to packages/stac_core/lib/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart index 95ca561f..19801c0d 100644 --- a/packages/stac_core/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; part 'stac_beveled_rectangle_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart diff --git a/packages/stac_core/lib/foundation/borders/stac_border/stac_border.dart b/packages/stac_core/lib/foundation/borders/stac_border/stac_border.dart new file mode 100644 index 00000000..b5037908 --- /dev/null +++ b/packages/stac_core/lib/foundation/borders/stac_border/stac_border.dart @@ -0,0 +1,93 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; + +part 'stac_border.g.dart'; + +/// Border style options for drawing borders. +enum StacBorderStyle { + /// Skip the border. + none, + + /// Draw the border as a solid line. + solid, + + // if you add more, think about how they will lerp +} + +/// A Stac representation of borders for UI elements. +/// +/// This class supports both uniform borders (applied to all sides) and +/// individual side borders with different styling. You can specify global +/// properties or customize each side individually. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacBorder( +/// color: StacColors.blue, +/// borderStyle: StacBorderStyle.solid, +/// width: 2.0, +/// strokeAlign: 0.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#2196F3", +/// "borderStyle": "solid", +/// "width": 2.0, +/// "strokeAlign": 0.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBorder implements StacElement { + /// Creates a border with optional uniform and individual side properties. + const StacBorder({ + this.color, + this.borderStyle, + this.width, + this.strokeAlign, + this.top, + this.right, + this.bottom, + this.left, + }); + + /// The color applied to all sides (when not using individual sides). + final StacColor? color; + + /// The border style applied to all sides (when not using individual sides). + final StacBorderStyle? borderStyle; + + /// The width applied to all sides (when not using individual sides). + final double? width; + + /// The stroke alignment applied to all sides (when not using individual sides). + final double? strokeAlign; + + /// The top border side with individual styling. + final StacBorderSide? top; + + /// The right border side with individual styling. + final StacBorderSide? right; + + /// The bottom border side with individual styling. + final StacBorderSide? bottom; + + /// The left border side with individual styling. + final StacBorderSide? left; + + /// Creates a [StacBorder] from a JSON map. + factory StacBorder.fromJson(Map json) => + _$StacBorderFromJson(json); + + /// Converts this [StacBorder] instance to a JSON map. + @override + Map toJson() => _$StacBorderToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_border/stac_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_border/stac_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_border/stac_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_border/stac_border.g.dart diff --git a/packages/stac_core/lib/foundation/borders/stac_border_radius/stac_border_radius.dart b/packages/stac_core/lib/foundation/borders/stac_border_radius/stac_border_radius.dart new file mode 100644 index 00000000..58ef5d78 --- /dev/null +++ b/packages/stac_core/lib/foundation/borders/stac_border_radius/stac_border_radius.dart @@ -0,0 +1,129 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; + +part 'stac_border_radius.g.dart'; + +/// A Stac representation of border radius for rounded corners. +/// +/// This class defines the radius values for each corner of a rectangular border. +/// It supports various input formats including single values, arrays, and +/// individual corner specifications for flexible JSON configuration. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// // All corners with same radius +/// const StacBorderRadius.all(8.0) +/// +/// // Individual corners +/// const StacBorderRadius( +/// topLeft: 8.0, +/// topRight: 4.0, +/// bottomLeft: 4.0, +/// bottomRight: 8.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Examples: +/// ```json +/// // Single value for all corners +/// 8.0 +/// +/// // Array format [topLeft, topRight, bottomLeft, bottomRight] +/// [8.0, 4.0, 4.0, 8.0] +/// +/// // Object format +/// { +/// "topLeft": 8.0, +/// "topRight": 4.0, +/// "bottomLeft": 4.0, +/// "bottomRight": 8.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBorderRadius implements StacElement { + /// Creates a border radius with optional individual corner values. + /// + /// All parameters are optional and default to null, which means no radius + /// will be applied to that corner. + const StacBorderRadius({ + this.topLeft, + this.topRight, + this.bottomLeft, + this.bottomRight, + }); + + /// Creates a border radius with all corners set to the same value. + const StacBorderRadius.all(double radius) + : this( + topLeft: radius, + topRight: radius, + bottomLeft: radius, + bottomRight: radius, + ); + + /// The radius for the top-left corner in logical pixels. + /// + /// If null, no radius will be applied to this corner. + final double? topLeft; + + /// The radius for the top-right corner in logical pixels. + /// + /// If null, no radius will be applied to this corner. + final double? topRight; + + /// The radius for the bottom-left corner in logical pixels. + /// + /// If null, no radius will be applied to this corner. + final double? bottomLeft; + + /// The radius for the bottom-right corner in logical pixels. + /// + /// If null, no radius will be applied to this corner. + final double? bottomRight; + + /// Creates a [StacBorderRadius] from JSON data. + /// + /// Supports multiple input formats: + /// - A single number: applies to all corners + /// - An array of 4 numbers: [topLeft, topRight, bottomLeft, bottomRight] + /// - An object with individual corner properties + /// + /// Throws [ArgumentError] if the input format is invalid. + factory StacBorderRadius.fromJson(dynamic json) { + Map resultantJson; + + if (json is num) { + resultantJson = { + "topLeft": json, + "topRight": json, + "bottomLeft": json, + "bottomRight": json, + }; + } else if (json is List && json.length == 4) { + bool allElementsNum = json.every((element) => element is num); + if (!allElementsNum) { + throw ArgumentError('Invalid input format for StacEdgeInsets'); + } + resultantJson = { + "topLeft": json[0], + "topRight": json[1], + "bottomLeft": json[2], + "bottomRight": json[3], + }; + } else if (json is Map) { + resultantJson = json; + } else { + throw ArgumentError('Invalid input format for StacEdgeInsets'); + } + + return _$StacBorderRadiusFromJson(resultantJson); + } + + /// Converts this [StacBorderRadius] to a JSON representation. + @override + Map toJson() => _$StacBorderRadiusToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_border_radius/stac_border_radius.g.dart b/packages/stac_core/lib/foundation/borders/stac_border_radius/stac_border_radius.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_border_radius/stac_border_radius.g.dart rename to packages/stac_core/lib/foundation/borders/stac_border_radius/stac_border_radius.g.dart diff --git a/packages/stac_core/lib/foundation/borders/stac_border_side/stac_border_side.dart b/packages/stac_core/lib/foundation/borders/stac_border_side/stac_border_side.dart new file mode 100644 index 00000000..f4b3b5b5 --- /dev/null +++ b/packages/stac_core/lib/foundation/borders/stac_border_side/stac_border_side.dart @@ -0,0 +1,86 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; + +part 'stac_border_side.g.dart'; + +/// A Stac representation of a single border side. +/// +/// This class defines the appearance of one side of a border, including its +/// color, width, stroke alignment, and style. It can be used to create +/// individual border sides for containers and other UI elements. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacBorderSide( +/// color: StacColors.blue, +/// width: 2.0, +/// strokeAlign: 0.0, +/// borderStyle: StacBorderStyle.solid, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#2196F3", +/// "width": 2.0, +/// "strokeAlign": 0.0, +/// "borderStyle": "solid" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBorderSide implements StacElement { + /// Creates a border side with optional styling properties. + /// + /// All parameters are optional and will use default values when not specified. + const StacBorderSide({ + this.color, + this.width, + this.strokeAlign, + this.borderStyle, + }); + + /// The color of the border side. + /// + /// If null, the border will use the default color from the theme. + final StacColor? color; + + /// The width of the border side in logical pixels. + /// + /// If null, the border will use a default width (typically 1.0). + final double? width; + + /// The stroke alignment of the border side. + /// + /// Controls where the border is drawn relative to the edge: + /// - -1.0: Inside the edge + /// - 0.0: Centered on the edge (default) + /// - 1.0: Outside the edge + final double? strokeAlign; + + /// The style of the border side. + /// + /// Determines how the border is rendered (solid, dashed, dotted, etc.). + final StacBorderStyle? borderStyle; + + /// A constant representing no border. + /// + /// This is a convenience constant for creating borders with no visible side. + static const none = StacBorderSide( + width: 0, + borderStyle: StacBorderStyle.none, + ); + + /// Creates a [StacBorderSide] from JSON. + factory StacBorderSide.fromJson(Map json) => + _$StacBorderSideFromJson(json); + + @override + Map toJson() => _$StacBorderSideToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_border_side/stac_border_side.g.dart b/packages/stac_core/lib/foundation/borders/stac_border_side/stac_border_side.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_border_side/stac_border_side.g.dart rename to packages/stac_core/lib/foundation/borders/stac_border_side/stac_border_side.g.dart diff --git a/packages/stac_core/lib/types/stac_circle_border/stac_circle_border.dart b/packages/stac_core/lib/foundation/borders/stac_circle_border/stac_circle_border.dart similarity index 86% rename from packages/stac_core/lib/types/stac_circle_border/stac_circle_border.dart rename to packages/stac_core/lib/foundation/borders/stac_circle_border/stac_circle_border.dart index 96ffb873..8a0cf083 100644 --- a/packages/stac_core/lib/types/stac_circle_border/stac_circle_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_circle_border/stac_circle_border.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; part 'stac_circle_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_circle_border/stac_circle_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_circle_border/stac_circle_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_circle_border/stac_circle_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_circle_border/stac_circle_border.g.dart diff --git a/packages/stac_core/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart b/packages/stac_core/lib/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart similarity index 83% rename from packages/stac_core/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart rename to packages/stac_core/lib/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart index e3c932bf..dcc783d3 100644 --- a/packages/stac_core/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; part 'stac_continuous_rectangle_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart diff --git a/packages/stac_core/lib/types/stac_input_border/stac_input_border.dart b/packages/stac_core/lib/foundation/borders/stac_input_border/stac_input_border.dart similarity index 92% rename from packages/stac_core/lib/types/stac_input_border/stac_input_border.dart rename to packages/stac_core/lib/foundation/borders/stac_input_border/stac_input_border.dart index a20b4289..81d7caf0 100644 --- a/packages/stac_core/lib/types/stac_input_border/stac_input_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_input_border/stac_input_border.dart @@ -1,8 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_gradient/stac_gradient.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/effects/stac_gradient/stac_gradient.dart'; part 'stac_input_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_input_border/stac_input_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_input_border/stac_input_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_input_border/stac_input_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_input_border/stac_input_border.g.dart diff --git a/packages/stac_core/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart b/packages/stac_core/lib/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart similarity index 83% rename from packages/stac_core/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart rename to packages/stac_core/lib/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart index 2ef7bcd8..f1514f9c 100644 --- a/packages/stac_core/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; part 'stac_rounded_rectangle_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart diff --git a/packages/stac_core/lib/types/stac_shape_border/stac_shape_border.dart b/packages/stac_core/lib/foundation/borders/stac_shape_border/stac_shape_border.dart similarity index 80% rename from packages/stac_core/lib/types/stac_shape_border/stac_shape_border.dart rename to packages/stac_core/lib/foundation/borders/stac_shape_border/stac_shape_border.dart index f5d0632c..a8aab36f 100644 --- a/packages/stac_core/lib/types/stac_shape_border/stac_shape_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_shape_border/stac_shape_border.dart @@ -1,15 +1,23 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_circle_border/stac_circle_border.dart'; -import 'package:stac_core/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; -import 'package:stac_core/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; +import 'package:stac_core/foundation/borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_circle_border/stac_circle_border.dart'; +import 'package:stac_core/foundation/borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; +import 'package:stac_core/foundation/borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; +/// Types of shape borders supported by the Stac framework. enum StacShapeBorderType { + /// Circular border shape. circleBorder, + + /// Rounded rectangle border with customizable corner radius. roundedRectangleBorder, + + /// Continuous rectangle border with smooth curves. continuousRectangleBorder, + + /// Beveled rectangle border with angled corners. beveledRectangleBorder, } @@ -34,6 +42,7 @@ enum StacShapeBorderType { /// "side": {"width": 1.0, "color": "#808080"} /// } /// ``` +@JsonSerializable() abstract class StacShapeBorder implements StacElement { /// Creates a [StacShapeBorder] with the given properties. const StacShapeBorder({this.side, required this.type}); diff --git a/packages/stac_core/lib/types/stac_table/stac_table_border.dart b/packages/stac_core/lib/foundation/borders/stac_table_border/stac_table_border.dart similarity index 88% rename from packages/stac_core/lib/types/stac_table/stac_table_border.dart rename to packages/stac_core/lib/foundation/borders/stac_table_border/stac_table_border.dart index bb4452b8..fac5ebf8 100644 --- a/packages/stac_core/lib/types/stac_table/stac_table_border.dart +++ b/packages/stac_core/lib/foundation/borders/stac_table_border/stac_table_border.dart @@ -1,8 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_core/foundation/borders/stac_border/stac_border.dart'; +import 'package:stac_core/foundation/borders/stac_border_radius/stac_border_radius.dart'; part 'stac_table_border.g.dart'; diff --git a/packages/stac_core/lib/types/stac_table/stac_table_border.g.dart b/packages/stac_core/lib/foundation/borders/stac_table_border/stac_table_border.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_table/stac_table_border.g.dart rename to packages/stac_core/lib/foundation/borders/stac_table_border/stac_table_border.g.dart diff --git a/packages/stac_core/lib/foundation/colors/stac_blend_mode.dart b/packages/stac_core/lib/foundation/colors/stac_blend_mode.dart new file mode 100644 index 00000000..279432b9 --- /dev/null +++ b/packages/stac_core/lib/foundation/colors/stac_blend_mode.dart @@ -0,0 +1,93 @@ +/// Blend modes for compositing colors and images. +/// +/// These blend modes determine how colors are combined when drawing +/// one element on top of another. They correspond to the blend modes +/// available in graphics software and CSS. +enum StacBlendMode { + /// Clear the destination pixels, making them transparent. + clear, + + /// Replace destination with source pixels. + src, + + /// Keep only destination pixels. + dst, + + /// Source pixels are drawn over destination pixels (normal blending). + srcOver, + + /// Destination pixels are drawn over source pixels. + dstOver, + + /// Keep source pixels that overlap with destination. + srcIn, + + /// Keep destination pixels that overlap with source. + dstIn, + + /// Keep source pixels that don't overlap with destination. + srcOut, + + /// Keep destination pixels that don't overlap with source. + dstOut, + + /// Source pixels on top of destination, clipped by destination alpha. + srcATop, + + /// Destination pixels on top of source, clipped by source alpha. + dstATop, + + /// Exclusive OR - pixels that don't overlap. + xor, + + /// Add source and destination pixel values. + plus, + + /// Multiply source and destination colors. + modulate, + + /// Screen blend mode - inverted multiply effect. + screen, + + /// Overlay blend mode - combines multiply and screen. + overlay, + + /// Darken blend mode - selects darker colors. + darken, + + /// Lighten blend mode - selects lighter colors. + lighten, + + /// Color dodge blend mode - brightens destination based on source. + colorDodge, + + /// Color burn blend mode - darkens destination based on source. + colorBurn, + + /// Hard light blend mode - combines overlay with stronger contrast. + hardLight, + + /// Soft light blend mode - subtle lighting effect. + softLight, + + /// Difference blend mode - absolute difference between colors. + difference, + + /// Exclusion blend mode - similar to difference but with less contrast. + exclusion, + + /// Multiply blend mode - darker composite. + multiply, + + /// Hue blend mode - uses source hue with destination saturation and luminosity. + hue, + + /// Saturation blend mode - uses source saturation with destination hue and luminosity. + saturation, + + /// Color blend mode - uses source hue and saturation with destination luminosity. + color, + + /// Luminosity blend mode - uses source luminosity with destination hue and saturation. + luminosity, +} diff --git a/packages/stac_core/lib/types/stac_brightness.dart b/packages/stac_core/lib/foundation/colors/stac_brightness.dart similarity index 100% rename from packages/stac_core/lib/types/stac_brightness.dart rename to packages/stac_core/lib/foundation/colors/stac_brightness.dart diff --git a/packages/stac_core/lib/painting/stac_color/stac_colors.dart b/packages/stac_core/lib/foundation/colors/stac_color/stac_colors.dart similarity index 93% rename from packages/stac_core/lib/painting/stac_color/stac_colors.dart rename to packages/stac_core/lib/foundation/colors/stac_color/stac_colors.dart index 82fdd228..015fc120 100644 --- a/packages/stac_core/lib/painting/stac_color/stac_colors.dart +++ b/packages/stac_core/lib/foundation/colors/stac_color/stac_colors.dart @@ -1,5 +1,18 @@ +/// Type alias for Stac color representation as a hex string. +/// +/// Colors in the Stac framework are represented as hex strings (e.g., '#FF0000') +/// or theme color names (e.g., 'primary', 'secondary'). typedef StacColor = String; +/// A collection of predefined colors for the Stac framework. +/// +/// This class provides a comprehensive set of Material Design colors, +/// Material 3 ColorScheme colors, and utility colors that can be used +/// throughout Stac applications. +/// +/// Colors are provided as hex strings with alpha channel support. +/// Theme-based colors (like 'primary', 'secondary') reference the +/// current theme's color scheme. class StacColors { // ========================================== // Basic Colors diff --git a/packages/stac_core/lib/foundation/decoration/stac_box_decoration/stac_box_decoration.dart b/packages/stac_core/lib/foundation/decoration/stac_box_decoration/stac_box_decoration.dart new file mode 100644 index 00000000..fe2ccb97 --- /dev/null +++ b/packages/stac_core/lib/foundation/decoration/stac_box_decoration/stac_box_decoration.dart @@ -0,0 +1,98 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/stac_core.dart'; + +part 'stac_box_decoration.g.dart'; + +/// A Stac representation of box decoration for styling containers. +/// +/// This class provides comprehensive decoration options for boxes including +/// colors, images, borders, shadows, gradients, and shapes. It corresponds +/// to Flutter's BoxDecoration class. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacBoxDecoration( +/// color: StacColors.white, +/// border: StacBorder( +/// color: StacColors.grey, +/// width: 1.0, +/// ), +/// borderRadius: StacBorderRadius.all(8.0), +/// boxShadow: [ +/// StacBoxShadow( +/// color: StacColors.black, +/// blurRadius: 4.0, +/// offset: StacOffset(dx: 0, dy: 2), +/// ), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#FFFFFF", +/// "border": { +/// "color": "#808080", +/// "width": 1.0 +/// }, +/// "borderRadius": {"all": 8.0}, +/// "boxShadow": [{ +/// "color": "#000000", +/// "blurRadius": 4.0, +/// "offset": {"dx": 0, "dy": 2} +/// }] +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBoxDecoration extends StacElement { + /// Creates a box decoration with optional styling properties. + const StacBoxDecoration({ + this.color, + this.image, + this.border, + this.borderRadius, + this.boxShadow, + this.gradient, + this.backgroundBlendMode, + this.shape, + }); + + /// The background color of the box. + final StacColor? color; + + /// A background image for the box. + final StacDecorationImage? image; + + /// The border to draw around the box. + final StacBorder? border; + + /// The border radius for rounded corners. + final StacBorderRadius? borderRadius; + + /// A list of shadows to cast behind the box. + final List? boxShadow; + + /// A gradient to use as the background. + /// + /// If both [color] and [gradient] are specified, the gradient takes precedence. + final StacGradient? gradient; + + /// The blend mode to apply when painting the background color or gradient. + final StacBlendMode? backgroundBlendMode; + + /// The shape of the box (rectangle or circle). + final StacBoxShape? shape; + + /// Creates a [StacBoxDecoration] from a JSON map. + factory StacBoxDecoration.fromJson(Map json) => + _$StacBoxDecorationFromJson(json); + + /// Converts this [StacBoxDecoration] instance to a JSON map. + @override + Map toJson() => _$StacBoxDecorationToJson(this); +} diff --git a/packages/stac_core/lib/painting/stac_box_decoration/stac_box_decoration.g.dart b/packages/stac_core/lib/foundation/decoration/stac_box_decoration/stac_box_decoration.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_box_decoration/stac_box_decoration.g.dart rename to packages/stac_core/lib/foundation/decoration/stac_box_decoration/stac_box_decoration.g.dart diff --git a/packages/stac_core/lib/foundation/decoration/stac_decoration_image/stac_decoration_image.dart b/packages/stac_core/lib/foundation/decoration/stac_decoration_image/stac_decoration_image.dart new file mode 100644 index 00000000..64d0d5df --- /dev/null +++ b/packages/stac_core/lib/foundation/decoration/stac_decoration_image/stac_decoration_image.dart @@ -0,0 +1,98 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/alignment/stac_alignment.dart'; +import 'package:stac_core/foundation/effects/stac_filter_quality.dart'; +import 'package:stac_core/foundation/geometry/stac_rect/stac_rect.dart'; +import 'package:stac_core/foundation/layout/stac_box_fit.dart'; +import 'package:stac_core/foundation/ui_components/stac_image_repeat.dart'; +import 'package:stac_core/foundation/ui_components/stac_image_type.dart'; + +part 'stac_decoration_image.g.dart'; + +/// An image to use as decoration in a box decoration. +/// +/// This class defines how an image should be displayed as part of +/// a box decoration, including positioning, scaling, and rendering options. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacDecorationImage( +/// src: 'assets/background.png', +/// fit: StacBoxFit.cover, +/// alignment: StacAlignment.center, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "src": "assets/background.png", +/// "fit": "cover", +/// "alignment": "center" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacDecorationImage implements StacElement { + /// Creates a decoration image with the specified source and options. + const StacDecorationImage({ + required this.src, + this.fit, + this.imageType, + this.alignment, + this.centerSlice, + this.repeat, + this.matchTextDirection, + this.scale, + this.opacity, + this.filterQuality, + this.invertColors, + this.isAntiAlias, + }); + + /// The source path or URL of the image. + final String src; + + /// How the image should be inscribed into the decoration box. + final StacBoxFit? fit; + + /// The type of image source (asset, network, etc.). + final StacImageType? imageType; + + /// How to align the image within the decoration box. + final StacAlignment? alignment; + + /// The center slice for nine-patch images. + final StacRect? centerSlice; + + /// How the image should be repeated if it doesn't fill the box. + final StacImageRepeat? repeat; + + /// Whether to match the text direction for alignment. + final bool? matchTextDirection; + + /// The scale factor for the image. + final double? scale; + + /// The opacity to apply to the image (0.0 to 1.0). + final double? opacity; + + /// The quality level for image filtering. + final StacFilterQuality? filterQuality; + + /// Whether to invert the colors of the image. + final bool? invertColors; + + /// Whether to use anti-aliasing for the image. + final bool? isAntiAlias; + + /// Creates a [StacDecorationImage] from a JSON map. + factory StacDecorationImage.fromJson(Map json) => + _$StacDecorationImageFromJson(json); + + @override + Map toJson() => _$StacDecorationImageToJson(this); +} diff --git a/packages/stac_core/lib/painting/stac_decoration_image/stac_decoration_image.g.dart b/packages/stac_core/lib/foundation/decoration/stac_decoration_image/stac_decoration_image.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_decoration_image/stac_decoration_image.g.dart rename to packages/stac_core/lib/foundation/decoration/stac_decoration_image/stac_decoration_image.g.dart diff --git a/packages/stac_core/lib/painting/stac_input_decoration/stac_input_decoration.dart b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart similarity index 87% rename from packages/stac_core/lib/painting/stac_input_decoration/stac_input_decoration.dart rename to packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart index a1c430a0..6006a7d3 100644 --- a/packages/stac_core/lib/painting/stac_input_decoration/stac_input_decoration.dart +++ b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.dart @@ -1,6 +1,8 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/painting.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; part 'stac_input_decoration.g.dart'; @@ -35,6 +37,7 @@ part 'stac_input_decoration.g.dart'; /// * Flutter's [InputDecoration documentation](https://api.flutter.dev/flutter/material/InputDecoration-class.html) @JsonSerializable(explicitToJson: true) class StacInputDecoration extends StacElement { + /// Creates an input decoration with the specified properties. const StacInputDecoration({ this.icon, this.labelText, @@ -78,13 +81,18 @@ class StacInputDecoration extends StacElement { /// Text style for [helperText]. final StacTextStyle? helperStyle; + + /// Error text to display below the input field. final String? errorText; /// Text style for [errorText]. final StacTextStyle? errorStyle; /// Optional prefix/suffix widgets and texts. + /// Widget to display before the input content. final StacWidget? prefixIcon; + + /// Optional text to display before the input content. final String? prefixText; /// Text style for [prefixText]. diff --git a/packages/stac_core/lib/painting/stac_input_decoration/stac_input_decoration.g.dart b/packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_input_decoration/stac_input_decoration.g.dart rename to packages/stac_core/lib/foundation/decoration/stac_input_decoration/stac_input_decoration.g.dart diff --git a/packages/stac_core/lib/types/stac_blur_style.dart b/packages/stac_core/lib/foundation/effects/stac_blur_style.dart similarity index 86% rename from packages/stac_core/lib/types/stac_blur_style.dart rename to packages/stac_core/lib/foundation/effects/stac_blur_style.dart index 3eba9e82..985c3bbf 100644 --- a/packages/stac_core/lib/types/stac_blur_style.dart +++ b/packages/stac_core/lib/foundation/effects/stac_blur_style.dart @@ -1,3 +1,6 @@ +/// Blur style options for image filters and effects. +/// +/// These values mirror DlBlurStyle and must be kept in sync. enum StacBlurStyle { // These mirror DlBlurStyle and must be kept in sync. diff --git a/packages/stac_core/lib/types/stac_filter_quality.dart b/packages/stac_core/lib/foundation/effects/stac_filter_quality.dart similarity index 90% rename from packages/stac_core/lib/types/stac_filter_quality.dart rename to packages/stac_core/lib/foundation/effects/stac_filter_quality.dart index 55da9566..79041b66 100644 --- a/packages/stac_core/lib/types/stac_filter_quality.dart +++ b/packages/stac_core/lib/foundation/effects/stac_filter_quality.dart @@ -1,3 +1,7 @@ +/// Filter quality options for image scaling and rendering. +/// +/// This list and the values (order) should be kept in sync with the equivalent list +/// in lib/ui/painting/image_filter.cc enum StacFilterQuality { // This list and the values (order) should be kept in sync with the equivalent list // in lib/ui/painting/image_filter.cc diff --git a/packages/stac_core/lib/foundation/effects/stac_gradient/stac_gradient.dart b/packages/stac_core/lib/foundation/effects/stac_gradient/stac_gradient.dart new file mode 100644 index 00000000..f32d7c86 --- /dev/null +++ b/packages/stac_core/lib/foundation/effects/stac_gradient/stac_gradient.dart @@ -0,0 +1,125 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/foundation/alignment/stac_alignment.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; + +part 'stac_gradient.g.dart'; + +/// Types of gradients supported by the Stac framework. +enum StacGradientType { + /// A linear gradient that transitions colors along a straight line. + linear, + + /// A radial gradient that transitions colors in a circular pattern from center outward. + radial, + + /// A sweep gradient that transitions colors in a circular sweep around a center point. + sweep, +} + +/// Tile modes that determine how gradients handle areas outside their defined bounds. +enum StacTileMode { + /// Clamp the gradient to the edge colors. + clamp, + + /// Repeat the gradient pattern. + repeated, + + /// Mirror the gradient pattern. + mirror, + + /// Use transparent pixels outside the gradient bounds. + decal, +} + +/// A Stac representation of gradients for visual effects. +/// +/// This class supports linear, radial, and sweep gradients with customizable +/// colors, stops, and positioning. Gradients can be used for backgrounds, +/// text styling, and other visual effects. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacGradient( +/// gradientType: StacGradientType.linear, +/// colors: [StacColors.blue, StacColors.red], +/// stops: [0.0, 1.0], +/// begin: StacAlignment.topLeft, +/// end: StacAlignment.bottomRight, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "gradientType": "linear", +/// "colors": ["#2196F3", "#F44336"], +/// "stops": [0.0, 1.0], +/// "begin": "topLeft", +/// "end": "bottomRight" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacGradient { + /// Creates a gradient with optional configuration parameters. + const StacGradient({ + this.gradientType, + this.colors, + this.stops, + this.begin, + this.end, + this.center, + this.focal, + this.tileMode, + this.focalRadius, + this.radius, + this.startAngle, + this.endAngle, + }); + + /// The type of gradient (linear, radial, or sweep). + final StacGradientType? gradientType; + + /// The list of colors used in the gradient. + final List? colors; + + /// The stop positions for each color (values between 0.0 and 1.0). + final List? stops; + + /// The starting alignment for linear gradients. + final StacAlignment? begin; + + /// The ending alignment for linear gradients. + final StacAlignment? end; + + /// The center alignment for radial and sweep gradients. + final StacAlignment? center; + + /// The focal point alignment for radial gradients. + final StacAlignment? focal; + + /// How the gradient should handle areas outside its bounds. + final StacTileMode? tileMode; + + /// The radius of the focal point for radial gradients. + final double? focalRadius; + + /// The radius for radial gradients. + final double? radius; + + /// The starting angle for sweep gradients (in radians). + final double? startAngle; + + /// The ending angle for sweep gradients (in radians). + final double? endAngle; + + /// Creates a [StacGradient] from a JSON map. + factory StacGradient.fromJson(Map json) => + _$StacGradientFromJson(json); + + /// Converts this [StacGradient] instance to a JSON map. + Map toJson() => _$StacGradientToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_gradient/stac_gradient.g.dart b/packages/stac_core/lib/foundation/effects/stac_gradient/stac_gradient.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_gradient/stac_gradient.g.dart rename to packages/stac_core/lib/foundation/effects/stac_gradient/stac_gradient.g.dart diff --git a/packages/stac_core/lib/types/stac_image_filter/stac_image_filter.dart b/packages/stac_core/lib/foundation/effects/stac_image_filter/stac_image_filter.dart similarity index 70% rename from packages/stac_core/lib/types/stac_image_filter/stac_image_filter.dart rename to packages/stac_core/lib/foundation/effects/stac_image_filter/stac_image_filter.dart index bf90e99b..dd5f6244 100644 --- a/packages/stac_core/lib/types/stac_image_filter/stac_image_filter.dart +++ b/packages/stac_core/lib/foundation/effects/stac_image_filter/stac_image_filter.dart @@ -3,8 +3,25 @@ import 'package:stac_core/core/converters/double_converter.dart'; part 'stac_image_filter.g.dart'; -/// Enum of supported image filter constructors (shader not supported). -enum StacImageFilterType { blur, matrix, dilate, erode, compose } +/// Types of image filters supported by the Stac framework. +/// +/// Note: Shader filters are not currently supported. +enum StacImageFilterType { + /// Gaussian blur filter that blurs the image. + blur, + + /// Matrix transformation filter that applies a 4x4 transformation matrix. + matrix, + + /// Dilate filter that expands bright areas of the image. + dilate, + + /// Erode filter that contracts bright areas of the image. + erode, + + /// Compose filter that combines two filters sequentially. + compose, +} /// A Stac model representing Flutter's ImageFilter. /// @@ -22,6 +39,7 @@ enum StacImageFilterType { blur, matrix, dilate, erode, compose } /// ``` @JsonSerializable(explicitToJson: true) class StacImageFilter { + /// Creates an image filter with the specified type and parameters. const StacImageFilter({ required this.type, this.sigmaX, @@ -70,21 +88,38 @@ class StacImageFilter { required StacImageFilter outer, }) : this(type: StacImageFilterType.compose, inner: inner, outer: outer); + /// The type of image filter to apply. final StacImageFilterType type; + /// Standard deviation for blur in the horizontal direction. @DoubleConverter() final double? sigmaX; + + /// Standard deviation for blur in the vertical direction. @DoubleConverter() final double? sigmaY; + + /// Horizontal radius for dilate/erode filters. @DoubleConverter() final double? radiusX; + + /// Vertical radius for dilate/erode filters. @DoubleConverter() final double? radiusY; + + /// 4x4 transformation matrix for matrix filters (length 16). final List? matrix; + + /// Inner filter for compose operations (applied first). final StacImageFilter? inner; + + /// Outer filter for compose operations (applied second). final StacImageFilter? outer; + /// Creates a [StacImageFilter] from a JSON map. factory StacImageFilter.fromJson(Map json) => _$StacImageFilterFromJson(json); + + /// Converts this [StacImageFilter] instance to a JSON map. Map toJson() => _$StacImageFilterToJson(this); } diff --git a/packages/stac_core/lib/types/stac_image_filter/stac_image_filter.g.dart b/packages/stac_core/lib/foundation/effects/stac_image_filter/stac_image_filter.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_image_filter/stac_image_filter.g.dart rename to packages/stac_core/lib/foundation/effects/stac_image_filter/stac_image_filter.g.dart diff --git a/packages/stac_core/lib/foundation/effects/stac_shadow/stac_shadow.dart b/packages/stac_core/lib/foundation/effects/stac_shadow/stac_shadow.dart new file mode 100644 index 00000000..ff198730 --- /dev/null +++ b/packages/stac_core/lib/foundation/effects/stac_shadow/stac_shadow.dart @@ -0,0 +1,60 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/converters/double_converter.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/geometry/stac_offset/stac_offset.dart'; + +part 'stac_shadow.g.dart'; + +/// A Stac representation of shadows for visual effects. +/// +/// This class defines shadow properties including color, offset, and blur radius. +/// Shadows can be applied to various UI elements to create depth and visual hierarchy. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacShadow( +/// color: '#000000', +/// offset: StacOffset(2.0, 4.0), +/// blurRadius: 6.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#000000", +/// "offset": {"dx": 2.0, "dy": 4.0}, +/// "blurRadius": 6.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacShadow implements StacElement { + /// Creates a shadow with optional color, offset, and blur radius. + const StacShadow({this.color, this.offset, this.blurRadius}); + + /// The shadow color as hex string or theme color name. + /// + /// Examples: '#FF0000', 'red', 'primary' + final String? color; + + /// The offset position of the shadow relative to the element. + final StacOffset? offset; + + /// The blur radius of the shadow in logical pixels. + /// + /// A larger value creates a more diffused shadow effect. + @DoubleConverter() + final double? blurRadius; + + /// Creates a [StacShadow] from a JSON map. + factory StacShadow.fromJson(Map json) => + _$StacShadowFromJson(json); + + /// Converts this [StacShadow] instance to a JSON map. + @override + Map toJson() => _$StacShadowToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_shadow/stac_shadow.g.dart b/packages/stac_core/lib/foundation/effects/stac_shadow/stac_shadow.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_shadow/stac_shadow.g.dart rename to packages/stac_core/lib/foundation/effects/stac_shadow/stac_shadow.g.dart diff --git a/packages/stac_core/lib/types/stac_autovalidate_mode.dart b/packages/stac_core/lib/foundation/forms/stac_autovalidate_mode.dart similarity index 100% rename from packages/stac_core/lib/types/stac_autovalidate_mode.dart rename to packages/stac_core/lib/foundation/forms/stac_autovalidate_mode.dart diff --git a/packages/stac_core/lib/types/stac_form_field_validator/stac_form_field_validator.dart b/packages/stac_core/lib/foundation/forms/stac_form_field_validator/stac_form_field_validator.dart similarity index 91% rename from packages/stac_core/lib/types/stac_form_field_validator/stac_form_field_validator.dart rename to packages/stac_core/lib/foundation/forms/stac_form_field_validator/stac_form_field_validator.dart index b7bed7af..701fd058 100644 --- a/packages/stac_core/lib/types/stac_form_field_validator/stac_form_field_validator.dart +++ b/packages/stac_core/lib/foundation/forms/stac_form_field_validator/stac_form_field_validator.dart @@ -9,6 +9,7 @@ part 'stac_form_field_validator.g.dart'; /// when the validation fails. @JsonSerializable() class StacFormFieldValidator extends StacElement { + /// Creates a form field validator with the specified rule and optional message. const StacFormFieldValidator({required this.rule, this.message}); /// Identifier of the validation logic to apply. diff --git a/packages/stac_core/lib/types/stac_form_field_validator/stac_form_field_validator.g.dart b/packages/stac_core/lib/foundation/forms/stac_form_field_validator/stac_form_field_validator.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_form_field_validator/stac_form_field_validator.g.dart rename to packages/stac_core/lib/foundation/forms/stac_form_field_validator/stac_form_field_validator.g.dart diff --git a/packages/stac_core/lib/types/stac_input_formatter/stac_input_formatter.dart b/packages/stac_core/lib/foundation/forms/stac_input_formatter/stac_input_formatter.dart similarity index 83% rename from packages/stac_core/lib/types/stac_input_formatter/stac_input_formatter.dart rename to packages/stac_core/lib/foundation/forms/stac_input_formatter/stac_input_formatter.dart index 0695d572..3b3a38a6 100644 --- a/packages/stac_core/lib/types/stac_input_formatter/stac_input_formatter.dart +++ b/packages/stac_core/lib/foundation/forms/stac_input_formatter/stac_input_formatter.dart @@ -9,6 +9,7 @@ part 'stac_input_formatter.g.dart'; /// as the user types. @JsonSerializable() class StacInputFormatter extends StacElement { + /// Creates an input formatter with the specified type and optional rule. const StacInputFormatter({required this.type, this.rule}); /// Formatter behavior: allow or deny based on a regular expression rule. @@ -26,7 +27,10 @@ class StacInputFormatter extends StacElement { Map toJson() => _$StacInputFormatterToJson(this); } +/// Input formatter behavior types for text field validation. +/// /// Mirrors the behavior of `InputFormatterType` used by platform formatters. +/// Determines whether characters matching a regex pattern should be allowed or denied. enum StacInputFormatterType { /// Allow characters that match the provided regex [rule]. allow, diff --git a/packages/stac_core/lib/types/stac_input_formatter/stac_input_formatter.g.dart b/packages/stac_core/lib/foundation/forms/stac_input_formatter/stac_input_formatter.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_input_formatter/stac_input_formatter.g.dart rename to packages/stac_core/lib/foundation/forms/stac_input_formatter/stac_input_formatter.g.dart diff --git a/packages/stac_core/lib/types/stac_max_length_enforcement.dart b/packages/stac_core/lib/foundation/forms/stac_max_length_enforcement.dart similarity index 100% rename from packages/stac_core/lib/types/stac_max_length_enforcement.dart rename to packages/stac_core/lib/foundation/forms/stac_max_length_enforcement.dart diff --git a/packages/stac_core/lib/types/stac_text_input_types.dart b/packages/stac_core/lib/foundation/forms/stac_text_input_types.dart similarity index 100% rename from packages/stac_core/lib/types/stac_text_input_types.dart rename to packages/stac_core/lib/foundation/forms/stac_text_input_types.dart diff --git a/packages/stac_core/lib/foundation/foundation.dart b/packages/stac_core/lib/foundation/foundation.dart new file mode 100644 index 00000000..a2f01ee0 --- /dev/null +++ b/packages/stac_core/lib/foundation/foundation.dart @@ -0,0 +1,107 @@ +library; + +// Alignment and positioning +export 'alignment/stac_alignment.dart'; +export 'alignment/stac_alignment_directional.dart'; +export 'alignment/stac_cross_axis_alignment.dart'; +export 'alignment/stac_main_axis_alignment.dart'; +export 'alignment/stac_main_axis_size.dart'; +// Animation and timing +export 'animation/stac_duration/stac_duration.dart'; +export 'animation/stac_rect_tween/stac_rect_tween.dart'; +// Borders and shapes +export 'borders/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; +export 'borders/stac_border/stac_border.dart'; +export 'borders/stac_border_radius/stac_border_radius.dart'; +export 'borders/stac_border_side/stac_border_side.dart'; +export 'borders/stac_circle_border/stac_circle_border.dart'; +export 'borders/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; +export 'borders/stac_input_border/stac_input_border.dart'; +export 'borders/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; +export 'borders/stac_shape_border/stac_shape_border.dart'; +export 'borders/stac_table_border/stac_table_border.dart'; +// Colors and appearance +export 'colors/stac_blend_mode.dart'; +export 'colors/stac_brightness.dart'; +export 'colors/stac_color/stac_colors.dart'; +// Decoration and styling +export 'decoration/stac_box_decoration/stac_box_decoration.dart'; +export 'decoration/stac_decoration_image/stac_decoration_image.dart'; +export 'decoration/stac_input_decoration/stac_input_decoration.dart'; +// Effects and filters +export 'effects/stac_blur_style.dart'; +export 'effects/stac_filter_quality.dart'; +export 'effects/stac_gradient/stac_gradient.dart'; +export 'effects/stac_image_filter/stac_image_filter.dart'; +export 'effects/stac_shadow/stac_shadow.dart'; +// Forms and input +export 'forms/stac_autovalidate_mode.dart'; +export 'forms/stac_form_field_validator/stac_form_field_validator.dart'; +export 'forms/stac_input_formatter/stac_input_formatter.dart'; +export 'forms/stac_max_length_enforcement.dart'; +export 'forms/stac_text_input_types.dart'; +// Geometry and measurements +export 'geometry/stac_box_constraints/stac_box_constraints.dart'; +export 'geometry/stac_box_shadow/stac_box_shadow.dart'; +export 'geometry/stac_edge_insets/stac_edge_insets.dart'; +export 'geometry/stac_offset/stac_offset.dart'; +export 'geometry/stac_rect/stac_rect.dart'; +export 'geometry/stac_size/stac_size.dart'; +export 'geometry/stac_visual_density/stac_visual_density.dart'; +// Interaction and behavior +export 'interaction/stac_drag_start_behavior.dart'; +export 'interaction/stac_hit_test_behavior.dart'; +export 'interaction/stac_mouse_cursor.dart'; +export 'interaction/stac_scroll_physics.dart'; +export 'interaction/stac_scroll_view_keyboard_dismiss_behavior.dart'; +// Layout and positioning +export 'layout/stac_axis.dart'; +export 'layout/stac_box_fit.dart'; +export 'layout/stac_box_shape.dart'; +export 'layout/stac_clip.dart'; +export 'layout/stac_flex_fit.dart'; +export 'layout/stac_stack_fit.dart'; +export 'layout/stac_vertical_direction.dart'; +export 'layout/stac_wrap_alignment.dart'; +export 'layout/stac_wrap_cross_alignment.dart'; +// Navigation and routing +export 'navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart'; +export 'navigation/stac_floating_action_button_location.dart'; +export 'navigation/stac_floating_action_button_type.dart'; +export 'navigation/stac_tab_alignment.dart'; +export 'navigation/stac_tab_bar_indicator_size.dart'; +// Specifications +export 'specifications/action_type.dart'; +export 'specifications/widget_type.dart'; +// Text and typography +export 'text/stac_font_weight.dart'; +export 'text/stac_smart_dashes_type.dart'; +export 'text/stac_smart_quotes_type.dart'; +export 'text/stac_stroke_cap.dart'; +export 'text/stac_text_span/stac_text_span.dart'; +export 'text/stac_text_style/stac_text_style.dart'; +export 'text/stac_text_types.dart'; +// Theme and styling +export 'theme/stac_button_style/stac_button_style.dart'; +export 'theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; +// UI components and behavior +export 'ui_components/stac_carousel_view_type.dart'; +export 'ui_components/stac_dialog_traversal_edge_behavior.dart'; +export 'ui_components/stac_dismiss_direction.dart'; +export 'ui_components/stac_dropdown_menu_close_behavior.dart'; +export 'ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; +export 'ui_components/stac_icon_type.dart'; +export 'ui_components/stac_image_repeat.dart'; +export 'ui_components/stac_image_type.dart'; +export 'ui_components/stac_list_tile_style.dart'; +export 'ui_components/stac_list_tile_title_alignment.dart'; +export 'ui_components/stac_options_view_open_direction.dart'; +export 'ui_components/stac_overflow_bar_alignment.dart'; +export 'ui_components/stac_radio_type.dart'; +export 'ui_components/stac_refresh_indicator_trigger_mode.dart'; +export 'ui_components/stac_slider_interaction.dart'; +export 'ui_components/stac_slider_type.dart'; +export 'ui_components/stac_snack_bar_behavior.dart'; +export 'ui_components/stac_switch_type.dart'; +export 'ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; +export 'ui_components/stac_table_column_width/stac_table_column_width.dart'; diff --git a/packages/stac_core/lib/foundation/geometry/stac_box_constraints/stac_box_constraints.dart b/packages/stac_core/lib/foundation/geometry/stac_box_constraints/stac_box_constraints.dart new file mode 100644 index 00000000..25187c44 --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_box_constraints/stac_box_constraints.dart @@ -0,0 +1,67 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/converters/double_converter.dart'; + +part 'stac_box_constraints.g.dart'; + +/// A Stac representation of box constraints for layout sizing. +/// +/// This class defines the minimum and maximum width and height constraints +/// that can be applied to widgets during layout. It helps control how widgets +/// size themselves within their available space. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacBoxConstraints( +/// minWidth: 100, +/// maxWidth: 300, +/// minHeight: 50, +/// maxHeight: 200, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "minWidth": 100, +/// "maxWidth": 300, +/// "minHeight": 50, +/// "maxHeight": 200 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBoxConstraints { + /// Creates box constraints with optional minimum and maximum dimensions. + const StacBoxConstraints({ + this.minWidth, + this.maxWidth, + this.minHeight, + this.maxHeight, + }); + + /// The minimum width constraint in logical pixels. + @DoubleConverter() + final double? minWidth; + + /// The maximum width constraint in logical pixels. + @DoubleConverter() + final double? maxWidth; + + /// The minimum height constraint in logical pixels. + @DoubleConverter() + final double? minHeight; + + /// The maximum height constraint in logical pixels. + @DoubleConverter() + final double? maxHeight; + + /// Creates a [StacBoxConstraints] from a JSON map. + factory StacBoxConstraints.fromJson(Map json) => + _$StacBoxConstraintsFromJson(json); + + /// Converts this [StacBoxConstraints] instance to a JSON map. + Map toJson() => _$StacBoxConstraintsToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_box_constraints/stac_box_constraints.g.dart b/packages/stac_core/lib/foundation/geometry/stac_box_constraints/stac_box_constraints.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_box_constraints/stac_box_constraints.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_box_constraints/stac_box_constraints.g.dart diff --git a/packages/stac_core/lib/foundation/geometry/stac_box_shadow/stac_box_shadow.dart b/packages/stac_core/lib/foundation/geometry/stac_box_shadow/stac_box_shadow.dart new file mode 100644 index 00000000..b24dee3c --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_box_shadow/stac_box_shadow.dart @@ -0,0 +1,80 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/converters/double_converter.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/effects/stac_blur_style.dart'; +import 'package:stac_core/foundation/geometry/stac_offset/stac_offset.dart'; + +part 'stac_box_shadow.g.dart'; + +/// A Stac representation of box shadows for visual depth effects. +/// +/// This class defines shadow properties that can be applied to containers +/// and other UI elements to create depth and visual hierarchy. It supports +/// color, blur radius, offset, spread radius, and blur style customization. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacBoxShadow( +/// color: StacColors.black, +/// blurRadius: 10.0, +/// offset: StacOffset(dx: 2.0, dy: 4.0), +/// spreadRadius: 1.0, +/// blurStyle: StacBlurStyle.normal, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "color": "#000000", +/// "blurRadius": 10.0, +/// "offset": {"dx": 2.0, "dy": 4.0}, +/// "spreadRadius": 1.0, +/// "blurStyle": "normal" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacBoxShadow implements StacElement { + /// Creates a box shadow with optional styling properties. + const StacBoxShadow({ + this.color, + this.blurRadius, + this.offset, + this.spreadRadius, + this.blurStyle, + }); + + /// The color of the shadow. + final StacColor? color; + + /// The blur radius of the shadow in logical pixels. + /// + /// A larger value creates a more diffused shadow effect. + @DoubleConverter() + final double? blurRadius; + + /// The offset position of the shadow relative to the element. + final StacOffset? offset; + + /// The spread radius of the shadow in logical pixels. + /// + /// Positive values cause the shadow to expand, negative values cause it to contract. + @DoubleConverter() + final double? spreadRadius; + + /// The style of blur to apply to the shadow. + final StacBlurStyle? blurStyle; + + /// Creates a [StacBoxShadow] from a JSON map. + factory StacBoxShadow.fromJson(Map json) => + _$StacBoxShadowFromJson(json); + + /// Converts this [StacBoxShadow] instance to a JSON map. + @override + Map toJson() => _$StacBoxShadowToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_box_shadow/stac_box_shadow.g.dart b/packages/stac_core/lib/foundation/geometry/stac_box_shadow/stac_box_shadow.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_box_shadow/stac_box_shadow.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_box_shadow/stac_box_shadow.g.dart diff --git a/packages/stac_core/lib/foundation/geometry/stac_edge_insets/stac_edge_insets.dart b/packages/stac_core/lib/foundation/geometry/stac_edge_insets/stac_edge_insets.dart new file mode 100644 index 00000000..aa6dcb5c --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_edge_insets/stac_edge_insets.dart @@ -0,0 +1,127 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; + +part 'stac_edge_insets.g.dart'; + +/// A Stac representation of edge insets for padding and margins. +/// +/// This class defines spacing around the edges of a widget. It supports various +/// input formats including single values, arrays, and individual edge specifications +/// for flexible JSON configuration. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// // All edges with same value +/// const StacEdgeInsets.all(16.0) +/// +/// // Individual edges +/// const StacEdgeInsets( +/// left: 8.0, +/// top: 16.0, +/// right: 8.0, +/// bottom: 16.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Examples: +/// ```json +/// // Single value for all edges +/// 16.0 +/// +/// // Array format [left, top, right, bottom] +/// [8.0, 16.0, 8.0, 16.0] +/// +/// // Object format +/// { +/// "left": 8.0, +/// "top": 16.0, +/// "right": 8.0, +/// "bottom": 16.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacEdgeInsets extends StacElement { + /// Creates edge insets with optional individual edge values. + const StacEdgeInsets({this.left, this.top, this.right, this.bottom}); + + /// The left edge inset in logical pixels. + final double? left; + + /// The top edge inset in logical pixels. + final double? top; + + /// The right edge inset in logical pixels. + final double? right; + + /// The bottom edge inset in logical pixels. + final double? bottom; + + /// Creates edge insets with the same value for all edges. + const StacEdgeInsets.all(double value) + : this(left: value, top: value, right: value, bottom: value); + + /// Creates edge insets with only specified edges set. + const StacEdgeInsets.only({this.left, this.top, this.right, this.bottom}); + + /// Creates edge insets with symmetric horizontal and vertical values. + const StacEdgeInsets.symmetric({double? vertical, double? horizontal}) + : this( + left: horizontal, + top: vertical, + right: horizontal, + bottom: vertical, + ); + + /// Creates edge insets with only horizontal (left and right) values. + const StacEdgeInsets.horizontal(double value) + : this.symmetric(horizontal: value); + + /// Creates edge insets with only vertical (top and bottom) values. + const StacEdgeInsets.vertical(double value) : this.symmetric(vertical: value); + + /// Creates a [StacEdgeInsets] from dynamic JSON input. + /// + /// Supports multiple input formats: + /// - A single number: applies to all edges + /// - An array of 4 numbers: [left, top, right, bottom] + /// - An object with individual edge properties + /// + /// Throws [ArgumentError] if the input format is invalid. + factory StacEdgeInsets.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) { + bool allElementsNum = json.every((element) => element is num); + if (!allElementsNum) { + throw ArgumentError('Invalid input format for StacEdgeInsets'); + } + 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 StacEdgeInsets'); + } + + return _$StacEdgeInsetsFromJson(resultantJson); + } + + /// Converts this [StacEdgeInsets] instance to a JSON map. + @override + Map toJson() => _$StacEdgeInsetsToJson(this); +} diff --git a/packages/stac_core/lib/painting/stac_edge_insets/stac_edge_insets.g.dart b/packages/stac_core/lib/foundation/geometry/stac_edge_insets/stac_edge_insets.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_edge_insets/stac_edge_insets.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_edge_insets/stac_edge_insets.g.dart diff --git a/packages/stac_core/lib/foundation/geometry/stac_offset/stac_offset.dart b/packages/stac_core/lib/foundation/geometry/stac_offset/stac_offset.dart new file mode 100644 index 00000000..c30fbdb1 --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_offset/stac_offset.dart @@ -0,0 +1,49 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; + +part 'stac_offset.g.dart'; + +/// A Stac representation of a 2D offset (displacement). +/// +/// This class represents a displacement in 2D space with horizontal (dx) and +/// vertical (dy) components. It's commonly used for positioning elements, +/// defining shadow offsets, or specifying translation transformations. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacOffset(dx: 10.0, dy: 20.0) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "dx": 10.0, +/// "dy": 20.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacOffset implements StacElement { + /// Creates an offset with the specified horizontal and vertical displacements. + const StacOffset({required this.dx, required this.dy}); + + /// A constant representing zero offset (no displacement). + static const StacOffset zero = StacOffset(dx: 0, dy: 0); + + /// The horizontal displacement in logical pixels. + final double dx; + + /// The vertical displacement in logical pixels. + final double dy; + + /// Creates a [StacOffset] from a JSON map. + factory StacOffset.fromJson(Map json) => + _$StacOffsetFromJson(json); + + /// Converts this [StacOffset] instance to a JSON map. + @override + Map toJson() => _$StacOffsetToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_offset/stac_offset.g.dart b/packages/stac_core/lib/foundation/geometry/stac_offset/stac_offset.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_offset/stac_offset.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_offset/stac_offset.g.dart diff --git a/packages/stac_core/lib/foundation/geometry/stac_rect/stac_rect.dart b/packages/stac_core/lib/foundation/geometry/stac_rect/stac_rect.dart new file mode 100644 index 00000000..1f0222db --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_rect/stac_rect.dart @@ -0,0 +1,122 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/converters/double_converter.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/geometry/stac_offset/stac_offset.dart'; + +part 'stac_rect.g.dart'; + +/// Types of rectangle construction methods supported by StacRect. +enum StacRectType { + /// Create a rectangle from center point and dimensions. + fromCenter, + + /// Create a rectangle from a circle's bounding box. + fromCircle, + + /// Create a rectangle from left, top, right, bottom coordinates. + fromLTRB, + + /// Create a rectangle from left, top, width, height values. + fromLTWH, + + /// Create a rectangle from two corner points. + fromPoints, +} + +/// A Stac representation of rectangles for geometric operations. +/// +/// This class supports multiple construction methods for creating rectangles, +/// including from coordinates, dimensions, center points, and circles. +/// Different construction types use different parameter combinations. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// // Rectangle from coordinates +/// StacRect( +/// rectType: StacRectType.fromLTRB, +/// left: 10.0, +/// top: 20.0, +/// right: 100.0, +/// bottom: 80.0, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "rectType": "fromLTRB", +/// "left": 10.0, +/// "top": 20.0, +/// "right": 100.0, +/// "bottom": 80.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacRect implements StacElement { + /// Creates a rectangle using the specified construction method and parameters. + StacRect({ + required this.rectType, + this.left, + this.top, + this.right, + this.bottom, + this.width, + this.height, + this.center, + this.radius, + this.a, + this.b, + }); + + /// The method used to construct this rectangle. + final StacRectType rectType; + + /// The left coordinate (used with fromLTRB, fromLTWH). + @DoubleConverter() + final double? left; + + /// The top coordinate (used with fromLTRB, fromLTWH). + @DoubleConverter() + final double? top; + + /// The right coordinate (used with fromLTRB). + @DoubleConverter() + final double? right; + + /// The bottom coordinate (used with fromLTRB). + @DoubleConverter() + final double? bottom; + + /// The width (used with fromLTWH, fromCenter). + @DoubleConverter() + final double? width; + + /// The height (used with fromLTWH, fromCenter). + @DoubleConverter() + final double? height; + + /// The center point (used with fromCenter, fromCircle). + final StacOffset? center; + + /// The radius (used with fromCircle). + @DoubleConverter() + final double? radius; + + /// The first corner point (used with fromPoints). + final StacOffset? a; + + /// The second corner point (used with fromPoints). + final StacOffset? b; + + /// Creates a [StacRect] from a JSON map. + factory StacRect.fromJson(Map json) => + _$StacRectFromJson(json); + + /// Converts this [StacRect] instance to a JSON map. + @override + Map toJson() => _$StacRectToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_rect/stac_rect.g.dart b/packages/stac_core/lib/foundation/geometry/stac_rect/stac_rect.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_rect/stac_rect.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_rect/stac_rect.g.dart diff --git a/packages/stac_core/lib/foundation/geometry/stac_size/stac_size.dart b/packages/stac_core/lib/foundation/geometry/stac_size/stac_size.dart new file mode 100644 index 00000000..86678dea --- /dev/null +++ b/packages/stac_core/lib/foundation/geometry/stac_size/stac_size.dart @@ -0,0 +1,45 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; + +part 'stac_size.g.dart'; + +/// A Stac representation of a 2D size with width and height. +/// +/// This class represents dimensions in 2D space, commonly used for specifying +/// the size of widgets, images, or other UI elements. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacSize(100.0, 200.0) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "width": 100.0, +/// "height": 200.0 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacSize implements StacElement { + /// Creates a size with the specified width and height. + const StacSize(this.width, this.height); + + /// The width in logical pixels. + final double width; + + /// The height in logical pixels. + final double height; + + /// Creates a [StacSize] from a JSON map. + factory StacSize.fromJson(Map json) => + _$StacSizeFromJson(json); + + /// Converts this [StacSize] instance to a JSON map. + @override + Map toJson() => _$StacSizeToJson(this); +} diff --git a/packages/stac_core/lib/types/stac_size/stac_size.g.dart b/packages/stac_core/lib/foundation/geometry/stac_size/stac_size.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_size/stac_size.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_size/stac_size.g.dart diff --git a/packages/stac_core/lib/types/stac_visual_density/stac_visual_density.dart b/packages/stac_core/lib/foundation/geometry/stac_visual_density/stac_visual_density.dart similarity index 100% rename from packages/stac_core/lib/types/stac_visual_density/stac_visual_density.dart rename to packages/stac_core/lib/foundation/geometry/stac_visual_density/stac_visual_density.dart diff --git a/packages/stac_core/lib/types/stac_visual_density/stac_visual_density.g.dart b/packages/stac_core/lib/foundation/geometry/stac_visual_density/stac_visual_density.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_visual_density/stac_visual_density.g.dart rename to packages/stac_core/lib/foundation/geometry/stac_visual_density/stac_visual_density.g.dart diff --git a/packages/stac_core/lib/foundation/interaction/stac_drag_start_behavior.dart b/packages/stac_core/lib/foundation/interaction/stac_drag_start_behavior.dart new file mode 100644 index 00000000..d676b9c0 --- /dev/null +++ b/packages/stac_core/lib/foundation/interaction/stac_drag_start_behavior.dart @@ -0,0 +1,18 @@ +/// Behavior options for when drag operations should start. +/// +/// This enum controls when a drag gesture begins tracking and how the initial +/// position is determined during drag operations. +enum StacDragStartBehavior { + /// Set the initial offset at the position where the first down event was + /// detected. + /// + /// The drag will start immediately when the pointer is pressed down. + down, + + /// Set the initial position at the position where this gesture recognizer + /// won the arena. + /// + /// The drag will start when the gesture recognizer wins the gesture arena, + /// which may be after some movement has occurred. + start, +} diff --git a/packages/stac_core/lib/types/stac_hit_test_behavior.dart b/packages/stac_core/lib/foundation/interaction/stac_hit_test_behavior.dart similarity index 100% rename from packages/stac_core/lib/types/stac_hit_test_behavior.dart rename to packages/stac_core/lib/foundation/interaction/stac_hit_test_behavior.dart diff --git a/packages/stac_core/lib/foundation/interaction/stac_mouse_cursor.dart b/packages/stac_core/lib/foundation/interaction/stac_mouse_cursor.dart new file mode 100644 index 00000000..6bf41f3d --- /dev/null +++ b/packages/stac_core/lib/foundation/interaction/stac_mouse_cursor.dart @@ -0,0 +1,114 @@ +/// Mouse cursor styles that can be applied to interactive elements. +/// +/// This enum provides a comprehensive set of cursor styles for different +/// interaction states and contexts, from basic pointer cursors to specialized +/// resize and action cursors. +enum StacMouseCursor { + /// No cursor (invisible). + none, + + /// Basic arrow cursor (default). + basic, + + /// Pointing hand cursor for clickable elements. + click, + + /// Forbidden/not-allowed cursor. + forbidden, + + /// Wait/busy cursor (spinning wheel). + wait, + + /// Progress cursor showing ongoing operation. + progress, + + /// Context menu cursor. + contextMenu, + + /// Help cursor (question mark). + help, + + /// Text selection cursor (I-beam). + text, + + /// Vertical text selection cursor. + verticalText, + + /// Cell selection cursor (crosshair). + cell, + + /// Precise selection cursor. + precise, + + /// Move cursor (four-way arrows). + move, + + /// Grab cursor (open hand). + grab, + + /// Grabbing cursor (closed hand). + grabbing, + + /// No drop cursor (crossed out). + noDrop, + + /// Alias/shortcut cursor. + alias, + + /// Copy cursor. + copy, + + /// Disappearing cursor. + disappearing, + + /// All-scroll cursor (arrows in all directions). + allScroll, + + /// Horizontal resize cursor (left-right arrows). + resizeLeftRight, + + /// Vertical resize cursor (up-down arrows). + resizeUpDown, + + /// Diagonal resize cursor (up-left to down-right). + resizeUpLeftDownRight, + + /// Diagonal resize cursor (up-right to down-left). + resizeUpRightDownLeft, + + /// Resize up cursor. + resizeUp, + + /// Resize down cursor. + resizeDown, + + /// Resize left cursor. + resizeLeft, + + /// Resize right cursor. + resizeRight, + + /// Resize up-left cursor. + resizeUpLeft, + + /// Resize up-right cursor. + resizeUpRight, + + /// Resize down-left cursor. + resizeDownLeft, + + /// Resize down-right cursor. + resizeDownRight, + + /// Column resize cursor. + resizeColumn, + + /// Row resize cursor. + resizeRow, + + /// Zoom in cursor (magnifying glass with plus). + zoomIn, + + /// Zoom out cursor (magnifying glass with minus). + zoomOut, +} diff --git a/packages/stac_core/lib/types/stac_scroll_physics.dart b/packages/stac_core/lib/foundation/interaction/stac_scroll_physics.dart similarity index 100% rename from packages/stac_core/lib/types/stac_scroll_physics.dart rename to packages/stac_core/lib/foundation/interaction/stac_scroll_physics.dart diff --git a/packages/stac_core/lib/types/stac_scroll_view_keyboard_dismiss_behavior.dart b/packages/stac_core/lib/foundation/interaction/stac_scroll_view_keyboard_dismiss_behavior.dart similarity index 100% rename from packages/stac_core/lib/types/stac_scroll_view_keyboard_dismiss_behavior.dart rename to packages/stac_core/lib/foundation/interaction/stac_scroll_view_keyboard_dismiss_behavior.dart diff --git a/packages/stac_core/lib/foundation/layout/stac_axis.dart b/packages/stac_core/lib/foundation/layout/stac_axis.dart new file mode 100644 index 00000000..e9ac0a4e --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_axis.dart @@ -0,0 +1,14 @@ +/// Axis direction options for layout widgets. +/// +/// Defines the main axis direction for flex layouts like Row and Column. +enum StacAxis { + /// Horizontal axis (left to right). + /// + /// Used by Row widgets where children are arranged horizontally. + horizontal, + + /// Vertical axis (top to bottom). + /// + /// Used by Column widgets where children are arranged vertically. + vertical, +} diff --git a/packages/stac_core/lib/types/stac_box_fit.dart b/packages/stac_core/lib/foundation/layout/stac_box_fit.dart similarity index 100% rename from packages/stac_core/lib/types/stac_box_fit.dart rename to packages/stac_core/lib/foundation/layout/stac_box_fit.dart diff --git a/packages/stac_core/lib/types/stac_box_shape.dart b/packages/stac_core/lib/foundation/layout/stac_box_shape.dart similarity index 82% rename from packages/stac_core/lib/types/stac_box_shape.dart rename to packages/stac_core/lib/foundation/layout/stac_box_shape.dart index bca1784c..fa5fbfe3 100644 --- a/packages/stac_core/lib/types/stac_box_shape.dart +++ b/packages/stac_core/lib/foundation/layout/stac_box_shape.dart @@ -1,3 +1,7 @@ +/// Shape options for boxes and containers. +/// +/// Defines the overall shape that a box should take when rendering +/// borders, shadows, and other decorative elements. enum StacBoxShape { /// An axis-aligned rectangle, optionally with rounded corners. /// diff --git a/packages/stac_core/lib/types/stac_clip.dart b/packages/stac_core/lib/foundation/layout/stac_clip.dart similarity index 92% rename from packages/stac_core/lib/types/stac_clip.dart rename to packages/stac_core/lib/foundation/layout/stac_clip.dart index 7d6159dc..2bb84aea 100644 --- a/packages/stac_core/lib/types/stac_clip.dart +++ b/packages/stac_core/lib/foundation/layout/stac_clip.dart @@ -1,3 +1,7 @@ +/// Clipping options for widgets that may overflow their bounds. +/// +/// Different clipping modes offer trade-offs between performance and visual quality. +/// Choose the appropriate mode based on your specific needs and performance requirements. enum StacClip { /// No clip at all. /// diff --git a/packages/stac_core/lib/foundation/layout/stac_flex_fit.dart b/packages/stac_core/lib/foundation/layout/stac_flex_fit.dart new file mode 100644 index 00000000..3ec55245 --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_flex_fit.dart @@ -0,0 +1,17 @@ +/// Flex fit options for flexible widgets. +/// +/// Determines how a flexible child should fit within the available space +/// along the main axis of a flex layout. +enum StacFlexFit { + /// The child is forced to fill the available space. + /// + /// The child will be exactly the size of the available space, + /// regardless of its intrinsic dimensions. + tight, + + /// The child can be at most as large as the available space. + /// + /// The child will use its intrinsic dimensions up to the maximum + /// available space, but won't be forced to fill it. + loose, +} diff --git a/packages/stac_core/lib/foundation/layout/stac_stack_fit.dart b/packages/stac_core/lib/foundation/layout/stac_stack_fit.dart new file mode 100644 index 00000000..f5f20f39 --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_stack_fit.dart @@ -0,0 +1,20 @@ +/// Sizing options for Stack widget children. +/// +/// Controls how non-positioned children of a Stack widget should be sized +/// relative to the Stack's own size. +enum StacStackFit { + /// Children are sized to their intrinsic dimensions. + /// + /// Non-positioned children can be smaller than the Stack. + loose, + + /// Children are forced to match the Stack's size. + /// + /// Non-positioned children will be the same size as the Stack. + expand, + + /// Children inherit constraints from the Stack's parent. + /// + /// The Stack's constraints are passed through to its children. + passthrough, +} diff --git a/packages/stac_core/lib/foundation/layout/stac_vertical_direction.dart b/packages/stac_core/lib/foundation/layout/stac_vertical_direction.dart new file mode 100644 index 00000000..1eca6f8d --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_vertical_direction.dart @@ -0,0 +1,10 @@ +/// Vertical direction options for layout widgets. +/// +/// Determines the direction in which children are laid out vertically. +enum StacVerticalDirection { + /// Children are laid out from bottom to top. + up, + + /// Children are laid out from top to bottom (default). + down, +} diff --git a/packages/stac_core/lib/foundation/layout/stac_wrap_alignment.dart b/packages/stac_core/lib/foundation/layout/stac_wrap_alignment.dart new file mode 100644 index 00000000..9b670525 --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_wrap_alignment.dart @@ -0,0 +1,32 @@ +/// Alignment options for Wrap widget children. +/// +/// Determines how wrapped children are aligned within each run (line) +/// of the wrap layout. +enum StacWrapAlignment { + /// Align children to the start of each run. + start, + + /// Align children to the end of each run. + end, + + /// Center children within each run. + center, + + /// Place equal space between children in each run. + /// + /// The first child is at the start, the last child is at the end, + /// and remaining children are evenly distributed between them. + spaceBetween, + + /// Place equal space around each child in each run. + /// + /// Each child gets equal space on both sides, making the space + /// between children twice the space at the edges. + spaceAround, + + /// Place equal space between and around children in each run. + /// + /// All gaps (including before the first and after the last child) + /// have equal spacing. + spaceEvenly, +} diff --git a/packages/stac_core/lib/foundation/layout/stac_wrap_cross_alignment.dart b/packages/stac_core/lib/foundation/layout/stac_wrap_cross_alignment.dart new file mode 100644 index 00000000..6f688e0b --- /dev/null +++ b/packages/stac_core/lib/foundation/layout/stac_wrap_cross_alignment.dart @@ -0,0 +1,14 @@ +/// Cross-axis alignment options for Wrap widget runs. +/// +/// Determines how runs (lines) of wrapped children are aligned along +/// the cross axis of the wrap layout. +enum StacWrapCrossAlignment { + /// Align runs to the start of the cross axis. + start, + + /// Align runs to the end of the cross axis. + end, + + /// Center runs along the cross axis. + center, +} diff --git a/packages/stac_core/lib/types/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart b/packages/stac_core/lib/foundation/navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart similarity index 100% rename from packages/stac_core/lib/types/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart rename to packages/stac_core/lib/foundation/navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart diff --git a/packages/stac_core/lib/types/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart b/packages/stac_core/lib/foundation/navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart rename to packages/stac_core/lib/foundation/navigation/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.g.dart diff --git a/packages/stac_core/lib/foundation/navigation/stac_floating_action_button_location.dart b/packages/stac_core/lib/foundation/navigation/stac_floating_action_button_location.dart new file mode 100644 index 00000000..a4adc306 --- /dev/null +++ b/packages/stac_core/lib/foundation/navigation/stac_floating_action_button_location.dart @@ -0,0 +1,61 @@ +/// Floating action button positioning options. +/// +/// Defines where a floating action button should be positioned within +/// a scaffold. Locations can be at the top, floating, or docked to the +/// bottom app bar, and can be positioned at start, center, or end. +/// Mini variants use a smaller button size. +enum StacFloatingActionButtonLocation { + /// Standard FAB at the start-top position. + startTop, + + /// Mini FAB at the start-top position. + miniStartTop, + + /// Standard FAB at the center-top position. + centerTop, + + /// Mini FAB at the center-top position. + miniCenterTop, + + /// Standard FAB at the end-top position. + endTop, + + /// Mini FAB at the end-top position. + miniEndTop, + + /// Standard FAB floating at the start position. + startFloat, + + /// Mini FAB floating at the start position. + miniStartFloat, + + /// Standard FAB floating at the center position. + centerFloat, + + /// Mini FAB floating at the center position. + miniCenterFloat, + + /// Standard FAB floating at the end position. + endFloat, + + /// Mini FAB floating at the end position. + miniEndFloat, + + /// Standard FAB docked at the start of the bottom app bar. + startDocked, + + /// Mini FAB docked at the start of the bottom app bar. + miniStartDocked, + + /// Standard FAB docked at the center of the bottom app bar. + centerDocked, + + /// Mini FAB docked at the center of the bottom app bar. + miniCenterDocked, + + /// Standard FAB docked at the end of the bottom app bar. + endDocked, + + /// Mini FAB docked at the end of the bottom app bar. + miniEndDocked, +} diff --git a/packages/stac_core/lib/types/stac_floating_action_button_type.dart b/packages/stac_core/lib/foundation/navigation/stac_floating_action_button_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_floating_action_button_type.dart rename to packages/stac_core/lib/foundation/navigation/stac_floating_action_button_type.dart diff --git a/packages/stac_core/lib/types/stac_tab_alignment.dart b/packages/stac_core/lib/foundation/navigation/stac_tab_alignment.dart similarity index 100% rename from packages/stac_core/lib/types/stac_tab_alignment.dart rename to packages/stac_core/lib/foundation/navigation/stac_tab_alignment.dart diff --git a/packages/stac_core/lib/types/stac_tab_bar_indicator_size.dart b/packages/stac_core/lib/foundation/navigation/stac_tab_bar_indicator_size.dart similarity index 100% rename from packages/stac_core/lib/types/stac_tab_bar_indicator_size.dart rename to packages/stac_core/lib/foundation/navigation/stac_tab_bar_indicator_size.dart diff --git a/packages/stac_core/lib/foundation/specifications/action_type.dart b/packages/stac_core/lib/foundation/specifications/action_type.dart new file mode 100644 index 00000000..af115ec4 --- /dev/null +++ b/packages/stac_core/lib/foundation/specifications/action_type.dart @@ -0,0 +1,38 @@ +/// Enumeration of all supported action types in the Stac framework. +/// +/// The enum value's `.name` is typically used in JSON to reference the action +/// type when describing interactions and behaviors. +enum ActionType { + /// Navigate to another route, page, or location. + navigate, + + /// No operation; useful as a placeholder. + none, + + /// Perform a network request (e.g., HTTP call). + networkRequest, + + /// Display a modal bottom sheet. + showModalBottomSheet, + + /// Display a dialog. + showDialog, + + /// Retrieve a value from the current form state. + getFormValue, + + /// Validate the current form state. + validateForm, + + /// Show a transient message via a SnackBar. + showSnackBar, + + /// Set or update a value in state. + setValue, + + /// Execute multiple actions in sequence. + multiAction, + + /// Wait for a specified duration before proceeding. + delay, +} diff --git a/packages/stac_core/lib/foundation/specifications/widget_type.dart b/packages/stac_core/lib/foundation/specifications/widget_type.dart new file mode 100644 index 00000000..00b3bb38 --- /dev/null +++ b/packages/stac_core/lib/foundation/specifications/widget_type.dart @@ -0,0 +1,245 @@ +/// Enumeration of all supported widget types in the Stac framework. +/// +/// The enum value's `.name` is used as the JSON `type` field for +/// identifying widgets during parsing and serialization. +enum WidgetType { + /// Alert dialog widget + alertDialog, + + /// Align widget + align, + + /// App bar widget + appBar, + + /// Aspect ratio widget + aspectRatio, + + /// Autocomplete widget + autocomplete, + + /// Backdrop filter widget + backdropFilter, + + /// Bottom navigation bar widget + bottomNavigationBar, + + /// Bottom navigation view widget + bottomNavigationView, + + /// Card widget + card, + + /// Carousel view widget + carouselView, + + /// Center widget + center, + + /// Check box widget + checkBox, + + /// Chip widget + chip, + + /// Clip oval widget + clipOval, + + /// Clip rounded rectangle widget + clipRRect, + + /// Circle avatar widget + circleAvatar, + + /// Circular progress indicator widget + circularProgressIndicator, + + /// Colored box widget + coloredBox, + + /// Column widget + column, + + /// Conditional widget + conditional, + + /// Container widget + container, + + /// Drawer widget + drawer, + + /// Dropdown menu widget + dropdownMenu, + + /// Custom scroll view widget + customScrollView, + + /// Default bottom navigation controller widget + defaultBottomNavigationController, + + /// Default tab controller widget + defaultTabController, + + /// Divider widget + divider, + + /// Dynamic view widget + dynamicView, + + /// Elevated button widget + elevatedButton, + + /// Expanded widget + expanded, + + /// Filled button widget + filledButton, + + /// Fitted box widget + fittedBox, + + /// Flexible widget + flexible, + + /// Floating action button widget + floatingActionButton, + + /// Form widget + form, + + /// Form field widget + formField, + + /// Fractionally sized box widget + fractionallySizedBox, + + /// Gesture detector widget + gestureDetector, + + /// Grid view widget + gridView, + + /// Hero widget + hero, + + /// Icon widget + icon, + + /// Icon button widget + iconButton, + + /// Image widget + image, + + /// Ink well widget + inkWell, + + /// Limited box widget + limitedBox, + + /// Linear progress indicator widget + linearProgressIndicator, + + /// List tile widget + listTile, + + /// List view widget + listView, + + /// Network widget + networkWidget, + + /// Opacity widget + opacity, + + /// Outlined button widget + outlinedButton, + + /// Padding widget + padding, + + /// Page view widget + pageView, + + /// Placeholder widget + placeholder, + + /// Positioned widget + positioned, + + /// Radio widget + radio, + + /// Radio group widget + radioGroup, + + /// Refresh indicator widget + refreshIndicator, + + /// Row widget + row, + + /// Safe area widget + safeArea, + + /// Scaffold widget + scaffold, + + /// Set value action/widget + setValue, + + /// Single child scroll view widget + singleChildScrollView, + + /// Sized box widget + sizedBox, + + /// Slider widget + slider, + + /// Sliver app bar widget + sliverAppBar, + + /// Spacer widget + spacer, + + /// Stack widget + stack, + + /// Tab widget + tab, + + /// Tab bar widget + tabBar, + + /// Tab bar view widget + tabBarView, + + /// Table widget + table, + + /// Table cell widget + tableCell, + + /// Text widget + text, + + /// Text button widget + textButton, + + /// Text field widget + textField, + + /// Text form field widget + textFormField, + + /// Wrap widget + wrap, + + /// Visibility widget + visibility, + + /// Vertical divider widget + verticalDivider, +} diff --git a/packages/stac_core/lib/types/stac_font_weight.dart b/packages/stac_core/lib/foundation/text/stac_font_weight.dart similarity index 100% rename from packages/stac_core/lib/types/stac_font_weight.dart rename to packages/stac_core/lib/foundation/text/stac_font_weight.dart diff --git a/packages/stac_core/lib/types/stac_smart_dashes_type.dart b/packages/stac_core/lib/foundation/text/stac_smart_dashes_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_smart_dashes_type.dart rename to packages/stac_core/lib/foundation/text/stac_smart_dashes_type.dart diff --git a/packages/stac_core/lib/types/stac_smart_quotes_type.dart b/packages/stac_core/lib/foundation/text/stac_smart_quotes_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_smart_quotes_type.dart rename to packages/stac_core/lib/foundation/text/stac_smart_quotes_type.dart diff --git a/packages/stac_core/lib/types/stac_stroke_cap.dart b/packages/stac_core/lib/foundation/text/stac_stroke_cap.dart similarity index 100% rename from packages/stac_core/lib/types/stac_stroke_cap.dart rename to packages/stac_core/lib/foundation/text/stac_stroke_cap.dart diff --git a/packages/stac_core/lib/foundation/text/stac_text_span/stac_text_span.dart b/packages/stac_core/lib/foundation/text/stac_text_span/stac_text_span.dart new file mode 100644 index 00000000..b3619d5d --- /dev/null +++ b/packages/stac_core/lib/foundation/text/stac_text_span/stac_text_span.dart @@ -0,0 +1,60 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; + +part 'stac_text_span.g.dart'; + +/// A Stac representation of an immutable span of text. +/// +/// This class defines a piece of text with associated styling and +/// optional child spans for rich text formatting. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacTextSpan( +/// text: 'Hello ', +/// style: StacTextStyle(fontWeight: StacFontWeight.bold), +/// children: [ +/// StacTextSpan(text: 'World', style: StacTextStyle(color: StacColors.blue)), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "text": "Hello ", +/// "style": {"fontWeight": "bold"}, +/// "children": [ +/// {"text": "World", "style": {"color": "#2196F3"}} +/// ] +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacTextSpan implements StacElement { + /// Creates a text span with optional text, style, children, and tap handler. + StacTextSpan({this.text, this.style, this.children = const [], this.onTap}); + + /// The text content of this span. + final String? text; + + /// The style to apply to the text in this span. + final StacTextStyle? style; + + /// Additional text spans to include as children. + final List children; + + /// Action to perform when this text span is tapped. + final Map? onTap; + + @override + Map toJson() => _$StacTextSpanToJson(this); + + /// Creates a [StacTextSpan] from a JSON map. + factory StacTextSpan.fromJson(Map json) => + _$StacTextSpanFromJson(json); +} diff --git a/packages/stac_core/lib/painting/stac_text_span/stac_text_span.g.dart b/packages/stac_core/lib/foundation/text/stac_text_span/stac_text_span.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_text_span/stac_text_span.g.dart rename to packages/stac_core/lib/foundation/text/stac_text_span/stac_text_span.g.dart diff --git a/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart b/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart new file mode 100644 index 00000000..12e1a537 --- /dev/null +++ b/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.dart @@ -0,0 +1,124 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/text/stac_text_types.dart'; + +part 'stac_text_style.g.dart'; + +/// A Stac representation of text styling properties. +/// +/// This class defines the visual appearance of text including font, +/// color, spacing, decoration, and other typography properties. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacTextStyle( +/// fontSize: 16.0, +/// fontWeight: StacFontWeight.bold, +/// color: StacColors.blue, +/// letterSpacing: 1.2, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "fontSize": 16.0, +/// "fontWeight": "bold", +/// "color": "#2196F3", +/// "letterSpacing": 1.2 +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacTextStyle extends StacElement { + /// Creates a text style with the specified properties. + StacTextStyle({ + this.inherit, + this.color, + this.backgroundColor, + this.fontSize, + this.fontWeight, + this.fontStyle, + this.letterSpacing, + this.wordSpacing, + this.textBaseline, + this.height, + this.leadingDistribution, + this.decorationColor, + this.decorationStyle, + this.decorationThickness, + this.debugLabel, + this.fontFamily, + this.fontFamilyFallback, + this.package, + this.overflow, + }); + + /// Whether to inherit text style properties from the parent. + bool? inherit; + + /// The color of the text. + StacColor? color; + + /// The background color of the text. + StacColor? backgroundColor; + + /// The size of the font in logical pixels. + double? fontSize; + + /// The weight (boldness) of the font. + StacFontWeight? fontWeight; + + /// The style (normal or italic) of the font. + StacFontStyle? fontStyle; + + /// The amount of space between characters. + double? letterSpacing; + + /// The amount of space between words. + double? wordSpacing; + + /// The baseline for aligning text. + StacTextBaseline? textBaseline; + + /// The line height as a multiple of the font size. + double? height; + + /// How the leading (line height) is distributed. + StacTextLeadingDistribution? leadingDistribution; + + /// The color of text decorations (underline, overline, etc.). + StacColor? decorationColor; + + /// The style of text decorations. + StacTextDecorationStyle? decorationStyle; + + /// The thickness of text decorations. + double? decorationThickness; + + /// A debug label for this text style. + String? debugLabel; + + /// The name of the font family to use. + String? fontFamily; + + /// A list of font family names to fall back to. + List? fontFamilyFallback; + + /// The package containing the font family. + String? package; + + /// How text overflow should be handled. + StacTextOverflow? overflow; + + /// Creates a [StacTextStyle] from a JSON map. + factory StacTextStyle.fromJson(Map json) => + _$StacTextStyleFromJson(json); + + @override + Map toJson() => _$StacTextStyleToJson(this); +} diff --git a/packages/stac_core/lib/painting/stac_text_style/stac_text_style.g.dart b/packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_text_style/stac_text_style.g.dart rename to packages/stac_core/lib/foundation/text/stac_text_style/stac_text_style.g.dart diff --git a/packages/stac_core/lib/foundation/text/stac_text_types.dart b/packages/stac_core/lib/foundation/text/stac_text_types.dart new file mode 100644 index 00000000..50be7ce6 --- /dev/null +++ b/packages/stac_core/lib/foundation/text/stac_text_types.dart @@ -0,0 +1,134 @@ +/// Text alignment options for text widgets. +enum StacTextAlign { + /// Align text to the left edge. + left, + + /// Align text to the right edge. + right, + + /// Center text horizontally. + center, + + /// Justify text to fill the available width. + justify, + + /// Align text to the start edge (left in LTR, right in RTL). + start, + + /// Align text to the end edge (right in LTR, left in RTL). + end, +} + +/// Text direction options for text layout. +enum StacTextDirection { + /// Right-to-left text direction (Arabic, Hebrew). + rtl, + + /// Left-to-right text direction (English, most languages). + ltr, +} + +/// Text overflow handling options when text doesn't fit. +enum StacTextOverflow { + /// Clip the overflowing text. + clip, + + /// Fade the overflowing text to transparent. + fade, + + /// Show ellipsis (...) for overflowing text. + ellipsis, + + /// Allow text to overflow and be visible. + visible, +} + +/// Text width calculation basis options. +enum StacTextWidthBasis { + /// Use the parent widget's width constraints. + parent, + + /// Use the width of the longest line of text. + longestLine, +} + +/// Text baseline options for vertical text alignment. +enum StacTextBaseline { + /// Alphabetic baseline (used by Latin scripts). + alphabetic, + + /// Ideographic baseline (used by East Asian scripts). + ideographic, +} + +/// Font weight options for text styling. +enum StacFontWeight { + /// Thin weight (100). + w100, + + /// Extra light weight (200). + w200, + + /// Light weight (300). + w300, + + /// Normal weight (400). + w400, + + /// Medium weight (500). + w500, + + /// Semi-bold weight (600). + w600, + + /// Bold weight (700). + w700, + + /// Extra bold weight (800). + w800, + + /// Black weight (900). + w900, + + /// Normal font weight (equivalent to w400). + normal, + + /// Bold font weight (equivalent to w700). + bold, +} + +/// Font style options for text styling. +enum StacFontStyle { + /// Normal upright text. + normal, + + /// Italicized slanted text. + italic, +} + +/// Text leading (line height) distribution options. +enum StacTextLeadingDistribution { + /// Distribute leading proportionally above and below text. + proportional, + + /// Distribute leading evenly above and below text. + even, +} + +/// Text decoration style options for underlines, overlines, etc. +enum StacTextDecorationStyle { + /// Solid line decoration. + solid, + + /// Double line decoration. + double, + + /// Dotted line decoration. + dotted, + + /// Dashed line decoration. + dashed, + + /// Wavy line decoration. + wavy, +} diff --git a/packages/stac_core/lib/types/stac_text_width_basis.dart b/packages/stac_core/lib/foundation/text/stac_text_width_basis.dart similarity index 70% rename from packages/stac_core/lib/types/stac_text_width_basis.dart rename to packages/stac_core/lib/foundation/text/stac_text_width_basis.dart index 562fd368..2f5ddfeb 100644 --- a/packages/stac_core/lib/types/stac_text_width_basis.dart +++ b/packages/stac_core/lib/foundation/text/stac_text_width_basis.dart @@ -1,3 +1,4 @@ +/// Text width calculation basis options.\n///\n/// Determines how the width of text widgets is calculated, affecting\n/// layout behavior for both single-line and multi-line text. enum StacTextWidthBasis { /// multiline text will take up the full width given by the parent. For single /// line text, only the minimum amount of width needed to contain the text diff --git a/packages/stac_core/lib/theme/stac_button_style/stac_button_style.dart b/packages/stac_core/lib/foundation/theme/stac_button_style/stac_button_style.dart similarity index 76% rename from packages/stac_core/lib/theme/stac_button_style/stac_button_style.dart rename to packages/stac_core/lib/foundation/theme/stac_button_style/stac_button_style.dart index b090c8d4..9978dc13 100644 --- a/packages/stac_core/lib/theme/stac_button_style/stac_button_style.dart +++ b/packages/stac_core/lib/foundation/theme/stac_button_style/stac_button_style.dart @@ -1,23 +1,39 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_duration/stac_duration.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; -import 'package:stac_core/types/stac_size/stac_size.dart'; -import 'package:stac_core/types/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/alignment/stac_alignment.dart'; +import 'package:stac_core/foundation/animation/stac_duration/stac_duration.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/colors/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/geometry/stac_size/stac_size.dart'; +import 'package:stac_core/foundation/geometry/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/interaction/stac_mouse_cursor.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; part 'stac_button_style.g.dart'; -/// Enum for icon alignment in buttons -enum StacIconAlignment { start, end } +/// Icon alignment options for buttons. +/// +/// Defines where the icon should be positioned relative to the button text. +enum StacIconAlignment { + /// Icon appears at the start (left in LTR, right in RTL). + start, + + /// Icon appears at the end (right in LTR, left in RTL). + end, +} -/// Enum for Material tap target size -enum StacMaterialTapTargetSize { padded, shrinkWrap } +/// Material tap target size options. +/// +/// Defines the minimum size of the tap target area. +enum StacMaterialTapTargetSize { + /// Tap target is padded to meet minimum size requirements. + padded, + + /// Tap target shrinks to fit the button content. + shrinkWrap, +} /// A Stac model representing Flutter's ButtonStyle. /// diff --git a/packages/stac_core/lib/theme/stac_button_style/stac_button_style.g.dart b/packages/stac_core/lib/foundation/theme/stac_button_style/stac_button_style.g.dart similarity index 100% rename from packages/stac_core/lib/theme/stac_button_style/stac_button_style.g.dart rename to packages/stac_core/lib/foundation/theme/stac_button_style/stac_button_style.g.dart diff --git a/packages/stac_core/lib/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart b/packages/stac_core/lib/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart new file mode 100644 index 00000000..fcecbc8c --- /dev/null +++ b/packages/stac_core/lib/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart @@ -0,0 +1,183 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/borders/stac_border_side/stac_border_side.dart'; +import 'package:stac_core/foundation/borders/stac_input_border/stac_input_border.dart'; +import 'package:stac_core/foundation/geometry/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_core/foundation/geometry/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/text/stac_text_style/stac_text_style.dart'; + +part 'stac_input_decoration_theme.g.dart'; + +/// A Stac representation of input decoration theme properties. +/// +/// This class defines the default styling for input decorations including +/// text styles, colors, borders, and layout properties for form fields. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacInputDecorationTheme( +/// labelStyle: StacTextStyle(color: StacColors.grey), +/// focusedBorder: StacInputBorder( +/// borderSide: StacBorderSide(color: StacColors.blue), +/// ), +/// filled: true, +/// fillColor: '#F5F5F5', +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "labelStyle": {"color": "#757575"}, +/// "focusedBorder": { +/// "borderSide": {"color": "#2196F3"} +/// }, +/// "filled": true, +/// "fillColor": "#F5F5F5" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacInputDecorationTheme extends StacElement { + /// Creates an input decoration theme with the specified properties. + const StacInputDecorationTheme({ + this.labelStyle, + this.floatingLabelStyle, + this.helperStyle, + this.helperMaxLines, + this.hintStyle, + this.errorStyle, + this.errorMaxLines, + this.floatingLabelBehavior, + this.floatingLabelAlignment, + this.isDense, + this.contentPadding, + this.isCollapsed, + this.iconColor, + this.prefixStyle, + this.prefixIconColor, + this.suffixStyle, + this.suffixIconColor, + this.counterStyle, + this.filled, + this.fillColor, + this.activeIndicatorBorder, + this.outlineBorder, + this.focusColor, + this.hoverColor, + this.errorBorder, + this.focusedBorder, + this.focusedErrorBorder, + this.disabledBorder, + this.enabledBorder, + this.border, + this.alignLabelWithHint, + this.constraints, + }); + + /// The style for input field labels. + final StacTextStyle? labelStyle; + + /// The style for floating labels when they are floating. + final StacTextStyle? floatingLabelStyle; + + /// The style for helper text. + final StacTextStyle? helperStyle; + + /// The maximum number of lines for helper text. + final int? helperMaxLines; + + /// The style for hint text. + final StacTextStyle? hintStyle; + + /// The style for error text. + final StacTextStyle? errorStyle; + + /// The maximum number of lines for error text. + final int? errorMaxLines; + + /// How floating labels should behave. + final String? floatingLabelBehavior; + + /// How floating labels should be aligned. + final String? floatingLabelAlignment; + + /// Whether the input decoration is dense. + final bool? isDense; + + /// The padding for the input content. + final StacEdgeInsets? contentPadding; + + /// Whether the input decoration is collapsed. + final bool? isCollapsed; + + /// The color of the icon. + final String? iconColor; + + /// The style for prefix text. + final StacTextStyle? prefixStyle; + + /// The color of the prefix icon. + final String? prefixIconColor; + + /// The style for suffix text. + final StacTextStyle? suffixStyle; + + /// The color of the suffix icon. + final String? suffixIconColor; + + /// The style for counter text. + final StacTextStyle? counterStyle; + + /// Whether the input field should be filled. + final bool? filled; + + /// The fill color for the input field. + final String? fillColor; + + /// The border for active indicators. + final StacBorderSide? activeIndicatorBorder; + + /// The outline border. + final StacBorderSide? outlineBorder; + + /// The color when the input is focused. + final String? focusColor; + + /// The color when the input is hovered. + final String? hoverColor; + + /// The border when there is an error. + final StacInputBorder? errorBorder; + + /// The border when the input is focused. + final StacInputBorder? focusedBorder; + + /// The border when focused and there is an error. + final StacInputBorder? focusedErrorBorder; + + /// The border when the input is disabled. + final StacInputBorder? disabledBorder; + + /// The border when the input is enabled. + final StacInputBorder? enabledBorder; + + /// The default border. + final StacInputBorder? border; + + /// Whether to align the label with the hint. + final bool? alignLabelWithHint; + + /// The constraints for the input decoration. + final StacBoxConstraints? constraints; + + /// Creates a [StacInputDecorationTheme] from a JSON map. + factory StacInputDecorationTheme.fromJson(Map json) => + _$StacInputDecorationThemeFromJson(json); + + @override + Map toJson() => _$StacInputDecorationThemeToJson(this); +} diff --git a/packages/stac_core/lib/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart b/packages/stac_core/lib/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart similarity index 100% rename from packages/stac_core/lib/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart rename to packages/stac_core/lib/foundation/theme/stac_input_decoration_theme/stac_input_decoration_theme.g.dart diff --git a/packages/stac_core/lib/types/stac_carousel_view_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_carousel_view_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_carousel_view_type.dart rename to packages/stac_core/lib/foundation/ui_components/stac_carousel_view_type.dart diff --git a/packages/stac_core/lib/types/stac_dialog_traversal_edge_behavior.dart b/packages/stac_core/lib/foundation/ui_components/stac_dialog_traversal_edge_behavior.dart similarity index 100% rename from packages/stac_core/lib/types/stac_dialog_traversal_edge_behavior.dart rename to packages/stac_core/lib/foundation/ui_components/stac_dialog_traversal_edge_behavior.dart diff --git a/packages/stac_core/lib/foundation/ui_components/stac_dismiss_direction.dart b/packages/stac_core/lib/foundation/ui_components/stac_dismiss_direction.dart new file mode 100644 index 00000000..72fd925c --- /dev/null +++ b/packages/stac_core/lib/foundation/ui_components/stac_dismiss_direction.dart @@ -0,0 +1,22 @@ +/// Direction(s) in which a dismissible widget can be dismissed. +/// +/// Mirrors Flutter's [DismissDirection] without importing Flutter into core. +enum StacDismissDirection { + /// Can be dismissed horizontally in either direction. + horizontal, + + /// Can be dismissed vertically in either direction. + vertical, + + /// Can be dismissed by dragging down. + down, + + /// Can be dismissed by dragging up. + up, + + /// Can be dismissed by dragging from end to start (right to left in LTR). + endToStart, + + /// Can be dismissed by dragging from start to end (left to right in LTR). + startToEnd, +} diff --git a/packages/stac_core/lib/types/stac_dropdown_menu_close_behavior.dart b/packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_close_behavior.dart similarity index 100% rename from packages/stac_core/lib/types/stac_dropdown_menu_close_behavior.dart rename to packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_close_behavior.dart diff --git a/packages/stac_core/lib/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart b/packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart similarity index 93% rename from packages/stac_core/lib/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart rename to packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart index 215983a3..ee8aa2e9 100644 --- a/packages/stac_core/lib/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart +++ b/packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_core/foundation/theme/stac_button_style/stac_button_style.dart'; part 'stac_dropdown_menu_entry.g.dart'; diff --git a/packages/stac_core/lib/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart b/packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart rename to packages/stac_core/lib/foundation/ui_components/stac_dropdown_menu_entry/stac_dropdown_menu_entry.g.dart diff --git a/packages/stac_core/lib/foundation/ui_components/stac_icon_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_icon_type.dart new file mode 100644 index 00000000..e760a583 --- /dev/null +++ b/packages/stac_core/lib/foundation/ui_components/stac_icon_type.dart @@ -0,0 +1,8 @@ +/// Icon design system types supported by Stac. +enum StacIconType { + /// Material Design icons (Android-style). + material, + + /// Cupertino icons (iOS-style). + cupertino, +} diff --git a/packages/stac_core/lib/types/stac_image_repeat.dart b/packages/stac_core/lib/foundation/ui_components/stac_image_repeat.dart similarity index 100% rename from packages/stac_core/lib/types/stac_image_repeat.dart rename to packages/stac_core/lib/foundation/ui_components/stac_image_repeat.dart diff --git a/packages/stac_core/lib/foundation/ui_components/stac_image_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_image_type.dart new file mode 100644 index 00000000..594d9532 --- /dev/null +++ b/packages/stac_core/lib/foundation/ui_components/stac_image_type.dart @@ -0,0 +1,11 @@ +/// Image source types supported by Stac. +enum StacImageType { + /// Image loaded from a local file path. + file, + + /// Image loaded from a network URL. + network, + + /// Image loaded from application assets. + asset, +} diff --git a/packages/stac_core/lib/types/stac_list_tile_style.dart b/packages/stac_core/lib/foundation/ui_components/stac_list_tile_style.dart similarity index 100% rename from packages/stac_core/lib/types/stac_list_tile_style.dart rename to packages/stac_core/lib/foundation/ui_components/stac_list_tile_style.dart diff --git a/packages/stac_core/lib/types/stac_list_tile_title_alignment.dart b/packages/stac_core/lib/foundation/ui_components/stac_list_tile_title_alignment.dart similarity index 100% rename from packages/stac_core/lib/types/stac_list_tile_title_alignment.dart rename to packages/stac_core/lib/foundation/ui_components/stac_list_tile_title_alignment.dart diff --git a/packages/stac_core/lib/types/stac_options_view_open_direction.dart b/packages/stac_core/lib/foundation/ui_components/stac_options_view_open_direction.dart similarity index 100% rename from packages/stac_core/lib/types/stac_options_view_open_direction.dart rename to packages/stac_core/lib/foundation/ui_components/stac_options_view_open_direction.dart diff --git a/packages/stac_core/lib/types/stac_overflow_bar_alignment.dart b/packages/stac_core/lib/foundation/ui_components/stac_overflow_bar_alignment.dart similarity index 100% rename from packages/stac_core/lib/types/stac_overflow_bar_alignment.dart rename to packages/stac_core/lib/foundation/ui_components/stac_overflow_bar_alignment.dart diff --git a/packages/stac_core/lib/types/stac_radio_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_radio_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_radio_type.dart rename to packages/stac_core/lib/foundation/ui_components/stac_radio_type.dart diff --git a/packages/stac_core/lib/types/stac_refresh_indicator_trigger_mode.dart b/packages/stac_core/lib/foundation/ui_components/stac_refresh_indicator_trigger_mode.dart similarity index 100% rename from packages/stac_core/lib/types/stac_refresh_indicator_trigger_mode.dart rename to packages/stac_core/lib/foundation/ui_components/stac_refresh_indicator_trigger_mode.dart diff --git a/packages/stac_core/lib/types/stac_slider_interaction.dart b/packages/stac_core/lib/foundation/ui_components/stac_slider_interaction.dart similarity index 100% rename from packages/stac_core/lib/types/stac_slider_interaction.dart rename to packages/stac_core/lib/foundation/ui_components/stac_slider_interaction.dart diff --git a/packages/stac_core/lib/types/stac_slider_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_slider_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_slider_type.dart rename to packages/stac_core/lib/foundation/ui_components/stac_slider_type.dart diff --git a/packages/stac_core/lib/types/stac_snack_bar_behavior.dart b/packages/stac_core/lib/foundation/ui_components/stac_snack_bar_behavior.dart similarity index 58% rename from packages/stac_core/lib/types/stac_snack_bar_behavior.dart rename to packages/stac_core/lib/foundation/ui_components/stac_snack_bar_behavior.dart index 58d5fcde..b28520e4 100644 --- a/packages/stac_core/lib/types/stac_snack_bar_behavior.dart +++ b/packages/stac_core/lib/foundation/ui_components/stac_snack_bar_behavior.dart @@ -3,4 +3,10 @@ /// Mirrors Flutter's [SnackBarBehavior] without importing Flutter into core. /// - `fixed`: SnackBar is anchored to the bottom. /// - `floating`: SnackBar floats above content with margins. -enum StacSnackBarBehavior { fixed, floating } +enum StacSnackBarBehavior { + /// SnackBar is anchored to the bottom of the screen. + fixed, + + /// SnackBar floats above content with margins around it. + floating, +} diff --git a/packages/stac_core/lib/types/stac_switch_type.dart b/packages/stac_core/lib/foundation/ui_components/stac_switch_type.dart similarity index 100% rename from packages/stac_core/lib/types/stac_switch_type.dart rename to packages/stac_core/lib/foundation/ui_components/stac_switch_type.dart diff --git a/packages/stac_core/lib/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart b/packages/stac_core/lib/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart new file mode 100644 index 00000000..0cc89255 --- /dev/null +++ b/packages/stac_core/lib/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart @@ -0,0 +1,79 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/colors/stac_brightness.dart'; + +part 'stac_system_ui_overlay_style.g.dart'; + +/// A Stac representation of system UI overlay styling. +/// +/// This class defines the appearance of system UI elements like the +/// status bar and navigation bar, including colors and brightness settings. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacSystemUIOverlayStyle( +/// statusBarColor: '#000000', +/// statusBarIconBrightness: StacBrightness.light, +/// systemNavigationBarColor: '#FFFFFF', +/// systemNavigationBarIconBrightness: StacBrightness.dark, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "statusBarColor": "#000000", +/// "statusBarIconBrightness": "light", +/// "systemNavigationBarColor": "#FFFFFF", +/// "systemNavigationBarIconBrightness": "dark" +/// } +/// ``` +/// {@end-tool} +@JsonSerializable() +class StacSystemUIOverlayStyle extends StacElement { + /// Creates a system UI overlay style with the specified properties. + StacSystemUIOverlayStyle({ + this.systemNavigationBarColor, + this.systemNavigationBarDividerColor, + this.systemNavigationBarIconBrightness, + this.systemNavigationBarContrastEnforced, + this.statusBarColor, + this.statusBarBrightness, + this.statusBarIconBrightness, + this.systemStatusBarContrastEnforced, + }); + + /// The color of the system navigation bar. + final String? systemNavigationBarColor; + + /// The color of the divider between the navigation bar and content. + final String? systemNavigationBarDividerColor; + + /// The brightness of icons in the system navigation bar. + final StacBrightness? systemNavigationBarIconBrightness; + + /// Whether contrast enforcement is enabled for the navigation bar. + final bool? systemNavigationBarContrastEnforced; + + /// The color of the status bar. + final String? statusBarColor; + + /// The brightness of the status bar background. + final StacBrightness? statusBarBrightness; + + /// The brightness of icons in the status bar. + final StacBrightness? statusBarIconBrightness; + + /// Whether contrast enforcement is enabled for the status bar. + final bool? systemStatusBarContrastEnforced; + + /// Creates a [StacSystemUIOverlayStyle] from a JSON map. + factory StacSystemUIOverlayStyle.fromJson(Map json) => + _$StacSystemUIOverlayStyleFromJson(json); + + @override + Map toJson() => _$StacSystemUIOverlayStyleToJson(this); +} diff --git a/packages/stac_core/lib/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.g.dart b/packages/stac_core/lib/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.g.dart similarity index 100% rename from packages/stac_core/lib/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.g.dart rename to packages/stac_core/lib/foundation/ui_components/stac_system_ui_overlay_style/stac_system_ui_overlay_style.g.dart diff --git a/packages/stac_core/lib/types/stac_table/stac_table_column_width.dart b/packages/stac_core/lib/foundation/ui_components/stac_table_column_width/stac_table_column_width.dart similarity index 100% rename from packages/stac_core/lib/types/stac_table/stac_table_column_width.dart rename to packages/stac_core/lib/foundation/ui_components/stac_table_column_width/stac_table_column_width.dart diff --git a/packages/stac_core/lib/types/stac_table/stac_table_column_width.g.dart b/packages/stac_core/lib/foundation/ui_components/stac_table_column_width/stac_table_column_width.g.dart similarity index 100% rename from packages/stac_core/lib/types/stac_table/stac_table_column_width.g.dart rename to packages/stac_core/lib/foundation/ui_components/stac_table_column_width/stac_table_column_width.g.dart diff --git a/packages/stac_core/lib/painting/painting.dart b/packages/stac_core/lib/painting/painting.dart deleted file mode 100644 index 4ba7a6e7..00000000 --- a/packages/stac_core/lib/painting/painting.dart +++ /dev/null @@ -1,10 +0,0 @@ -library; - -export 'stac_box_decoration/stac_box_decoration.dart'; -export 'stac_color/stac_colors.dart'; -export 'stac_decoration_image/stac_decoration_image.dart'; -export 'stac_edge_insets/stac_edge_insets.dart'; -export 'stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; -export 'stac_text_span/stac_text_span.dart'; -export 'stac_text_style/stac_text_style.dart'; -export 'stac_input_decoration/stac_input_decoration.dart'; diff --git a/packages/stac_core/lib/painting/stac_box_decoration/stac_box_decoration.dart b/packages/stac_core/lib/painting/stac_box_decoration/stac_box_decoration.dart deleted file mode 100644 index a8c2b0a7..00000000 --- a/packages/stac_core/lib/painting/stac_box_decoration/stac_box_decoration.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; -import 'package:stac_core/types/stac_box_shadow/stac_box_shadow.dart'; -import 'package:stac_core/types/stac_box_shape.dart'; -import 'package:stac_core/types/stac_gradient/stac_gradient.dart'; - -part 'stac_box_decoration.g.dart'; - -@JsonSerializable() -class StacBoxDecoration extends StacElement { - const StacBoxDecoration({ - this.color, - this.image, - this.border, - this.borderRadius, - this.boxShadow, - this.gradient, - this.backgroundBlendMode, - this.shape, - }); - - final StacColor? color; - final StacDecorationImage? image; - final StacBorder? border; - final StacBorderRadius? borderRadius; - final List? boxShadow; - final StacGradient? gradient; - final StacBlendMode? backgroundBlendMode; - final StacBoxShape? shape; - - factory StacBoxDecoration.fromJson(Map json) => - _$StacBoxDecorationFromJson(json); - - @override - Map toJson() => _$StacBoxDecorationToJson(this); -} diff --git a/packages/stac_core/lib/painting/stac_decoration_image/stac_decoration_image.dart b/packages/stac_core/lib/painting/stac_decoration_image/stac_decoration_image.dart deleted file mode 100644 index acf79a0c..00000000 --- a/packages/stac_core/lib/painting/stac_decoration_image/stac_decoration_image.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_box_fit.dart'; -import 'package:stac_core/types/stac_filter_quality.dart'; -import 'package:stac_core/types/stac_image_repeat.dart'; -import 'package:stac_core/types/stac_image_type.dart'; -import 'package:stac_core/types/stac_rect/stac_rect.dart'; - -part 'stac_decoration_image.g.dart'; - -@JsonSerializable() -class StacDecorationImage implements StacElement { - const StacDecorationImage({ - required this.src, - this.fit, - this.imageType, - this.alignment, - this.centerSlice, - this.repeat, - this.matchTextDirection, - this.scale, - this.opacity, - this.filterQuality, - this.invertColors, - this.isAntiAlias, - }); - - final String src; - final StacBoxFit? fit; - final StacImageType? imageType; - final StacAlignment? alignment; - final StacRect? centerSlice; - final StacImageRepeat? repeat; - final bool? matchTextDirection; - final double? scale; - final double? opacity; - final StacFilterQuality? filterQuality; - final bool? invertColors; - final bool? isAntiAlias; - - factory StacDecorationImage.fromJson(Map json) => - _$StacDecorationImageFromJson(json); - - @override - Map toJson() => _$StacDecorationImageToJson(this); -} diff --git a/packages/stac_core/lib/painting/stac_edge_insets/stac_edge_insets.dart b/packages/stac_core/lib/painting/stac_edge_insets/stac_edge_insets.dart deleted file mode 100644 index bb1c4740..00000000 --- a/packages/stac_core/lib/painting/stac_edge_insets/stac_edge_insets.dart +++ /dev/null @@ -1,65 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; - -part 'stac_edge_insets.g.dart'; - -@JsonSerializable() -class StacEdgeInsets extends StacElement { - const StacEdgeInsets({this.left, this.top, this.right, this.bottom}); - - final double? left; - final double? top; - final double? right; - final double? bottom; - - const StacEdgeInsets.all(double value) - : this(left: value, top: value, right: value, bottom: value); - - const StacEdgeInsets.only({this.left, this.top, this.right, this.bottom}); - - const StacEdgeInsets.symmetric({double? vertical, double? horizontal}) - : this( - left: horizontal, - top: vertical, - right: horizontal, - bottom: vertical, - ); - - const StacEdgeInsets.horizontal(double value) - : this.symmetric(horizontal: value); - - const StacEdgeInsets.vertical(double value) : this.symmetric(vertical: value); - - factory StacEdgeInsets.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) { - bool allElementsNum = json.every((element) => element is num); - if (!allElementsNum) { - throw ArgumentError('Invalid input format for StacEdgeInsets'); - } - 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 StacEdgeInsets'); - } - - return _$StacEdgeInsetsFromJson(resultantJson); - } - - @override - Map toJson() => _$StacEdgeInsetsToJson(this); -} diff --git a/packages/stac_core/lib/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart b/packages/stac_core/lib/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart deleted file mode 100644 index 8ba490ac..00000000 --- a/packages/stac_core/lib/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_brightness.dart'; - -part 'stac_system_ui_overlay_style.g.dart'; - -@JsonSerializable() -class StacSystemUIOverlayStyle extends StacElement { - StacSystemUIOverlayStyle({ - this.systemNavigationBarColor, - this.systemNavigationBarDividerColor, - this.systemNavigationBarIconBrightness, - this.systemNavigationBarContrastEnforced, - this.statusBarColor, - this.statusBarBrightness, - this.statusBarIconBrightness, - this.systemStatusBarContrastEnforced, - }); - - final String? systemNavigationBarColor; - final String? systemNavigationBarDividerColor; - final StacBrightness? systemNavigationBarIconBrightness; - final bool? systemNavigationBarContrastEnforced; - final String? statusBarColor; - final StacBrightness? statusBarBrightness; - final StacBrightness? statusBarIconBrightness; - final bool? systemStatusBarContrastEnforced; - - factory StacSystemUIOverlayStyle.fromJson(Map json) => - _$StacSystemUIOverlayStyleFromJson(json); - - @override - Map toJson() => _$StacSystemUIOverlayStyleToJson(this); -} diff --git a/packages/stac_core/lib/painting/stac_text_span/stac_text_span.dart b/packages/stac_core/lib/painting/stac_text_span/stac_text_span.dart deleted file mode 100644 index f20e9c44..00000000 --- a/packages/stac_core/lib/painting/stac_text_span/stac_text_span.dart +++ /dev/null @@ -1,21 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; - -part 'stac_text_span.g.dart'; - -@JsonSerializable() -class StacTextSpan implements StacElement { - StacTextSpan({this.text, this.style, this.children = const [], this.onTap}); - - final String? text; - final StacTextStyle? style; - final List children; - final Map? onTap; - - @override - Map toJson() => _$StacTextSpanToJson(this); - - factory StacTextSpan.fromJson(Map json) => - _$StacTextSpanFromJson(json); -} diff --git a/packages/stac_core/lib/painting/stac_text_style/stac_text_style.dart b/packages/stac_core/lib/painting/stac_text_style/stac_text_style.dart deleted file mode 100644 index c9f5d46d..00000000 --- a/packages/stac_core/lib/painting/stac_text_style/stac_text_style.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_text_types.dart'; - -part 'stac_text_style.g.dart'; - -@JsonSerializable() -class StacTextStyle extends StacElement { - StacTextStyle({ - this.inherit, - this.color, - this.backgroundColor, - this.fontSize, - this.fontWeight, - this.fontStyle, - this.letterSpacing, - this.wordSpacing, - this.textBaseline, - this.height, - this.leadingDistribution, - this.decorationColor, - this.decorationStyle, - this.decorationThickness, - this.debugLabel, - this.fontFamily, - this.fontFamilyFallback, - this.package, - this.overflow, - }); - - bool? inherit; - - StacColor? color; - - StacColor? backgroundColor; - - double? fontSize; - - StacFontWeight? fontWeight; - - StacFontStyle? fontStyle; - - double? letterSpacing; - - double? wordSpacing; - - StacTextBaseline? textBaseline; - - double? height; - - StacTextLeadingDistribution? leadingDistribution; - - StacColor? decorationColor; - - StacTextDecorationStyle? decorationStyle; - - double? decorationThickness; - - String? debugLabel; - - String? fontFamily; - - List? fontFamilyFallback; - - String? package; - - StacTextOverflow? overflow; - - factory StacTextStyle.fromJson(Map json) => - _$StacTextStyleFromJson(json); - - @override - Map toJson() => _$StacTextStyleToJson(this); -} diff --git a/packages/stac_core/lib/stac_core.dart b/packages/stac_core/lib/stac_core.dart index 952a640d..faf36892 100644 --- a/packages/stac_core/lib/stac_core.dart +++ b/packages/stac_core/lib/stac_core.dart @@ -2,6 +2,5 @@ library; export 'actions/actions.dart'; export 'core/core.dart'; -export 'painting/painting.dart'; -export 'types/types.dart'; +export 'foundation/foundation.dart'; export 'widgets/widgets.dart'; diff --git a/packages/stac_core/lib/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart b/packages/stac_core/lib/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart deleted file mode 100644 index e27b55f0..00000000 --- a/packages/stac_core/lib/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart +++ /dev/null @@ -1,87 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; -import 'package:stac_core/types/stac_input_border/stac_input_border.dart'; - -part 'stac_input_decoration_theme.g.dart'; - -/// A Stac model mirroring Flutter's [InputDecorationTheme]. -@JsonSerializable() -class StacInputDecorationTheme extends StacElement { - const StacInputDecorationTheme({ - this.labelStyle, - this.floatingLabelStyle, - this.helperStyle, - this.helperMaxLines, - this.hintStyle, - this.errorStyle, - this.errorMaxLines, - this.floatingLabelBehavior, - this.floatingLabelAlignment, - this.isDense, - this.contentPadding, - this.isCollapsed, - this.iconColor, - this.prefixStyle, - this.prefixIconColor, - this.suffixStyle, - this.suffixIconColor, - this.counterStyle, - this.filled, - this.fillColor, - this.activeIndicatorBorder, - this.outlineBorder, - this.focusColor, - this.hoverColor, - this.errorBorder, - this.focusedBorder, - this.focusedErrorBorder, - this.disabledBorder, - this.enabledBorder, - this.border, - this.alignLabelWithHint, - this.constraints, - }); - - final StacTextStyle? labelStyle; - final StacTextStyle? floatingLabelStyle; - final StacTextStyle? helperStyle; - final int? helperMaxLines; - final StacTextStyle? hintStyle; - final StacTextStyle? errorStyle; - final int? errorMaxLines; - final String? floatingLabelBehavior; - final String? floatingLabelAlignment; - final bool? isDense; - final StacEdgeInsets? contentPadding; - final bool? isCollapsed; - final String? iconColor; - final StacTextStyle? prefixStyle; - final String? prefixIconColor; - final StacTextStyle? suffixStyle; - final String? suffixIconColor; - final StacTextStyle? counterStyle; - final bool? filled; - final String? fillColor; - final StacBorderSide? activeIndicatorBorder; - final StacBorderSide? outlineBorder; - final String? focusColor; - final String? hoverColor; - final StacInputBorder? errorBorder; - final StacInputBorder? focusedBorder; - final StacInputBorder? focusedErrorBorder; - final StacInputBorder? disabledBorder; - final StacInputBorder? enabledBorder; - final StacInputBorder? border; - final bool? alignLabelWithHint; - final StacBoxConstraints? constraints; - - factory StacInputDecorationTheme.fromJson(Map json) => - _$StacInputDecorationThemeFromJson(json); - - @override - Map toJson() => _$StacInputDecorationThemeToJson(this); -} diff --git a/packages/stac_core/lib/theme/theme.dart b/packages/stac_core/lib/theme/theme.dart deleted file mode 100644 index 2bbb328c..00000000 --- a/packages/stac_core/lib/theme/theme.dart +++ /dev/null @@ -1,4 +0,0 @@ -library; - -export 'stac_button_style/stac_button_style.dart'; -export 'stac_input_decoration_theme/stac_input_decoration_theme.dart'; diff --git a/packages/stac_core/lib/types/stac_alignment.dart b/packages/stac_core/lib/types/stac_alignment.dart deleted file mode 100644 index 03608bb6..00000000 --- a/packages/stac_core/lib/types/stac_alignment.dart +++ /dev/null @@ -1,11 +0,0 @@ -enum StacAlignment { - topLeft, - topCenter, - topRight, - centerLeft, - center, - centerRight, - bottomLeft, - bottomCenter, - bottomRight, -} diff --git a/packages/stac_core/lib/types/stac_alignment_directional.dart b/packages/stac_core/lib/types/stac_alignment_directional.dart deleted file mode 100644 index 284145f8..00000000 --- a/packages/stac_core/lib/types/stac_alignment_directional.dart +++ /dev/null @@ -1,11 +0,0 @@ -enum StacAlignmentDirectional { - topStart, - topCenter, - topEnd, - centerStart, - center, - centerEnd, - bottomStart, - bottomCenter, - bottomEnd, -} diff --git a/packages/stac_core/lib/types/stac_axis.dart b/packages/stac_core/lib/types/stac_axis.dart deleted file mode 100644 index 7ea6d0a2..00000000 --- a/packages/stac_core/lib/types/stac_axis.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacAxis { horizontal, vertical } diff --git a/packages/stac_core/lib/types/stac_blend_mode.dart b/packages/stac_core/lib/types/stac_blend_mode.dart deleted file mode 100644 index 26e3e6de..00000000 --- a/packages/stac_core/lib/types/stac_blend_mode.dart +++ /dev/null @@ -1,59 +0,0 @@ -enum StacBlendMode { - clear, - - src, - - dst, - - srcOver, - - dstOver, - - srcIn, - - dstIn, - - srcOut, - - dstOut, - - srcATop, - - dstATop, - - xor, - - plus, - - modulate, - - screen, - - overlay, - - darken, - - lighten, - - colorDodge, - - colorBurn, - - hardLight, - - softLight, - - difference, - - exclusion, - - multiply, - - hue, - - saturation, - - color, - - luminosity, -} diff --git a/packages/stac_core/lib/types/stac_border/stac_border.dart b/packages/stac_core/lib/types/stac_border/stac_border.dart deleted file mode 100644 index 6555d37b..00000000 --- a/packages/stac_core/lib/types/stac_border/stac_border.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; - -part 'stac_border.g.dart'; - -enum StacBorderStyle { - /// Skip the border. - none, - - /// Draw the border as a solid line. - solid, - - // if you add more, think about how they will lerp -} - -@JsonSerializable() -class StacBorder implements StacElement { - const StacBorder({ - this.color, - this.borderStyle, - this.width, - this.strokeAlign, - this.top, - this.right, - this.bottom, - this.left, - }); - - // Uniform border properties (applies to all sides) - final StacColor? color; - final StacBorderStyle? borderStyle; - final double? width; - final double? strokeAlign; - // Individual border sides - final StacBorderSide? top; - final StacBorderSide? right; - final StacBorderSide? bottom; - final StacBorderSide? left; - - factory StacBorder.fromJson(Map json) => - _$StacBorderFromJson(json); - - @override - Map toJson() => _$StacBorderToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_border_radius/stac_border_radius.dart b/packages/stac_core/lib/types/stac_border_radius/stac_border_radius.dart deleted file mode 100644 index 3769eb72..00000000 --- a/packages/stac_core/lib/types/stac_border_radius/stac_border_radius.dart +++ /dev/null @@ -1,61 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; - -part 'stac_border_radius.g.dart'; - -@JsonSerializable() -class StacBorderRadius implements StacElement { - const StacBorderRadius({ - this.topLeft, - this.topRight, - this.bottomLeft, - this.bottomRight, - }); - - /// Creates a border radius with all corners set to the same value. - const StacBorderRadius.all(double radius) - : this( - topLeft: radius, - topRight: radius, - bottomLeft: radius, - bottomRight: radius, - ); - - final double? topLeft; - final double? topRight; - final double? bottomLeft; - final double? bottomRight; - - factory StacBorderRadius.fromJson(dynamic json) { - Map resultantJson; - - if (json is num) { - resultantJson = { - "topLeft": json, - "topRight": json, - "bottomLeft": json, - "bottomRight": json, - }; - } else if (json is List && json.length == 4) { - bool allElementsNum = json.every((element) => element is num); - if (!allElementsNum) { - throw ArgumentError('Invalid input format for StacEdgeInsets'); - } - resultantJson = { - "topLeft": json[0], - "topRight": json[1], - "bottomLeft": json[2], - "bottomRight": json[3], - }; - } else if (json is Map) { - resultantJson = json; - } else { - throw ArgumentError('Invalid input format for StacEdgeInsets'); - } - - return _$StacBorderRadiusFromJson(resultantJson); - } - - @override - Map toJson() => _$StacBorderRadiusToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_border_side/stac_border_side.dart b/packages/stac_core/lib/types/stac_border_side/stac_border_side.dart deleted file mode 100644 index 8ed5b9a3..00000000 --- a/packages/stac_core/lib/types/stac_border_side/stac_border_side.dart +++ /dev/null @@ -1,32 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_border/stac_border.dart'; - -part 'stac_border_side.g.dart'; - -@JsonSerializable() -class StacBorderSide implements StacElement { - const StacBorderSide({ - this.color, - this.width, - this.strokeAlign, - this.borderStyle, - }); - - final StacColor? color; - final double? width; - final double? strokeAlign; - final StacBorderStyle? borderStyle; - - static const none = StacBorderSide( - width: 0, - borderStyle: StacBorderStyle.none, - ); - - factory StacBorderSide.fromJson(Map json) => - _$StacBorderSideFromJson(json); - - @override - Map toJson() => _$StacBorderSideToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_box_constraints/stac_box_constraints.dart b/packages/stac_core/lib/types/stac_box_constraints/stac_box_constraints.dart deleted file mode 100644 index 41f51921..00000000 --- a/packages/stac_core/lib/types/stac_box_constraints/stac_box_constraints.dart +++ /dev/null @@ -1,31 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/converters/double_converter.dart'; - -part 'stac_box_constraints.g.dart'; - -@JsonSerializable() -class StacBoxConstraints { - const StacBoxConstraints({ - this.minWidth, - this.maxWidth, - this.minHeight, - this.maxHeight, - }); - - @DoubleConverter() - final double? minWidth; - - @DoubleConverter() - final double? maxWidth; - - @DoubleConverter() - final double? minHeight; - - @DoubleConverter() - final double? maxHeight; - - factory StacBoxConstraints.fromJson(Map json) => - _$StacBoxConstraintsFromJson(json); - - Map toJson() => _$StacBoxConstraintsToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_box_shadow/stac_box_shadow.dart b/packages/stac_core/lib/types/stac_box_shadow/stac_box_shadow.dart deleted file mode 100644 index 8ac28be8..00000000 --- a/packages/stac_core/lib/types/stac_box_shadow/stac_box_shadow.dart +++ /dev/null @@ -1,35 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/converters/double_converter.dart'; -import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/types/stac_blur_style.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; - -part 'stac_box_shadow.g.dart'; - -@JsonSerializable() -class StacBoxShadow implements StacElement { - const StacBoxShadow({ - this.color, - this.blurRadius, - this.offset, - this.spreadRadius, - this.blurStyle, - }); - - final StacColor? color; - - @DoubleConverter() - final double? blurRadius; - - final StacOffset? offset; - - @DoubleConverter() - final double? spreadRadius; - final StacBlurStyle? blurStyle; - - factory StacBoxShadow.fromJson(Map json) => - _$StacBoxShadowFromJson(json); - - @override - Map toJson() => _$StacBoxShadowToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_cross_axis_alignment.dart b/packages/stac_core/lib/types/stac_cross_axis_alignment.dart deleted file mode 100644 index 0993bdd3..00000000 --- a/packages/stac_core/lib/types/stac_cross_axis_alignment.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacCrossAxisAlignment { start, end, center, stretch, baseline } diff --git a/packages/stac_core/lib/types/stac_dismiss_direction.dart b/packages/stac_core/lib/types/stac_dismiss_direction.dart deleted file mode 100644 index c668da69..00000000 --- a/packages/stac_core/lib/types/stac_dismiss_direction.dart +++ /dev/null @@ -1,11 +0,0 @@ -/// Direction(s) in which a dismissible widget can be dismissed. -/// -/// Mirrors Flutter's [DismissDirection] without importing Flutter into core. -enum StacDismissDirection { - horizontal, - vertical, - down, - up, - endToStart, - startToEnd, -} diff --git a/packages/stac_core/lib/types/stac_drag_start_behavior.dart b/packages/stac_core/lib/types/stac_drag_start_behavior.dart deleted file mode 100644 index 1875e1ba..00000000 --- a/packages/stac_core/lib/types/stac_drag_start_behavior.dart +++ /dev/null @@ -1,9 +0,0 @@ -enum StacDragStartBehavior { - /// Set the initial offset at the position where the first down event was - /// detected. - down, - - /// Set the initial position at the position where this gesture recognizer - /// won the arena. - start, -} diff --git a/packages/stac_core/lib/types/stac_flex_fit.dart b/packages/stac_core/lib/types/stac_flex_fit.dart deleted file mode 100644 index 9c67e8a5..00000000 --- a/packages/stac_core/lib/types/stac_flex_fit.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacFlexFit { tight, loose } diff --git a/packages/stac_core/lib/types/stac_floating_action_button_location.dart b/packages/stac_core/lib/types/stac_floating_action_button_location.dart deleted file mode 100644 index 3e3e91bc..00000000 --- a/packages/stac_core/lib/types/stac_floating_action_button_location.dart +++ /dev/null @@ -1,20 +0,0 @@ -enum StacFloatingActionButtonLocation { - startTop, - miniStartTop, - centerTop, - miniCenterTop, - endTop, - miniEndTop, - startFloat, - miniStartFloat, - centerFloat, - miniCenterFloat, - endFloat, - miniEndFloat, - startDocked, - miniStartDocked, - centerDocked, - miniCenterDocked, - endDocked, - miniEndDocked, -} diff --git a/packages/stac_core/lib/types/stac_gradient/stac_gradient.dart b/packages/stac_core/lib/types/stac_gradient/stac_gradient.dart deleted file mode 100644 index 3763f447..00000000 --- a/packages/stac_core/lib/types/stac_gradient/stac_gradient.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_alignment.dart'; - -part 'stac_gradient.g.dart'; - -enum StacGradientType { linear, radial, sweep } - -enum StacTileMode { clamp, repeated, mirror, decal } - -@JsonSerializable() -class StacGradient { - const StacGradient({ - this.gradientType, - this.colors, - this.stops, - this.begin, - this.end, - this.center, - this.focal, - this.tileMode, - this.focalRadius, - this.radius, - this.startAngle, - this.endAngle, - }); - - final StacGradientType? gradientType; - final List? colors; - final List? stops; - final StacAlignment? begin; - final StacAlignment? end; - final StacAlignment? center; - final StacAlignment? focal; - final StacTileMode? tileMode; - final double? focalRadius; - final double? radius; - final double? startAngle; - final double? endAngle; - - factory StacGradient.fromJson(Map json) => - _$StacGradientFromJson(json); - - Map toJson() => _$StacGradientToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_icon_type.dart b/packages/stac_core/lib/types/stac_icon_type.dart deleted file mode 100644 index 165c0f26..00000000 --- a/packages/stac_core/lib/types/stac_icon_type.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacIconType { material, cupertino } diff --git a/packages/stac_core/lib/types/stac_image_type.dart b/packages/stac_core/lib/types/stac_image_type.dart deleted file mode 100644 index bc65eba0..00000000 --- a/packages/stac_core/lib/types/stac_image_type.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacImageType { file, network, asset } diff --git a/packages/stac_core/lib/types/stac_main_axis_alignment.dart b/packages/stac_core/lib/types/stac_main_axis_alignment.dart deleted file mode 100644 index 8f7b9092..00000000 --- a/packages/stac_core/lib/types/stac_main_axis_alignment.dart +++ /dev/null @@ -1,8 +0,0 @@ -enum StacMainAxisAlignment { - start, - end, - center, - spaceBetween, - spaceAround, - spaceEvenly, -} diff --git a/packages/stac_core/lib/types/stac_main_axis_size.dart b/packages/stac_core/lib/types/stac_main_axis_size.dart deleted file mode 100644 index 5e354edc..00000000 --- a/packages/stac_core/lib/types/stac_main_axis_size.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacMainAxisSize { min, max } diff --git a/packages/stac_core/lib/types/stac_mouse_cursor.dart b/packages/stac_core/lib/types/stac_mouse_cursor.dart deleted file mode 100644 index 98f8bdf4..00000000 --- a/packages/stac_core/lib/types/stac_mouse_cursor.dart +++ /dev/null @@ -1,38 +0,0 @@ -enum StacMouseCursor { - none, - basic, - click, - forbidden, - wait, - progress, - contextMenu, - help, - text, - verticalText, - cell, - precise, - move, - grab, - grabbing, - noDrop, - alias, - copy, - disappearing, - allScroll, - resizeLeftRight, - resizeUpDown, - resizeUpLeftDownRight, - resizeUpRightDownLeft, - resizeUp, - resizeDown, - resizeLeft, - resizeRight, - resizeUpLeft, - resizeUpRight, - resizeDownLeft, - resizeDownRight, - resizeColumn, - resizeRow, - zoomIn, - zoomOut, -} diff --git a/packages/stac_core/lib/types/stac_offset/stac_offset.dart b/packages/stac_core/lib/types/stac_offset/stac_offset.dart deleted file mode 100644 index 94ff036a..00000000 --- a/packages/stac_core/lib/types/stac_offset/stac_offset.dart +++ /dev/null @@ -1,20 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; - -part 'stac_offset.g.dart'; - -@JsonSerializable() -class StacOffset implements StacElement { - const StacOffset({required this.dx, required this.dy}); - - static const StacOffset zero = StacOffset(dx: 0, dy: 0); - - final double dx; - final double dy; - - factory StacOffset.fromJson(Map json) => - _$StacOffsetFromJson(json); - - @override - Map toJson() => _$StacOffsetToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_rect/stac_rect.dart b/packages/stac_core/lib/types/stac_rect/stac_rect.dart deleted file mode 100644 index cba8e188..00000000 --- a/packages/stac_core/lib/types/stac_rect/stac_rect.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/converters/double_converter.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; - -part 'stac_rect.g.dart'; - -enum StacRectType { fromCenter, fromCircle, fromLTRB, fromLTWH, fromPoints } - -@JsonSerializable() -class StacRect implements StacElement { - StacRect({ - required this.rectType, - this.left, - this.top, - this.right, - this.bottom, - this.width, - this.height, - this.center, - this.radius, - this.a, - this.b, - }); - - final StacRectType rectType; - - @DoubleConverter() - final double? left; - - @DoubleConverter() - final double? top; - - @DoubleConverter() - final double? right; - - @DoubleConverter() - final double? bottom; - - @DoubleConverter() - final double? width; - - @DoubleConverter() - final double? height; - - final StacOffset? center; - - @DoubleConverter() - final double? radius; - - final StacOffset? a; - - final StacOffset? b; - - factory StacRect.fromJson(Map json) => - _$StacRectFromJson(json); - - @override - Map toJson() => _$StacRectToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_shadow/stac_shadow.dart b/packages/stac_core/lib/types/stac_shadow/stac_shadow.dart deleted file mode 100644 index acf9ba4d..00000000 --- a/packages/stac_core/lib/types/stac_shadow/stac_shadow.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/converters/double_converter.dart'; -import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; - -part 'stac_shadow.g.dart'; - -@JsonSerializable() -class StacShadow implements StacElement { - const StacShadow({this.color, this.offset, this.blurRadius}); - - /// Color as hex or theme color name - final String? color; - - /// Offset for the shadow - final StacOffset? offset; - - /// Blur radius for the shadow - @DoubleConverter() - final double? blurRadius; - - factory StacShadow.fromJson(Map json) => - _$StacShadowFromJson(json); - - @override - Map toJson() => _$StacShadowToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_size/stac_size.dart b/packages/stac_core/lib/types/stac_size/stac_size.dart deleted file mode 100644 index fef2a794..00000000 --- a/packages/stac_core/lib/types/stac_size/stac_size.dart +++ /dev/null @@ -1,18 +0,0 @@ -import 'package:json_annotation/json_annotation.dart'; -import 'package:stac_core/core/stac_widget.dart'; - -part 'stac_size.g.dart'; - -@JsonSerializable() -class StacSize implements StacElement { - const StacSize(this.width, this.height); - - final double width; - final double height; - - factory StacSize.fromJson(Map json) => - _$StacSizeFromJson(json); - - @override - Map toJson() => _$StacSizeToJson(this); -} diff --git a/packages/stac_core/lib/types/stac_stack_fit.dart b/packages/stac_core/lib/types/stac_stack_fit.dart deleted file mode 100644 index 4ee1dfe4..00000000 --- a/packages/stac_core/lib/types/stac_stack_fit.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacStackFit { loose, expand, passthrough } diff --git a/packages/stac_core/lib/types/stac_table/stac_table_cell_vertical_alignment.dart b/packages/stac_core/lib/types/stac_table/stac_table_cell_vertical_alignment.dart deleted file mode 100644 index b9849c26..00000000 --- a/packages/stac_core/lib/types/stac_table/stac_table_cell_vertical_alignment.dart +++ /dev/null @@ -1,20 +0,0 @@ -/// Vertical alignment options for table cells. -/// -/// Mirrors Flutter's `TableCellVerticalAlignment` and controls how the child of -/// a table cell is positioned vertically within the row height. -enum StacTableCellVerticalAlignment { - /// Align at the top of the row. - top, - - /// Center vertically within the row. - middle, - - /// Align at the bottom of the row. - bottom, - - /// Align the baselines of text for the row. - baseline, - - /// Expand to fill the full height of the row. - fill, -} diff --git a/packages/stac_core/lib/types/stac_text_types.dart b/packages/stac_core/lib/types/stac_text_types.dart deleted file mode 100644 index 685c2815..00000000 --- a/packages/stac_core/lib/types/stac_text_types.dart +++ /dev/null @@ -1,29 +0,0 @@ -enum StacTextAlign { left, right, center, justify, start, end } - -enum StacTextDirection { rtl, ltr } - -enum StacTextOverflow { clip, fade, ellipsis, visible } - -enum StacTextWidthBasis { parent, longestLine } - -enum StacTextBaseline { alphabetic, ideographic } - -enum StacFontWeight { - w100, - w200, - w300, - w400, - w500, - w600, - w700, - w800, - w900, - normal, - bold, -} - -enum StacFontStyle { normal, italic } - -enum StacTextLeadingDistribution { proportional, even } - -enum StacTextDecorationStyle { solid, double, dotted, dashed, wavy } diff --git a/packages/stac_core/lib/types/stac_vertical_direction.dart b/packages/stac_core/lib/types/stac_vertical_direction.dart deleted file mode 100644 index 2e19260f..00000000 --- a/packages/stac_core/lib/types/stac_vertical_direction.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacVerticalDirection { up, down } diff --git a/packages/stac_core/lib/types/stac_wrap_alignment.dart b/packages/stac_core/lib/types/stac_wrap_alignment.dart deleted file mode 100644 index 5628558d..00000000 --- a/packages/stac_core/lib/types/stac_wrap_alignment.dart +++ /dev/null @@ -1,8 +0,0 @@ -enum StacWrapAlignment { - start, - end, - center, - spaceBetween, - spaceAround, - spaceEvenly, -} diff --git a/packages/stac_core/lib/types/stac_wrap_cross_alignment.dart b/packages/stac_core/lib/types/stac_wrap_cross_alignment.dart deleted file mode 100644 index cce09ef5..00000000 --- a/packages/stac_core/lib/types/stac_wrap_cross_alignment.dart +++ /dev/null @@ -1 +0,0 @@ -enum StacWrapCrossAlignment { start, end, center } diff --git a/packages/stac_core/lib/types/types.dart b/packages/stac_core/lib/types/types.dart deleted file mode 100644 index 3e84b8ba..00000000 --- a/packages/stac_core/lib/types/types.dart +++ /dev/null @@ -1,55 +0,0 @@ -library; - -export 'stac_alignment_directional.dart'; -export 'stac_border_radius/stac_border_radius.dart'; -export 'stac_border_side/stac_border_side.dart'; -export 'stac_drag_start_behavior.dart'; -export 'stac_duration/stac_duration.dart'; -export 'stac_floating_action_button_location.dart'; -export 'stac_hit_test_behavior.dart'; -export 'stac_clip.dart'; -export 'stac_icon_type.dart'; -export 'stac_list_tile_style.dart'; -export 'stac_list_tile_title_alignment.dart'; -export 'stac_mouse_cursor.dart'; -export 'stac_refresh_indicator_trigger_mode.dart'; -export 'stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; -export 'stac_scroll_physics.dart'; -export 'stac_scroll_view_keyboard_dismiss_behavior.dart'; -export 'stac_shadow/stac_shadow.dart'; -export 'stac_size/stac_size.dart'; -export 'stac_text_input_types.dart'; -export 'stac_visual_density/stac_visual_density.dart'; -export 'stac_text_types.dart'; -export 'stac_smart_dashes_type.dart'; -export 'stac_smart_quotes_type.dart'; -export 'stac_max_length_enforcement.dart'; -export 'stac_brightness.dart'; -export 'stac_autovalidate_mode.dart'; -export 'stac_input_formatter/stac_input_formatter.dart'; -export 'stac_form_field_validator/stac_form_field_validator.dart'; -export 'stac_radio_type.dart'; -export 'stac_slider_interaction.dart'; -export 'stac_slider_type.dart'; -export 'stac_switch_type.dart'; -export 'stac_blend_mode.dart'; -export 'stac_image_filter/stac_image_filter.dart'; -export 'stac_rect/stac_rect.dart'; -export 'stac_rect_tween/stac_rect_tween.dart'; -export 'stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart'; -export 'stac_axis.dart'; -export 'stac_tab_bar_indicator_size.dart'; -export 'stac_tab_alignment.dart'; -export 'stac_carousel_view_type.dart'; -export 'stac_options_view_open_direction.dart'; -export 'stac_dropdown_menu_close_behavior.dart'; -export 'stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; -export 'stac_input_border/stac_input_border.dart'; -export 'stac_overflow_bar_alignment.dart'; -export 'stac_table/stac_table_border.dart'; -export 'stac_table/stac_table_column_width.dart'; -export 'stac_table/stac_table_cell_vertical_alignment.dart'; -export 'stac_dialog_traversal_edge_behavior.dart'; -export 'stac_snack_bar_behavior.dart'; -export 'stac_dismiss_direction.dart'; -export 'stac_stroke_cap.dart'; diff --git a/packages/stac_core/lib/widgets/alert_dialog/stac_alert_dialog.dart b/packages/stac_core/lib/widgets/alert_dialog/stac_alert_dialog.dart index e6a456b4..aea1e7b8 100644 --- a/packages/stac_core/lib/widgets/alert_dialog/stac_alert_dialog.dart +++ b/packages/stac_core/lib/widgets/alert_dialog/stac_alert_dialog.dart @@ -1,15 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_main_axis_alignment.dart'; -import 'package:stac_core/types/stac_overflow_bar_alignment.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; -import 'package:stac_core/types/stac_vertical_direction.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_alert_dialog.g.dart'; @@ -168,7 +160,7 @@ class StacAlertDialog extends StacWidget { /// Widget type identifier. @override - String get type => 'alertDialog'; + String get type => WidgetType.alertDialog.name; /// Creates a [StacAlertDialog] from a JSON map. factory StacAlertDialog.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/app_bar/stac_app_bar.dart b/packages/stac_core/lib/widgets/app_bar/stac_app_bar.dart index b14e77f0..41a004e8 100644 --- a/packages/stac_core/lib/widgets/app_bar/stac_app_bar.dart +++ b/packages/stac_core/lib/widgets/app_bar/stac_app_bar.dart @@ -1,15 +1,40 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_app_bar.g.dart'; +/// A Stac model representing Flutter's [AppBar] widget. +/// +/// Displays a Material Design app bar at the top of the app. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacAppBar( +/// title: StacText(data: 'Page Title'), +/// actions: [ +/// StacIconButton(icon: StacIcon(icon: StacIcons.search)), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "appBar", +/// "title": {"type": "text", "data": "Page Title"}, +/// "actions": [ +/// {"type": "iconButton", "icon": {"type": "icon", "icon": "search"}} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacAppBar extends StacWidget { + /// Creates an app bar with the specified properties. StacAppBar({ this.leading, this.automaticallyImplyLeading, @@ -40,66 +65,94 @@ class StacAppBar extends StacWidget { this.actionsPadding, }); + /// A widget to display before the [title], typically a navigation button. final StacWidget? leading; + /// Whether to imply a [leading] widget (e.g., back button) if none is provided. final bool? automaticallyImplyLeading; + /// The primary widget displayed in the app bar, usually a [StacText]. final StacWidget? title; + /// Widgets to display after the [title], typically action buttons. final List? actions; + /// A widget stacked behind the toolbar and tab bar. Extends under the status bar. final StacWidget? flexibleSpace; + /// A widget displayed at the bottom of the app bar, typically a tab bar. final StacWidget? bottom; + /// The elevation of the app bar's material. final double? elevation; + /// The elevation to use when content is scrolled under the app bar. final double? scrolledUnderElevation; + /// The color of the shadow cast by the app bar's elevation. final StacColor? shadowColor; + /// The color used for the app bar's surface tint overlay. final StacColor? surfaceTintColor; // Todo: Add support for shape // final shape; + /// The background color of the app bar. final StacColor? backgroundColor; + /// The default color for text and icons within the app bar. final StacColor? foregroundColor; // final iconTheme; // final actionsIconTheme; + /// Whether this app bar is part of the app's primary scaffold. final bool? primary; + /// Whether the [title] should be centered. final bool? centerTitle; + /// Whether to exclude the app bar from the semantics tree header. final bool? excludeHeaderSemantics; + /// Spacing around the [title]. When [leading] is null, spacing before the title. final double? titleSpacing; + /// Opacity for the toolbar portion of the app bar. final double? toolbarOpacity; + /// Opacity for the [bottom] widget of the app bar. final double? bottomOpacity; + /// The height of the toolbar portion of the app bar. final double? toolbarHeight; + /// The width allocated for the [leading] widget. final double? leadingWidth; + /// The text style for the toolbar widgets. final StacTextStyle? toolbarTextStyle; + /// The text style for the [title] widget. final StacTextStyle? titleTextStyle; + /// The style to use for system overlays (status bar icons, etc.). final StacSystemUIOverlayStyle? systemOverlayStyle; + /// Whether to remove background and elevation for a transparent Material effect. final bool? forceMaterialTransparency; + /// Whether to use the default semantics order for toolbar and [bottom]. final bool? useDefaultSemanticsOrder; + /// How to clip the content of the app bar. final StacClip? clipBehavior; + /// Outer padding applied around the [actions] row. final StacEdgeInsets? actionsPadding; + /// Creates a [StacAppBar] from a JSON map. factory StacAppBar.fromJson(Map json) => _$StacAppBarFromJson(json); @@ -107,5 +160,5 @@ class StacAppBar extends StacWidget { Map toJson() => _$StacAppBarToJson(this); @override - String get type => 'appBar'; + String get type => WidgetType.appBar.name; } diff --git a/packages/stac_core/lib/widgets/aspect_ratio/stac_aspect_ratio.dart b/packages/stac_core/lib/widgets/aspect_ratio/stac_aspect_ratio.dart index e66a78b1..6d3923b6 100644 --- a/packages/stac_core/lib/widgets/aspect_ratio/stac_aspect_ratio.dart +++ b/packages/stac_core/lib/widgets/aspect_ratio/stac_aspect_ratio.dart @@ -1,21 +1,52 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_aspect_ratio.g.dart'; +/// A Stac model representing Flutter's [AspectRatio] widget. +/// +/// Constrains its [child] to a specific width-to-height ratio. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacAspectRatio( +/// aspectRatio: 16 / 9, +/// child: StacContainer(color: '#FF0000'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "aspectRatio", +/// "aspectRatio": 1.7778, +/// "child": {"type": "container", "color": "#FF0000"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacAspectRatio extends StacWidget { + /// Creates an aspect ratio widget with the specified ratio and child. const StacAspectRatio({required this.aspectRatio, required this.child}); + /// The width-to-height ratio to honor for laying out the [child]. + /// + /// For example, `16 / 9` (≈1.7778) or `1.0` for a square. @DoubleConverter() final double aspectRatio; + /// The widget to display inside the constrained aspect ratio box. final StacWidget? child; @override - String get type => 'aspectRatio'; + String get type => WidgetType.aspectRatio.name; + /// Creates a [StacAspectRatio] from a JSON map. factory StacAspectRatio.fromJson(Map json) => _$StacAspectRatioFromJson(json); diff --git a/packages/stac_core/lib/widgets/auto_complete/stac_auto_complete.dart b/packages/stac_core/lib/widgets/auto_complete/stac_auto_complete.dart index 8809d7b8..e63f6633 100644 --- a/packages/stac_core/lib/widgets/auto_complete/stac_auto_complete.dart +++ b/packages/stac_core/lib/widgets/auto_complete/stac_auto_complete.dart @@ -2,7 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_options_view_open_direction.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_auto_complete.g.dart'; @@ -69,7 +69,7 @@ class StacAutoComplete extends StacWidget { /// Widget type identifier. @override - String get type => 'autoComplete'; + String get type => WidgetType.autocomplete.name; /// Creates a [StacAutoComplete] from a JSON map. factory StacAutoComplete.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/backdrop_filter/stac_backdrop_filter.dart b/packages/stac_core/lib/widgets/backdrop_filter/stac_backdrop_filter.dart index 12fd4b0e..64461cee 100644 --- a/packages/stac_core/lib/widgets/backdrop_filter/stac_backdrop_filter.dart +++ b/packages/stac_core/lib/widgets/backdrop_filter/stac_backdrop_filter.dart @@ -1,7 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_blend_mode.dart'; -import 'package:stac_core/types/stac_image_filter/stac_image_filter.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_backdrop_filter.g.dart'; @@ -57,7 +56,7 @@ class StacBackdropFilter extends StacWidget { /// Widget type identifier. @override - String get type => 'backdropFilter'; + String get type => WidgetType.backdropFilter.name; /// Creates a [StacBackdropFilter] from JSON. factory StacBackdropFilter.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/bottom_navigation_bar/stac_bottom_navigation_bar.dart b/packages/stac_core/lib/widgets/bottom_navigation_bar/stac_bottom_navigation_bar.dart index db27eab1..1f3a017f 100644 --- a/packages/stac_core/lib/widgets/bottom_navigation_bar/stac_bottom_navigation_bar.dart +++ b/packages/stac_core/lib/widgets/bottom_navigation_bar/stac_bottom_navigation_bar.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_bottom_navigation_bar_item/stac_bottom_navigation_bar_item.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_bottom_navigation_bar.g.dart'; @@ -36,6 +35,7 @@ part 'stac_bottom_navigation_bar.g.dart'; /// ``` @JsonSerializable(explicitToJson: true) class StacBottomNavigationBar extends StacWidget { + /// Creates a bottom navigation bar widget with the specified properties. const StacBottomNavigationBar({ required this.items, this.elevation, @@ -141,7 +141,7 @@ class StacBottomNavigationBar extends StacWidget { /// Widget type identifier. @override - String get type => 'bottomNavigationBar'; + String get type => WidgetType.bottomNavigationBar.name; /// Creates a [StacBottomNavigationBar] from a JSON map. factory StacBottomNavigationBar.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/bottom_navigation_view/stac_bottom_navigation_view.dart b/packages/stac_core/lib/widgets/bottom_navigation_view/stac_bottom_navigation_view.dart index 73606945..1b56af7e 100644 --- a/packages/stac_core/lib/widgets/bottom_navigation_view/stac_bottom_navigation_view.dart +++ b/packages/stac_core/lib/widgets/bottom_navigation_view/stac_bottom_navigation_view.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_bottom_navigation_view.g.dart'; @@ -96,7 +97,7 @@ class StacBottomNavigationView extends StacWidget { /// Widget type identifier. @override - String get type => 'bottomNavigationView'; + String get type => WidgetType.bottomNavigationView.name; /// Creates a [StacBottomNavigationView] from a JSON map. factory StacBottomNavigationView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/card/stac_card.dart b/packages/stac_core/lib/widgets/card/stac_card.dart index 706fc75b..ff4dead7 100644 --- a/packages/stac_core/lib/widgets/card/stac_card.dart +++ b/packages/stac_core/lib/widgets/card/stac_card.dart @@ -1,10 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_card.g.dart'; @@ -87,7 +84,7 @@ class StacCard extends StacWidget { /// Widget type identifier. @override - String get type => 'card'; + String get type => WidgetType.card.name; /// Creates a [StacCard] from a JSON map. factory StacCard.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/carousel_view/stac_carousel_view.dart b/packages/stac_core/lib/widgets/carousel_view/stac_carousel_view.dart index ccccbda2..12243fb6 100644 --- a/packages/stac_core/lib/widgets/carousel_view/stac_carousel_view.dart +++ b/packages/stac_core/lib/widgets/carousel_view/stac_carousel_view.dart @@ -2,10 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_carousel_view_type.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_carousel_view.g.dart'; @@ -142,7 +139,7 @@ class StacCarouselView extends StacWidget { /// Widget type identifier. @override - String get type => 'carouselView'; + String get type => WidgetType.carouselView.name; /// Creates a [StacCarouselView] from a JSON map. factory StacCarouselView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/center/stac_center.dart b/packages/stac_core/lib/widgets/center/stac_center.dart index 0b047f4d..731991bf 100644 --- a/packages/stac_core/lib/widgets/center/stac_center.dart +++ b/packages/stac_core/lib/widgets/center/stac_center.dart @@ -1,21 +1,54 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_center.g.dart'; +/// A Stac model representing Flutter's [Center] widget. +/// +/// Centers its [child] within itself, optionally expanding based on +/// [widthFactor] and [heightFactor]. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacCenter( +/// child: StacText(data: 'Hello world'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "center", +/// "child": {"type": "text", "data": "Hello world"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacCenter extends StacWidget { - StacCenter({this.widthFactor, this.heightFactor, this.child}); + /// Creates a center widget with optional sizing factors and child. + const StacCenter({this.widthFactor, this.heightFactor, this.child}); + /// The width factor to expand to based on the child's width. + /// + /// If null, the width is unconstrained and the child is simply centered. @DoubleConverter() final double? widthFactor; + /// The height factor to expand to based on the child's height. + /// + /// If null, the height is unconstrained and the child is simply centered. @DoubleConverter() final double? heightFactor; + /// The widget to be centered. final StacWidget? child; + /// Creates a [StacCenter] from a JSON map. factory StacCenter.fromJson(Map json) => _$StacCenterFromJson(json); @@ -23,5 +56,5 @@ class StacCenter extends StacWidget { Map toJson() => _$StacCenterToJson(this); @override - String get type => 'center'; + String get type => WidgetType.center.name; } diff --git a/packages/stac_core/lib/widgets/check_box/stac_check_box.dart b/packages/stac_core/lib/widgets/check_box/stac_check_box.dart index cad1f509..56eb30b7 100644 --- a/packages/stac_core/lib/widgets/check_box/stac_check_box.dart +++ b/packages/stac_core/lib/widgets/check_box/stac_check_box.dart @@ -2,9 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_check_box.g.dart'; @@ -130,7 +128,7 @@ class StacCheckBox extends StacWidget { /// Widget type identifier. @override - String get type => 'checkBox'; + String get type => WidgetType.checkBox.name; /// Creates a [StacCheckBox] from a JSON map. factory StacCheckBox.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/chip/stac_chip.dart b/packages/stac_core/lib/widgets/chip/stac_chip.dart index b4f43793..9c26318e 100644 --- a/packages/stac_core/lib/widgets/chip/stac_chip.dart +++ b/packages/stac_core/lib/widgets/chip/stac_chip.dart @@ -2,14 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_border_side/stac_border_side.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; -import 'package:stac_core/types/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_chip.g.dart'; @@ -150,7 +143,7 @@ class StacChip extends StacWidget { /// Widget type identifier. @override - String get type => 'chip'; + String get type => WidgetType.chip.name; /// Creates a [StacChip] from a JSON map. factory StacChip.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/circle_avatar/stac_circle_avatar.dart b/packages/stac_core/lib/widgets/circle_avatar/stac_circle_avatar.dart index 74c13f73..22861c30 100644 --- a/packages/stac_core/lib/widgets/circle_avatar/stac_circle_avatar.dart +++ b/packages/stac_core/lib/widgets/circle_avatar/stac_circle_avatar.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_circle_avatar.g.dart'; @@ -80,7 +80,7 @@ class StacCircleAvatar extends StacWidget { /// Widget type identifier. @override - String get type => 'circleAvatar'; + String get type => WidgetType.circleAvatar.name; /// Creates a [StacCircleAvatar] from a JSON map. factory StacCircleAvatar.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/circular_progress_indicator/stac_circular_progress_indicator.dart b/packages/stac_core/lib/widgets/circular_progress_indicator/stac_circular_progress_indicator.dart index 24bc7fe2..124ea21e 100644 --- a/packages/stac_core/lib/widgets/circular_progress_indicator/stac_circular_progress_indicator.dart +++ b/packages/stac_core/lib/widgets/circular_progress_indicator/stac_circular_progress_indicator.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_stroke_cap.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_circular_progress_indicator.g.dart'; @@ -79,7 +78,7 @@ class StacCircularProgressIndicator extends StacWidget { /// Widget type identifier. @override - String get type => 'circularProgressIndicator'; + String get type => WidgetType.circularProgressIndicator.name; /// Creates a [StacCircularProgressIndicator] from a JSON map. factory StacCircularProgressIndicator.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/clip_oval/stac_clip_oval.dart b/packages/stac_core/lib/widgets/clip_oval/stac_clip_oval.dart index 9a170cad..48365c75 100644 --- a/packages/stac_core/lib/widgets/clip_oval/stac_clip_oval.dart +++ b/packages/stac_core/lib/widgets/clip_oval/stac_clip_oval.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_clip_oval.g.dart'; @@ -48,7 +48,7 @@ class StacClipOval extends StacWidget { /// Widget type identifier. @override - String get type => 'clipOval'; + String get type => WidgetType.clipOval.name; /// Creates a [StacClipOval] from a JSON map. factory StacClipOval.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/clip_rrect/stac_clip_rrect.dart b/packages/stac_core/lib/widgets/clip_rrect/stac_clip_rrect.dart index 6f218df9..5c1a6b75 100644 --- a/packages/stac_core/lib/widgets/clip_rrect/stac_clip_rrect.dart +++ b/packages/stac_core/lib/widgets/clip_rrect/stac_clip_rrect.dart @@ -1,7 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_clip_rrect.g.dart'; @@ -50,7 +49,7 @@ class StacClipRRect extends StacWidget { /// Widget type identifier. @override - String get type => 'clipRRect'; + String get type => WidgetType.clipRRect.name; /// Creates a [StacClipRRect] from a JSON map. factory StacClipRRect.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/colored_box/stac_colored_box.dart b/packages/stac_core/lib/widgets/colored_box/stac_colored_box.dart index b5b9e170..df899fe2 100644 --- a/packages/stac_core/lib/widgets/colored_box/stac_colored_box.dart +++ b/packages/stac_core/lib/widgets/colored_box/stac_colored_box.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_colored_box.g.dart'; @@ -45,7 +45,7 @@ class StacColoredBox extends StacWidget { /// Widget type identifier. @override - String get type => 'coloredBox'; + String get type => WidgetType.coloredBox.name; /// Creates a [StacColoredBox] from a JSON map. factory StacColoredBox.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/column/stac_column.dart b/packages/stac_core/lib/widgets/column/stac_column.dart index dfd0a724..7e2c9de3 100644 --- a/packages/stac_core/lib/widgets/column/stac_column.dart +++ b/packages/stac_core/lib/widgets/column/stac_column.dart @@ -1,16 +1,47 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_cross_axis_alignment.dart'; -import 'package:stac_core/types/stac_main_axis_alignment.dart'; -import 'package:stac_core/types/stac_main_axis_size.dart'; -import 'package:stac_core/types/stac_text_types.dart'; -import 'package:stac_core/types/stac_vertical_direction.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_column.g.dart'; +/// A Stac model representing Flutter's [Column] widget. +/// +/// Lays out its [children] in a vertical array. You can control how the +/// children are laid out along the main axis and the cross axis via +/// [mainAxisAlignment], [mainAxisSize], and [crossAxisAlignment]. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacColumn( +/// spacing: 8, +/// mainAxisAlignment: StacMainAxisAlignment.center, +/// children: const [ +/// StacText(data: 'One'), +/// StacText(data: 'Two'), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "column", +/// "spacing": 8, +/// "mainAxisAlignment": "center", +/// "children": [ +/// {"type": "text", "data": "One"}, +/// {"type": "text", "data": "Two"} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacColumn extends StacWidget { + /// Creates a column widget with optional alignment and children. const StacColumn({ this.mainAxisAlignment, this.mainAxisSize, @@ -22,26 +53,49 @@ class StacColumn extends StacWidget { this.children, }); + /// How the children should be placed along the vertical (main) axis. + /// + /// Type: [StacMainAxisAlignment] final StacMainAxisAlignment? mainAxisAlignment; + /// How much space should be occupied in the vertical direction. + /// + /// Type: [StacMainAxisSize] final StacMainAxisSize? mainAxisSize; + /// How the children should be placed along the horizontal (cross) axis. + /// + /// Type: [StacCrossAxisAlignment] final StacCrossAxisAlignment? crossAxisAlignment; + /// The text direction to use for resolving alignment. + /// + /// Type: [StacTextDirection] final StacTextDirection? textDirection; + /// The vertical direction in which children are ordered. + /// + /// Type: [StacVerticalDirection] final StacVerticalDirection? verticalDirection; + /// The baseline to use for aligning text. + /// + /// Type: [StacTextBaseline] final StacTextBaseline? textBaseline; + /// The space to insert between adjacent [children]. + /// + /// When provided, a fixed gap of this size is applied between items. @DoubleConverter() final double? spacing; + /// The list of widgets arranged vertically. final List? children; @override - String get type => 'column'; + String get type => WidgetType.column.name; + /// Creates a [StacColumn] from a JSON map. factory StacColumn.fromJson(Map json) => _$StacColumnFromJson(json); diff --git a/packages/stac_core/lib/widgets/conditional/stac_conditional.dart b/packages/stac_core/lib/widgets/conditional/stac_conditional.dart index 30973aea..88ebc610 100644 --- a/packages/stac_core/lib/widgets/conditional/stac_conditional.dart +++ b/packages/stac_core/lib/widgets/conditional/stac_conditional.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_conditional.g.dart'; @@ -56,7 +57,7 @@ class StacConditional extends StacWidget { /// Widget type identifier. @override - String get type => 'conditional'; + String get type => WidgetType.conditional.name; /// Creates a [StacConditional] from a JSON map. factory StacConditional.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/container/stac_container.dart b/packages/stac_core/lib/widgets/container/stac_container.dart index ba7b2360..205e3c42 100644 --- a/packages/stac_core/lib/widgets/container/stac_container.dart +++ b/packages/stac_core/lib/widgets/container/stac_container.dart @@ -1,12 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_box_decoration/stac_box_decoration.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_container.g.dart'; @@ -91,7 +86,7 @@ class StacContainer extends StacWidget { /// Widget type identifier. @override - String get type => 'container'; + String get type => WidgetType.container.name; /// Creates a [StacContainer] from JSON. factory StacContainer.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/custom_scroll_view/stac_custom_scroll_view.dart b/packages/stac_core/lib/widgets/custom_scroll_view/stac_custom_scroll_view.dart index 0dab5d39..6c6a19b3 100644 --- a/packages/stac_core/lib/widgets/custom_scroll_view/stac_custom_scroll_view.dart +++ b/packages/stac_core/lib/widgets/custom_scroll_view/stac_custom_scroll_view.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_custom_scroll_view.g.dart'; @@ -142,7 +142,7 @@ class StacCustomScrollView extends StacWidget { /// Widget type identifier. @override - String get type => 'customScrollView'; + String get type => WidgetType.customScrollView.name; /// Creates a [StacCustomScrollView] from a JSON map. factory StacCustomScrollView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/default_tab_controller/stac_default_tab_controller.dart b/packages/stac_core/lib/widgets/default_tab_controller/stac_default_tab_controller.dart index 3b016274..b1839462 100644 --- a/packages/stac_core/lib/widgets/default_tab_controller/stac_default_tab_controller.dart +++ b/packages/stac_core/lib/widgets/default_tab_controller/stac_default_tab_controller.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_duration/stac_duration.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_default_tab_controller.g.dart'; @@ -58,7 +58,7 @@ class StacDefaultTabController extends StacWidget { /// Widget type identifier. @override - String get type => 'defaultTabController'; + String get type => WidgetType.defaultTabController.name; /// Creates a [StacDefaultTabController] from a JSON map. factory StacDefaultTabController.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/divider/stac_divider.dart b/packages/stac_core/lib/widgets/divider/stac_divider.dart index 6f2ab603..3f365c1c 100644 --- a/packages/stac_core/lib/widgets/divider/stac_divider.dart +++ b/packages/stac_core/lib/widgets/divider/stac_divider.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_divider.g.dart'; @@ -71,7 +71,7 @@ class StacDivider extends StacWidget { final StacColor? color; @override - String get type => 'divider'; + String get type => WidgetType.divider.name; /// Creates a [StacDivider] from a JSON map. factory StacDivider.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/drawer/stac_drawer.dart b/packages/stac_core/lib/widgets/drawer/stac_drawer.dart index 8244d1d2..f82dcd33 100644 --- a/packages/stac_core/lib/widgets/drawer/stac_drawer.dart +++ b/packages/stac_core/lib/widgets/drawer/stac_drawer.dart @@ -1,9 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_drawer.g.dart'; @@ -100,7 +98,7 @@ class StacDrawer extends StacWidget { /// Widget type identifier for this model. @override - String get type => 'drawer'; + String get type => WidgetType.drawer.name; /// Creates a [StacDrawer] from a JSON map. factory StacDrawer.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/dropdown_menu/stac_dropdown_menu.dart b/packages/stac_core/lib/widgets/dropdown_menu/stac_dropdown_menu.dart index 8e6f7257..c7770680 100644 --- a/packages/stac_core/lib/widgets/dropdown_menu/stac_dropdown_menu.dart +++ b/packages/stac_core/lib/widgets/dropdown_menu/stac_dropdown_menu.dart @@ -1,15 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/theme/stac_input_decoration_theme/stac_input_decoration_theme.dart'; -import 'package:stac_core/types/stac_dropdown_menu_close_behavior.dart'; -import 'package:stac_core/types/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart'; -import 'package:stac_core/types/stac_input_formatter/stac_input_formatter.dart'; -import 'package:stac_core/types/stac_offset/stac_offset.dart'; -import 'package:stac_core/types/stac_text_input_types.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_dropdown_menu.g.dart'; @@ -149,7 +141,7 @@ class StacDropdownMenu extends StacWidget { /// Widget type identifier. @override - String get type => 'dropdownMenu'; + String get type => WidgetType.dropdownMenu.name; /// Creates a [StacDropdownMenu] from a JSON map. factory StacDropdownMenu.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/dynamic_view/stac_dynamic_view.dart b/packages/stac_core/lib/widgets/dynamic_view/stac_dynamic_view.dart index abe4fecd..17b35e5e 100644 --- a/packages/stac_core/lib/widgets/dynamic_view/stac_dynamic_view.dart +++ b/packages/stac_core/lib/widgets/dynamic_view/stac_dynamic_view.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/network_request/stac_network_request.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_dynamic_view.g.dart'; @@ -82,7 +83,7 @@ class StacDynamicView extends StacWidget { /// Widget type identifier. @override - String get type => 'dynamicView'; + String get type => WidgetType.dynamicView.name; /// Creates a [StacDynamicView] from a JSON map. factory StacDynamicView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/elevated_button/stac_elevated_button.dart b/packages/stac_core/lib/widgets/elevated_button/stac_elevated_button.dart index 2e83c6fe..ec688e82 100644 --- a/packages/stac_core/lib/widgets/elevated_button/stac_elevated_button.dart +++ b/packages/stac_core/lib/widgets/elevated_button/stac_elevated_button.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_elevated_button.g.dart'; @@ -69,7 +68,7 @@ class StacElevatedButton extends StacWidget { /// Widget type identifier. @override - String get type => 'elevatedButton'; + String get type => WidgetType.elevatedButton.name; /// Creates a [StacElevatedButton] from JSON. factory StacElevatedButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/expanded/stac_expanded.dart b/packages/stac_core/lib/widgets/expanded/stac_expanded.dart index 995a354b..19006c02 100644 --- a/packages/stac_core/lib/widgets/expanded/stac_expanded.dart +++ b/packages/stac_core/lib/widgets/expanded/stac_expanded.dart @@ -1,19 +1,53 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_expanded.g.dart'; +/// A Stac model representing Flutter's [Expanded] widget. +/// +/// Expands a child of a [Row], [Column], or [Flex] so that the child fills +/// the available space in the main axis, according to the [flex] factor. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacRow(children: const [ +/// StacExpanded(child: StacText(data: 'Left')), +/// StacExpanded(flex: 2, child: StacText(data: 'Right (2x)')), +/// ]) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "row", +/// "children": [ +/// {"type": "expanded", "child": {"type": "text", "data": "Left"}}, +/// {"type": "expanded", "flex": 2, "child": {"type": "text", "data": "Right (2x)"}} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacExpanded extends StacWidget { + /// Creates an expanded widget with optional flex factor and child. const StacExpanded({this.flex, this.child}); + /// The flex factor to use for this child. + /// + /// If null, defaults to 1. Higher values take more space in the main axis. final int? flex; + /// The widget that is expanded within its parent [Flex] layout. final StacWidget? child; @override - String get type => 'expanded'; + String get type => WidgetType.expanded.name; + /// Creates a [StacExpanded] from a JSON map. factory StacExpanded.fromJson(Map json) => _$StacExpandedFromJson(json); diff --git a/packages/stac_core/lib/widgets/filled_button/stac_filled_button.dart b/packages/stac_core/lib/widgets/filled_button/stac_filled_button.dart index b2f41389..c834045a 100644 --- a/packages/stac_core/lib/widgets/filled_button/stac_filled_button.dart +++ b/packages/stac_core/lib/widgets/filled_button/stac_filled_button.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_filled_button.g.dart'; @@ -69,7 +68,7 @@ class StacFilledButton extends StacWidget { /// Widget type identifier. @override - String get type => 'filledButton'; + String get type => WidgetType.filledButton.name; /// Creates a [StacFilledButton] from JSON. factory StacFilledButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/fitted_box/stac_fitted_box.dart b/packages/stac_core/lib/widgets/fitted_box/stac_fitted_box.dart index 901a58ba..b9d07e57 100644 --- a/packages/stac_core/lib/widgets/fitted_box/stac_fitted_box.dart +++ b/packages/stac_core/lib/widgets/fitted_box/stac_fitted_box.dart @@ -1,13 +1,39 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_box_fit.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_fitted_box.g.dart'; +/// A Stac widget that scales and positions its child within itself. +/// +/// This widget corresponds to Flutter's FittedBox and scales its child +/// to fit within the available space according to the specified fit and alignment. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacFittedBox( +/// fit: StacBoxFit.contain, +/// alignment: StacAlignment.center, +/// child: StacText(data: 'Fitted content'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "fittedBox", +/// "fit": "contain", +/// "alignment": "center", +/// "child": {"type": "text", "data": "Fitted content"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacFittedBox extends StacWidget { + /// Creates a [StacFittedBox] that scales and positions its [child]. const StacFittedBox({ this.fit, this.alignment, @@ -15,20 +41,27 @@ class StacFittedBox extends StacWidget { this.child, }); + /// How the child should be scaled to fit within the box. final StacBoxFit? fit; + /// How to align the child within the box. final StacAlignment? alignment; + /// How to clip the child if it overflows. final StacClip? clipBehavior; + /// The widget to scale and position. final StacWidget? child; + /// Widget type identifier. @override - String get type => 'fittedBox'; + String get type => WidgetType.fittedBox.name; + /// Creates a [StacFittedBox] from a JSON map. factory StacFittedBox.fromJson(Map json) => _$StacFittedBoxFromJson(json); + /// Converts this [StacFittedBox] instance to a JSON map. @override Map toJson() => _$StacFittedBoxToJson(this); } diff --git a/packages/stac_core/lib/widgets/flexible/stac_flexible.dart b/packages/stac_core/lib/widgets/flexible/stac_flexible.dart index ba808f28..b2fff3db 100644 --- a/packages/stac_core/lib/widgets/flexible/stac_flexible.dart +++ b/packages/stac_core/lib/widgets/flexible/stac_flexible.dart @@ -1,25 +1,69 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_flex_fit.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_flexible.g.dart'; +/// A Stac model representing Flutter's [Flexible] widget. +/// +/// Controls how a child of a [Row], [Column], or [Flex] flexes (expands or +/// contracts) to fill the available space along the main axis. Use [fit] to +/// specify whether the child can be smaller than the space allocated by its +/// [flex] factor. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacRow(children: const [ +/// StacFlexible(flex: 1, child: StacText(data: 'Left')), +/// StacFlexible(flex: 2, fit: StacFlexFit.tight, child: StacText(data: 'Right')), +/// ]) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "row", +/// "children": [ +/// {"type": "flexible", "flex": 1, "child": {"type": "text", "data": "Left"}}, +/// {"type": "flexible", "flex": 2, "fit": "tight", "child": {"type": "text", "data": "Right"}} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacFlexible extends StacWidget { + /// Creates a [StacFlexible] that controls how its [child] flexes within + /// a [Row], [Column], or [Flex]. const StacFlexible({this.flex, this.fit, required this.child}); + /// The flex factor to use for this child. + /// + /// If null, defaults to 1. Higher values take proportionally more + /// of the available main axis space. final int? flex; + /// How this child is inscribed into the allocated space. + /// + /// Type: [StacFlexFit]. When [StacFlexFit.tight], the child is forced to + /// fill the allocated space; when [StacFlexFit.loose], the child can be + /// at most as large as the allocated space. final StacFlexFit? fit; + /// The widget controlled by this [Flexible]. final StacWidget? child; + /// Widget type identifier. @override - String get type => 'flexible'; + String get type => WidgetType.flexible.name; + /// Creates a [StacFlexible] from a JSON map. factory StacFlexible.fromJson(Map json) => _$StacFlexibleFromJson(json); + /// Converts this [StacFlexible] instance to a JSON map. @override Map toJson() => _$StacFlexibleToJson(this); } diff --git a/packages/stac_core/lib/widgets/floating_action_button/stac_floating_action_button.dart b/packages/stac_core/lib/widgets/floating_action_button/stac_floating_action_button.dart index d00fc247..49953764 100644 --- a/packages/stac_core/lib/widgets/floating_action_button/stac_floating_action_button.dart +++ b/packages/stac_core/lib/widgets/floating_action_button/stac_floating_action_button.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_floating_action_button_type.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_floating_action_button.g.dart'; @@ -122,7 +121,7 @@ class StacFloatingActionButton extends StacWidget { /// Widget type identifier. @override - String get type => 'floatingActionButton'; + String get type => WidgetType.floatingActionButton.name; /// Creates a [StacFloatingActionButton] from JSON. factory StacFloatingActionButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/form/stac_form.dart b/packages/stac_core/lib/widgets/form/stac_form.dart index 5a075f23..d97706f8 100644 --- a/packages/stac_core/lib/widgets/form/stac_form.dart +++ b/packages/stac_core/lib/widgets/form/stac_form.dart @@ -54,7 +54,7 @@ class StacForm extends StacWidget { /// Widget type identifier. @override - String get type => 'form'; + String get type => WidgetType.form.name; /// Creates a [StacForm] from a JSON map. factory StacForm.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/fractionally_sized_box/stac_fractionally_sized_box.dart b/packages/stac_core/lib/widgets/fractionally_sized_box/stac_fractionally_sized_box.dart index d62a94f0..bcbb8770 100644 --- a/packages/stac_core/lib/widgets/fractionally_sized_box/stac_fractionally_sized_box.dart +++ b/packages/stac_core/lib/widgets/fractionally_sized_box/stac_fractionally_sized_box.dart @@ -1,12 +1,42 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_alignment.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_fractionally_sized_box.g.dart'; +/// A Stac widget that sizes its child to a fraction of the available space. +/// +/// This widget corresponds to Flutter's FractionallySizedBox and sizes its +/// child to a fraction of the total available space. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacFractionallySizedBox( +/// widthFactor: 0.8, +/// heightFactor: 0.6, +/// alignment: StacAlignment.center, +/// child: StacContainer(color: '#FF0000'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "fractionallySizedBox", +/// "widthFactor": 0.8, +/// "heightFactor": 0.6, +/// "alignment": "center", +/// "child": {"type": "container", "color": "#FF0000"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacFractionallySizedBox extends StacWidget { + /// Creates a fractionally sized box with optional size factors and alignment. const StacFractionallySizedBox({ this.widthFactor, this.heightFactor, @@ -14,19 +44,24 @@ class StacFractionallySizedBox extends StacWidget { this.child, }); + /// The fraction of the available width to use (0.0 to 1.0). @DoubleConverter() final double? widthFactor; + /// The fraction of the available height to use (0.0 to 1.0). @DoubleConverter() final double? heightFactor; + /// How to align the child within the available space. final StacAlignment? alignment; + /// The widget to size fractionally. final StacWidget? child; @override - String get type => 'fractionallySizedBox'; + String get type => WidgetType.fractionallySizedBox.name; + /// Creates a [StacFractionallySizedBox] from a JSON map. factory StacFractionallySizedBox.fromJson(Map json) => _$StacFractionallySizedBoxFromJson(json); diff --git a/packages/stac_core/lib/widgets/gesture_detector/stac_gesture_detector.dart b/packages/stac_core/lib/widgets/gesture_detector/stac_gesture_detector.dart index e7470ea3..9cb4abd0 100644 --- a/packages/stac_core/lib/widgets/gesture_detector/stac_gesture_detector.dart +++ b/packages/stac_core/lib/widgets/gesture_detector/stac_gesture_detector.dart @@ -321,7 +321,7 @@ class StacGestureDetector extends StacWidget { /// Widget type identifier. @override - String get type => 'GestureDetector'; + String get type => WidgetType.gestureDetector.name; /// Creates a [StacGestureDetector] from JSON. factory StacGestureDetector.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/grid_view/stac_grid_view.dart b/packages/stac_core/lib/widgets/grid_view/stac_grid_view.dart index 6672c781..cb46ab86 100644 --- a/packages/stac_core/lib/widgets/grid_view/stac_grid_view.dart +++ b/packages/stac_core/lib/widgets/grid_view/stac_grid_view.dart @@ -1,12 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; -import 'package:stac_core/types/stac_scroll_view_keyboard_dismiss_behavior.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_grid_view.g.dart'; @@ -163,7 +158,7 @@ class StacGridView extends StacWidget { /// Widget type identifier. @override - String get type => 'gridView'; + String get type => WidgetType.gridView.name; /// Creates a [StacGridView] from a JSON map. factory StacGridView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/hero/stac_hero.dart b/packages/stac_core/lib/widgets/hero/stac_hero.dart index 8a492a0f..d5fe4593 100644 --- a/packages/stac_core/lib/widgets/hero/stac_hero.dart +++ b/packages/stac_core/lib/widgets/hero/stac_hero.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_rect_tween/stac_rect_tween.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_hero.g.dart'; @@ -65,7 +65,7 @@ class StacHero extends StacWidget { /// Widget type identifier. @override - String get type => 'hero'; + String get type => WidgetType.hero.name; /// Creates a [StacHero] from a JSON map. factory StacHero.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/icon/stac_icon.dart b/packages/stac_core/lib/widgets/icon/stac_icon.dart index 24d28613..d539263b 100644 --- a/packages/stac_core/lib/widgets/icon/stac_icon.dart +++ b/packages/stac_core/lib/widgets/icon/stac_icon.dart @@ -1,10 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_blend_mode.dart'; -import 'package:stac_core/types/stac_icon_type.dart'; -import 'package:stac_core/types/stac_shadow/stac_shadow.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_icon.g.dart'; @@ -33,6 +30,7 @@ part 'stac_icon.g.dart'; /// ``` @JsonSerializable() class StacIcon extends StacWidget { + /// Creates an icon widget with the specified properties. const StacIcon({ required this.icon, this.iconType = StacIconType.material, @@ -95,7 +93,7 @@ class StacIcon extends StacWidget { /// Widget type identifier. @override - String get type => 'icon'; + String get type => WidgetType.icon.name; /// Creates a [StacIcon] from JSON. factory StacIcon.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/icon_button/stac_icon_button.dart b/packages/stac_core/lib/widgets/icon_button/stac_icon_button.dart index eda4d2b9..c109a82b 100644 --- a/packages/stac_core/lib/widgets/icon_button/stac_icon_button.dart +++ b/packages/stac_core/lib/widgets/icon_button/stac_icon_button.dart @@ -1,8 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_box_constraints/stac_box_constraints.dart'; part 'stac_icon_button.g.dart'; @@ -129,7 +126,7 @@ class StacIconButton extends StacWidget { /// Widget type identifier. @override - String get type => 'iconButton'; + String get type => WidgetType.iconButton.name; /// Creates a [StacIconButton] from JSON. factory StacIconButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/image/stac_image.dart b/packages/stac_core/lib/widgets/image/stac_image.dart index bcd671ed..0a447872 100644 --- a/packages/stac_core/lib/widgets/image/stac_image.dart +++ b/packages/stac_core/lib/widgets/image/stac_image.dart @@ -1,17 +1,42 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_box_fit.dart'; -import 'package:stac_core/types/stac_filter_quality.dart'; -import 'package:stac_core/types/stac_image_repeat.dart'; -import 'package:stac_core/types/stac_image_type.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_image.g.dart'; +/// A Stac widget that displays an image. +/// +/// This widget corresponds to Flutter's Image widget and can display +/// images from various sources including assets, network, and files. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacImage( +/// src: 'assets/logo.png', +/// width: 200, +/// height: 100, +/// fit: StacBoxFit.cover, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "image", +/// "src": "assets/logo.png", +/// "width": 200, +/// "height": 100, +/// "fit": "cover" +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacImage extends StacWidget { + /// Creates an image widget with the specified source and options. const StacImage({ required this.src, this.alignment, @@ -26,33 +51,45 @@ class StacImage extends StacWidget { this.excludeFromSemantics, }); + /// The source path or URL of the image to display. final String src; + /// How to align the image within its bounds. final StacAlignment? alignment; + /// The type of image source (asset, network, etc.). final StacImageType? imageType; + /// A color filter to apply to the image. final StacColor? color; + /// The width of the image in logical pixels. @DoubleConverter() final double? width; + /// The height of the image in logical pixels. @DoubleConverter() final double? height; + /// How the image should be inscribed into the space allocated during layout. final StacBoxFit? fit; + /// How the image should be repeated if it doesn't fill its layout bounds. final StacImageRepeat? repeat; + /// The quality level for image filtering operations. final StacFilterQuality? filterQuality; + /// A semantic description of the image for accessibility. final String? semanticLabel; + /// Whether to exclude this image from semantics. final bool? excludeFromSemantics; @override - String get type => 'image'; + String get type => WidgetType.image.name; + /// Creates a [StacImage] from a JSON map. factory StacImage.fromJson(Map json) => _$StacImageFromJson(json); diff --git a/packages/stac_core/lib/widgets/ink_well/stac_ink_well.dart b/packages/stac_core/lib/widgets/ink_well/stac_ink_well.dart index 4342aa40..f93b7ed1 100644 --- a/packages/stac_core/lib/widgets/ink_well/stac_ink_well.dart +++ b/packages/stac_core/lib/widgets/ink_well/stac_ink_well.dart @@ -2,11 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_core/types/stac_duration/stac_duration.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_ink_well.g.dart'; @@ -154,7 +150,7 @@ class StacInkWell extends StacWidget { /// Describes the type of this widget for JSON serialization. @override - String get type => 'inkWell'; + String get type => WidgetType.inkWell.name; /// Creates a [StacInkWell] from a JSON map. factory StacInkWell.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/limited_box/stac_limited_box.dart b/packages/stac_core/lib/widgets/limited_box/stac_limited_box.dart index 7437a132..5e7848ec 100644 --- a/packages/stac_core/lib/widgets/limited_box/stac_limited_box.dart +++ b/packages/stac_core/lib/widgets/limited_box/stac_limited_box.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_limited_box.g.dart'; @@ -47,7 +48,7 @@ class StacLimitedBox extends StacWidget { /// Widget type identifier. @override - String get type => 'limitedBox'; + String get type => WidgetType.limitedBox.name; /// Creates a [StacLimitedBox] from JSON. factory StacLimitedBox.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/list_tile/stac_list_tile.dart b/packages/stac_core/lib/widgets/list_tile/stac_list_tile.dart index 178fe8f2..62132d97 100644 --- a/packages/stac_core/lib/widgets/list_tile/stac_list_tile.dart +++ b/packages/stac_core/lib/widgets/list_tile/stac_list_tile.dart @@ -1,6 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; part 'stac_list_tile.g.dart'; @@ -176,7 +175,7 @@ class StacListTile extends StacWidget { /// Widget type identifier. @override - String get type => 'ListTile'; + String get type => WidgetType.listTile.name; /// Creates a [StacListTile] from a JSON map. factory StacListTile.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/list_view/stac_list_view.dart b/packages/stac_core/lib/widgets/list_view/stac_list_view.dart index 6ff1a3db..fa108c6e 100644 --- a/packages/stac_core/lib/widgets/list_view/stac_list_view.dart +++ b/packages/stac_core/lib/widgets/list_view/stac_list_view.dart @@ -1,12 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; -import 'package:stac_core/types/stac_scroll_view_keyboard_dismiss_behavior.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_list_view.g.dart'; @@ -125,7 +120,7 @@ class StacListView extends StacWidget { /// Widget type identifier. @override - String get type => 'listView'; + String get type => WidgetType.listView.name; /// Creates a [StacListView] from JSON. factory StacListView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/network_widget/stac_network_widget.dart b/packages/stac_core/lib/widgets/network_widget/stac_network_widget.dart index 541d7b21..e910a64e 100644 --- a/packages/stac_core/lib/widgets/network_widget/stac_network_widget.dart +++ b/packages/stac_core/lib/widgets/network_widget/stac_network_widget.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/actions/network_request/stac_network_request.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_network_widget.g.dart'; @@ -44,7 +45,7 @@ class StacNetworkWidget extends StacWidget { /// Widget type identifier. @override - String get type => 'networkWidget'; + String get type => WidgetType.networkWidget.name; /// Creates a [StacNetworkWidget] from a JSON map. factory StacNetworkWidget.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/opacity/stac_opacity.dart b/packages/stac_core/lib/widgets/opacity/stac_opacity.dart index 976878e0..72105066 100644 --- a/packages/stac_core/lib/widgets/opacity/stac_opacity.dart +++ b/packages/stac_core/lib/widgets/opacity/stac_opacity.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_opacity.g.dart'; @@ -47,7 +48,7 @@ class StacOpacity extends StacWidget { /// Widget type identifier. @override - String get type => 'opacity'; + String get type => WidgetType.opacity.name; /// Creates a [StacOpacity] from JSON. factory StacOpacity.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/outlined_button/stac_outlined_button.dart b/packages/stac_core/lib/widgets/outlined_button/stac_outlined_button.dart index 1f89fb7c..b63f50e9 100644 --- a/packages/stac_core/lib/widgets/outlined_button/stac_outlined_button.dart +++ b/packages/stac_core/lib/widgets/outlined_button/stac_outlined_button.dart @@ -1,6 +1,5 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/stac_core.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; part 'stac_outlined_button.g.dart'; @@ -67,7 +66,7 @@ class StacOutlinedButton extends StacWidget { /// Widget type identifier. @override - String get type => 'outlinedButton'; + String get type => WidgetType.outlinedButton.name; /// Creates a [StacOutlinedButton] from JSON. factory StacOutlinedButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/padding/stac_padding.dart b/packages/stac_core/lib/widgets/padding/stac_padding.dart index 0d20ee00..97b8f3f6 100644 --- a/packages/stac_core/lib/widgets/padding/stac_padding.dart +++ b/packages/stac_core/lib/widgets/padding/stac_padding.dart @@ -1,20 +1,54 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/painting.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_padding.g.dart'; +/// A Stac widget that adds padding around its child. +/// +/// This widget corresponds to Flutter's Padding widget and provides +/// space around its child widget using edge insets. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacPadding( +/// padding: StacEdgeInsets.all(16.0), +/// child: StacText(data: 'Padded content'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "padding", +/// "padding": 16.0, +/// "child": { +/// "type": "text", +/// "data": "Padded content" +/// } +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacPadding extends StacWidget { + /// Creates a padding widget with optional padding and child. const StacPadding({this.padding, this.child}); + /// The amount of space to pad the child. + /// + /// If null, no padding is applied. final StacEdgeInsets? padding; + /// The widget to apply padding to. final StacWidget? child; @override - String get type => 'padding'; + String get type => WidgetType.padding.name; + /// Creates a [StacPadding] from a JSON map. factory StacPadding.fromJson(Map json) => _$StacPaddingFromJson(json); diff --git a/packages/stac_core/lib/widgets/page_view/stac_page_view.dart b/packages/stac_core/lib/widgets/page_view/stac_page_view.dart index bb4fe804..88afdd2a 100644 --- a/packages/stac_core/lib/widgets/page_view/stac_page_view.dart +++ b/packages/stac_core/lib/widgets/page_view/stac_page_view.dart @@ -2,10 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_page_view.g.dart'; @@ -111,7 +108,7 @@ class StacPageView extends StacWidget { /// Widget type identifier. @override - String get type => 'pageView'; + String get type => WidgetType.pageView.name; /// Creates a [StacPageView] from a JSON map. factory StacPageView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/placeholder/stac_placeholder.dart b/packages/stac_core/lib/widgets/placeholder/stac_placeholder.dart index c289f240..801afa62 100644 --- a/packages/stac_core/lib/widgets/placeholder/stac_placeholder.dart +++ b/packages/stac_core/lib/widgets/placeholder/stac_placeholder.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_placeholder.g.dart'; @@ -61,7 +62,7 @@ class StacPlaceholder extends StacWidget { /// Widget type identifier. @override - String get type => 'placeholder'; + String get type => WidgetType.placeholder.name; /// Creates a [StacPlaceholder] from a JSON map. factory StacPlaceholder.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/positioned/stac_positioned.dart b/packages/stac_core/lib/widgets/positioned/stac_positioned.dart index fd22c42f..423c4e3c 100644 --- a/packages/stac_core/lib/widgets/positioned/stac_positioned.dart +++ b/packages/stac_core/lib/widgets/positioned/stac_positioned.dart @@ -1,11 +1,41 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_positioned.g.dart'; +/// A Stac widget that controls where a child of a Stack is positioned. +/// +/// This widget corresponds to Flutter's Positioned widget and allows +/// precise positioning of a widget within a Stack using coordinates +/// and optional sizing constraints. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacPositioned( +/// left: 10, +/// top: 20, +/// child: StacText(data: 'Positioned text'), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "positioned", +/// "left": 10, +/// "top": 20, +/// "child": {"type": "text", "data": "Positioned text"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacPositioned extends StacWidget { + /// Creates a positioned widget with optional positioning and sizing. const StacPositioned({ this.left, this.top, @@ -16,29 +46,37 @@ class StacPositioned extends StacWidget { required this.child, }); + /// The distance from the left edge of the stack. @DoubleConverter() final double? left; + /// The distance from the top edge of the stack. @DoubleConverter() final double? top; + /// The distance from the right edge of the stack. @DoubleConverter() final double? right; + /// The distance from the bottom edge of the stack. @DoubleConverter() final double? bottom; + /// The width of the positioned widget. @DoubleConverter() final double? width; + /// The height of the positioned widget. @DoubleConverter() final double? height; + /// The widget to position within the stack. final StacWidget? child; @override - String get type => 'positioned'; + String get type => WidgetType.positioned.name; + /// Creates a [StacPositioned] from a JSON map. factory StacPositioned.fromJson(Map json) => _$StacPositionedFromJson(json); diff --git a/packages/stac_core/lib/widgets/radio/stac_radio.dart b/packages/stac_core/lib/widgets/radio/stac_radio.dart index 443b1d2a..89015fb9 100644 --- a/packages/stac_core/lib/widgets/radio/stac_radio.dart +++ b/packages/stac_core/lib/widgets/radio/stac_radio.dart @@ -2,11 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; -import 'package:stac_core/types/stac_radio_type.dart'; -import 'package:stac_core/types/stac_visual_density/stac_visual_density.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_radio.g.dart'; @@ -140,7 +136,7 @@ class StacRadio extends StacWidget { /// Widget type identifier. @override - String get type => 'radio'; + String get type => WidgetType.radio.name; /// Creates a [StacRadio] from a JSON map. factory StacRadio.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/radio_group/stac_radio_group.dart b/packages/stac_core/lib/widgets/radio_group/stac_radio_group.dart index a902135c..7dcc3040 100644 --- a/packages/stac_core/lib/widgets/radio_group/stac_radio_group.dart +++ b/packages/stac_core/lib/widgets/radio_group/stac_radio_group.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_radio_group.g.dart'; @@ -59,7 +60,7 @@ class StacRadioGroup extends StacWidget { /// Widget type identifier. @override - String get type => 'radioGroup'; + String get type => WidgetType.radioGroup.name; /// Creates a [StacRadioGroup] from a JSON map. factory StacRadioGroup.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/refresh_indicator/stac_refresh_indicator.dart b/packages/stac_core/lib/widgets/refresh_indicator/stac_refresh_indicator.dart index 9304114a..52927636 100644 --- a/packages/stac_core/lib/widgets/refresh_indicator/stac_refresh_indicator.dart +++ b/packages/stac_core/lib/widgets/refresh_indicator/stac_refresh_indicator.dart @@ -2,8 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_refresh_indicator_trigger_mode.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_refresh_indicator.g.dart'; @@ -96,7 +95,7 @@ class StacRefreshIndicator extends StacWidget { /// Widget type identifier. @override - String get type => 'refreshIndicator'; + String get type => WidgetType.refreshIndicator.name; /// Creates a [StacRefreshIndicator] from JSON. factory StacRefreshIndicator.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/row/stac_row.dart b/packages/stac_core/lib/widgets/row/stac_row.dart index 6a1f9b4c..055fa6b6 100644 --- a/packages/stac_core/lib/widgets/row/stac_row.dart +++ b/packages/stac_core/lib/widgets/row/stac_row.dart @@ -1,16 +1,45 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_cross_axis_alignment.dart'; -import 'package:stac_core/types/stac_main_axis_alignment.dart'; -import 'package:stac_core/types/stac_main_axis_size.dart'; -import 'package:stac_core/types/stac_text_types.dart'; -import 'package:stac_core/types/stac_vertical_direction.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_row.g.dart'; +/// A Stac widget that displays its children in a horizontal array. +/// +/// This widget corresponds to Flutter's Row widget and arranges its +/// children horizontally. The main axis runs horizontally and the +/// cross axis runs vertically. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacRow( +/// mainAxisAlignment: StacMainAxisAlignment.spaceBetween, +/// children: [ +/// StacText(data: 'Left'), +/// StacText(data: 'Right'), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "row", +/// "mainAxisAlignment": "spaceBetween", +/// "children": [ +/// {"type": "text", "data": "Left"}, +/// {"type": "text", "data": "Right"} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacRow extends StacWidget { + /// Creates a row widget with optional alignment and children. const StacRow({ this.mainAxisAlignment, this.mainAxisSize, @@ -22,26 +51,35 @@ class StacRow extends StacWidget { this.children, }); + /// How the children should be placed along the main axis (horizontal). final StacMainAxisAlignment? mainAxisAlignment; + /// How much space should be occupied in the main axis. final StacMainAxisSize? mainAxisSize; + /// How the children should be placed along the cross axis (vertical). final StacCrossAxisAlignment? crossAxisAlignment; + /// The text direction to use for resolving alignment. final StacTextDirection? textDirection; + /// The order to lay children out vertically. final StacVerticalDirection? verticalDirection; + /// The baseline to use when aligning text. final StacTextBaseline? textBaseline; + /// The amount of space between each child. @DoubleConverter() final double? spacing; + /// The widgets to display in this row. final List? children; @override - String get type => 'row'; + String get type => WidgetType.row.name; + /// Creates a [StacRow] from a JSON map. factory StacRow.fromJson(Map json) => _$StacRowFromJson(json); diff --git a/packages/stac_core/lib/widgets/safe_area/stac_safe_area.dart b/packages/stac_core/lib/widgets/safe_area/stac_safe_area.dart index 0a8dcd20..cd825d02 100644 --- a/packages/stac_core/lib/widgets/safe_area/stac_safe_area.dart +++ b/packages/stac_core/lib/widgets/safe_area/stac_safe_area.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/painting.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_safe_area.g.dart'; @@ -74,7 +74,7 @@ class StacSafeArea extends StacWidget { /// Widget type identifier. @override - String get type => 'safeArea'; + String get type => WidgetType.safeArea.name; /// Creates a [StacSafeArea] from JSON. factory StacSafeArea.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/scaffold/stac_scaffold.dart b/packages/stac_core/lib/widgets/scaffold/stac_scaffold.dart index c7f0a25f..b27dc2fa 100644 --- a/packages/stac_core/lib/widgets/scaffold/stac_scaffold.dart +++ b/packages/stac_core/lib/widgets/scaffold/stac_scaffold.dart @@ -3,8 +3,42 @@ import 'package:stac_core/stac_core.dart'; part 'stac_scaffold.g.dart'; +/// A Stac widget that implements the basic material design visual layout structure. +/// +/// This widget corresponds to Flutter's Scaffold and provides the basic +/// material design visual layout structure. It provides APIs for showing +/// drawers, snack bars, and bottom sheets. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// const StacScaffold( +/// appBar: StacAppBar(title: StacText(data: 'My App')), +/// body: StacText(data: 'Hello World'), +/// floatingActionButton: StacFloatingActionButton( +/// onPressed: StacNavigateAction(route: '/next'), +/// child: StacIcon(icon: Icons.add), +/// ), +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "scaffold", +/// "appBar": { +/// "type": "appBar", +/// "title": {"type": "text", "data": "My App"} +/// }, +/// "body": {"type": "text", "data": "Hello World"} +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacScaffold extends StacWidget { + /// Creates a scaffold with optional app bar, body, and other components. const StacScaffold({ this.appBar, this.backgroundColor, @@ -31,55 +65,79 @@ class StacScaffold extends StacWidget { this.restorationId, }); + /// An app bar to display at the top of the scaffold. final StacWidget? appBar; + /// The background color of the scaffold. final String? backgroundColor; + /// The primary content of the scaffold. final StacWidget? body; + /// A bottom navigation bar to display at the bottom of the scaffold. final StacWidget? bottomNavigationBar; + /// A persistent bottom sheet to show below the scaffold's body. final StacWidget? bottomSheet; + /// A panel displayed to the side of the body, often hidden on mobile. final StacWidget? drawer; + /// Determines the way that drag start behavior is handled for the drawer. final StacDragStartBehavior? drawerDragStartBehavior; + /// The width of the area within which a horizontal swipe will open the drawer. final double? drawerEdgeDragWidth; + /// Whether the drawer can be opened with a drag gesture. final bool? drawerEnableOpenDragGesture; + /// The color to use for the scrim that obscures primary content while a drawer is open. final String? drawerScrimColor; + /// A panel displayed to the side of the body, typically on the right. final StacWidget? endDrawer; + /// Whether the end drawer can be opened with a drag gesture. final bool? endDrawerEnableOpenDragGesture; + /// Whether the body should extend to the bottom of the scaffold. final bool? extendBody; + /// Whether the body should extend behind the app bar. final bool? extendBodyBehindAppBar; + /// A floating action button to display. final StacWidget? floatingActionButton; + /// Where to position the floating action button. final StacFloatingActionButtonLocation? floatingActionButtonLocation; + /// Action called when the drawer is opened or closed. final StacAction? onDrawerChanged; + /// Action called when the end drawer is opened or closed. final StacAction? onEndDrawerChanged; + /// The alignment of the persistent footer buttons. final StacAlignmentDirectional? persistentFooterAlignment; + /// A list of buttons to display in a row below the body. final List? persistentFooterButtons; + /// Whether this scaffold is being displayed at the top of the screen. final bool? primary; + /// Whether the body should size itself to avoid the window's bottom inset. final bool? resizeToAvoidBottomInset; + /// Restoration ID to save and restore the state of the scaffold. final String? restorationId; @override - String get type => 'scaffold'; + String get type => WidgetType.scaffold.name; + /// Creates a [StacScaffold] from a JSON map. factory StacScaffold.fromJson(Map json) => _$StacScaffoldFromJson(json); diff --git a/packages/stac_core/lib/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart b/packages/stac_core/lib/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart index 70ac9060..fb20bf88 100644 --- a/packages/stac_core/lib/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart +++ b/packages/stac_core/lib/widgets/single_child_scroll_view/stac_single_child_scroll_view.dart @@ -1,11 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; -import 'package:stac_core/types/stac_scroll_view_keyboard_dismiss_behavior.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_single_child_scroll_view.g.dart'; @@ -121,7 +116,7 @@ class StacSingleChildScrollView extends StacWidget { final StacScrollViewKeyboardDismissBehavior? keyboardDismissBehavior; @override - String get type => 'SingleChildScrollView'; + String get type => WidgetType.singleChildScrollView.name; /// Creates a [StacSingleChildScrollView] from a JSON map. factory StacSingleChildScrollView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/sized_box/stac_sized_box.dart b/packages/stac_core/lib/widgets/sized_box/stac_sized_box.dart index bc3ab526..60e15684 100644 --- a/packages/stac_core/lib/widgets/sized_box/stac_sized_box.dart +++ b/packages/stac_core/lib/widgets/sized_box/stac_sized_box.dart @@ -1,6 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_sized_box.g.dart'; @@ -48,7 +49,7 @@ class StacSizedBox extends StacWidget { /// Widget type identifier. @override - String get type => 'sizedBox'; + String get type => WidgetType.sizedBox.name; /// Creates a [StacSizedBox] from JSON. factory StacSizedBox.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/slider/stac_slider.dart b/packages/stac_core/lib/widgets/slider/stac_slider.dart index 85c1b8a2..763102d6 100644 --- a/packages/stac_core/lib/widgets/slider/stac_slider.dart +++ b/packages/stac_core/lib/widgets/slider/stac_slider.dart @@ -2,10 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; -import 'package:stac_core/types/stac_slider_interaction.dart'; -import 'package:stac_core/types/stac_slider_type.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_slider.g.dart'; @@ -149,7 +146,7 @@ class StacSlider extends StacWidget { /// Widget type identifier. @override - String get type => 'slider'; + String get type => WidgetType.slider.name; /// Creates a [StacSlider] from a JSON map. factory StacSlider.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/sliver_app_bar/stac_sliver_app_bar.dart b/packages/stac_core/lib/widgets/sliver_app_bar/stac_sliver_app_bar.dart index 03676e67..a53c9856 100644 --- a/packages/stac_core/lib/widgets/sliver_app_bar/stac_sliver_app_bar.dart +++ b/packages/stac_core/lib/widgets/sliver_app_bar/stac_sliver_app_bar.dart @@ -1,12 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_sliver_app_bar.g.dart'; @@ -191,7 +186,7 @@ class StacSliverAppBar extends StacWidget { /// Widget type identifier. @override - String get type => 'sliverAppBar'; + String get type => WidgetType.sliverAppBar.name; /// Creates a [StacSliverAppBar] from a JSON map. factory StacSliverAppBar.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/spacer/stac_spacer.dart b/packages/stac_core/lib/widgets/spacer/stac_spacer.dart index 1e6954ed..7faf2ea8 100644 --- a/packages/stac_core/lib/widgets/spacer/stac_spacer.dart +++ b/packages/stac_core/lib/widgets/spacer/stac_spacer.dart @@ -1,20 +1,58 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_spacer.g.dart'; +/// A Stac model representing Flutter's [Spacer] widget. +/// +/// Inserts an adjustable, empty space in a [Row], [Column], or [Flex]. +/// The amount of space taken is controlled by [flex] relative to +/// the other flexible children. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacRow(children: const [ +/// StacText(data: 'Left'), +/// StacSpacer(), +/// StacText(data: 'Right'), +/// ]) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "row", +/// "children": [ +/// {"type": "text", "data": "Left"}, +/// {"type": "spacer"}, +/// {"type": "text", "data": "Right"} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacSpacer extends StacWidget { + /// Creates a [StacSpacer] that takes space according to [flex]. const StacSpacer({this.flex}); + /// The flex factor to use for this spacer. + /// + /// If null, defaults to 1. Higher values take more available main-axis space. final int? flex; + /// Widget type identifier. @override - String get type => 'spacer'; + String get type => WidgetType.spacer.name; + /// Creates a [StacSpacer] from a JSON map. factory StacSpacer.fromJson(Map json) => _$StacSpacerFromJson(json); + /// Converts this [StacSpacer] instance to a JSON map. @override Map toJson() => _$StacSpacerToJson(this); } diff --git a/packages/stac_core/lib/widgets/stack/stac_stack.dart b/packages/stac_core/lib/widgets/stack/stac_stack.dart index ed95d5a3..4772f9b7 100644 --- a/packages/stac_core/lib/widgets/stack/stac_stack.dart +++ b/packages/stac_core/lib/widgets/stack/stac_stack.dart @@ -1,14 +1,44 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_alignment.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_stack_fit.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_stack.g.dart'; +/// A Stac model representing Flutter's [Stack] widget. +/// +/// Positions its [children] relative to the edges of the box. Children are +/// painted in order with the first child being at the bottom. +/// Control layout using [alignment], [textDirection], [fit], and [clipBehavior]. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacStack( +/// alignment: StacAlignment.center, +/// children: const [ +/// StacContainer(color: '#EEEEEE', width: 200, height: 200), +/// StacText(data: 'On top'), +/// ], +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "stack", +/// "alignment": "center", +/// "children": [ +/// {"type": "container", "color": "#EEEEEE", "width": 200, "height": 200}, +/// {"type": "text", "data": "On top"} +/// ] +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacStack extends StacWidget { + /// Creates a [StacStack] that lays out its [children] relative to its box. const StacStack({ this.alignment, this.textDirection, @@ -17,22 +47,30 @@ class StacStack extends StacWidget { this.children, }); + /// How to align non-positioned [children] within the stack. final StacAlignment? alignment; + /// The text direction used to resolve alignment. final StacTextDirection? textDirection; + /// How to size non-positioned [children] in the stack. final StacStackFit? fit; + /// Whether to clip children that paint outside the stack's bounds. final StacClip? clipBehavior; + /// The widgets displayed by this stack, painted in order. final List? children; + /// Widget type identifier. @override - String get type => 'stack'; + String get type => WidgetType.stack.name; + /// Creates a [StacStack] from a JSON map. factory StacStack.fromJson(Map json) => _$StacStackFromJson(json); + /// Converts this [StacStack] instance to a JSON map. @override Map toJson() => _$StacStackToJson(this); } diff --git a/packages/stac_core/lib/widgets/switch/stac_switch.dart b/packages/stac_core/lib/widgets/switch/stac_switch.dart index b17f008a..0c5e0dff 100644 --- a/packages/stac_core/lib/widgets/switch/stac_switch.dart +++ b/packages/stac_core/lib/widgets/switch/stac_switch.dart @@ -2,10 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_switch_type.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_switch.g.dart'; diff --git a/packages/stac_core/lib/widgets/tab/stac_tab.dart b/packages/stac_core/lib/widgets/tab/stac_tab.dart index 9fff0b8b..9281b00d 100644 --- a/packages/stac_core/lib/widgets/tab/stac_tab.dart +++ b/packages/stac_core/lib/widgets/tab/stac_tab.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_tab.g.dart'; @@ -63,7 +63,7 @@ class StacTab extends StacWidget { /// Widget type identifier. @override - String get type => 'tab'; + String get type => WidgetType.tab.name; /// Creates a [StacTab] from a JSON map. factory StacTab.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/tab_bar/stac_tab_bar.dart b/packages/stac_core/lib/widgets/tab_bar/stac_tab_bar.dart index 44b8e71c..40e3a509 100644 --- a/packages/stac_core/lib/widgets/tab_bar/stac_tab_bar.dart +++ b/packages/stac_core/lib/widgets/tab_bar/stac_tab_bar.dart @@ -1,14 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_box_decoration/stac_box_decoration.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; -import 'package:stac_core/types/stac_tab_alignment.dart'; -import 'package:stac_core/types/stac_tab_bar_indicator_size.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_tab_bar.g.dart'; @@ -141,7 +134,7 @@ class StacTabBar extends StacWidget { /// Widget type identifier. @override - String get type => 'tabBar'; + String get type => WidgetType.tabBar.name; /// Creates a [StacTabBar] from a JSON map. factory StacTabBar.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/tab_bar_view/stac_tab_bar_view.dart b/packages/stac_core/lib/widgets/tab_bar_view/stac_tab_bar_view.dart index 14b5d7f6..1cb5936f 100644 --- a/packages/stac_core/lib/widgets/tab_bar_view/stac_tab_bar_view.dart +++ b/packages/stac_core/lib/widgets/tab_bar_view/stac_tab_bar_view.dart @@ -1,9 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_tab_bar_view.g.dart'; @@ -76,7 +74,7 @@ class StacTabBarView extends StacWidget { /// Widget type identifier. @override - String get type => 'tabBarView'; + String get type => WidgetType.tabBarView.name; /// Creates a [StacTabBarView] from a JSON map. factory StacTabBarView.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/table/stac_table.dart b/packages/stac_core/lib/widgets/table/stac_table.dart index 813d190c..08aa9949 100644 --- a/packages/stac_core/lib/widgets/table/stac_table.dart +++ b/packages/stac_core/lib/widgets/table/stac_table.dart @@ -1,9 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_table/stac_table_border.dart'; -import 'package:stac_core/types/stac_table/stac_table_cell_vertical_alignment.dart'; -import 'package:stac_core/types/stac_table/stac_table_column_width.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; +import 'package:stac_core/widgets/table_cell/stac_table_cell.dart'; import 'package:stac_core/widgets/table_row/stac_table_row.dart'; part 'stac_table.g.dart'; @@ -48,6 +46,7 @@ part 'stac_table.g.dart'; /// @JsonSerializable() class StacTable extends StacWidget { + /// Creates a table widget with the specified properties. const StacTable({ this.children = const [], this.columnWidths, @@ -81,7 +80,7 @@ class StacTable extends StacWidget { @override /// Widget type identifier. - String get type => 'table'; + String get type => WidgetType.table.name; /// Creates a [StacTable] from a JSON map. factory StacTable.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/table_cell/stac_table_cell.dart b/packages/stac_core/lib/widgets/table_cell/stac_table_cell.dart index 20ca5466..70be9afd 100644 --- a/packages/stac_core/lib/widgets/table_cell/stac_table_cell.dart +++ b/packages/stac_core/lib/widgets/table_cell/stac_table_cell.dart @@ -1,9 +1,30 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_table/stac_table_cell_vertical_alignment.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_table_cell.g.dart'; +/// Vertical alignment options for table cells. +/// +/// Mirrors Flutter's `TableCellVerticalAlignment` and controls how the child of +/// a table cell is positioned vertically within the row height. +enum StacTableCellVerticalAlignment { + /// Align at the top of the row. + top, + + /// Center vertically within the row. + middle, + + /// Align at the bottom of the row. + bottom, + + /// Align the baselines of text for the row. + baseline, + + /// Expand to fill the full height of the row. + fill, +} + /// A Stac model representing Flutter's [TableCell] widget. @JsonSerializable() class StacTableCell extends StacWidget { @@ -17,8 +38,9 @@ class StacTableCell extends StacWidget { final StacWidget? child; @override - String get type => 'tableCell'; + String get type => WidgetType.tableCell.name; + /// Creates a [StacTableCell] from a JSON map. factory StacTableCell.fromJson(Map json) => _$StacTableCellFromJson(json); diff --git a/packages/stac_core/lib/widgets/table_row/stac_table_row.dart b/packages/stac_core/lib/widgets/table_row/stac_table_row.dart index 5122dfe2..74961980 100644 --- a/packages/stac_core/lib/widgets/table_row/stac_table_row.dart +++ b/packages/stac_core/lib/widgets/table_row/stac_table_row.dart @@ -1,6 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_box_decoration/stac_box_decoration.dart'; +import 'package:stac_core/foundation/decoration/stac_box_decoration/stac_box_decoration.dart'; part 'stac_table_row.g.dart'; diff --git a/packages/stac_core/lib/widgets/text/stac_text.dart b/packages/stac_core/lib/widgets/text/stac_text.dart index f115a6b8..86f61acb 100644 --- a/packages/stac_core/lib/widgets/text/stac_text.dart +++ b/packages/stac_core/lib/widgets/text/stac_text.dart @@ -1,14 +1,52 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; -import 'package:stac_core/painting/stac_text_span/stac_text_span.dart'; -import 'package:stac_core/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_text.g.dart'; +/// A Stac widget for displaying text with customizable styling and layout. +/// +/// This widget corresponds to Flutter's Text widget and supports rich text +/// formatting, alignment, overflow handling, and accessibility features. +/// It can display both simple text and rich text with multiple text spans. +/// +/// {@tool snippet} +/// Dart Example: +/// ```dart +/// StacText( +/// data: 'Hello, World!', +/// style: StacTextStyle( +/// fontSize: 18.0, +/// fontWeight: StacFontWeight.bold, +/// color: StacColors.blue, +/// ), +/// textAlign: StacTextAlign.center, +/// maxLines: 2, +/// overflow: StacTextOverflow.ellipsis, +/// ) +/// ``` +/// {@end-tool} +/// +/// {@tool snippet} +/// JSON Example: +/// ```json +/// { +/// "type": "text", +/// "data": "Hello, World!", +/// "style": { +/// "fontSize": 18.0, +/// "fontWeight": "bold", +/// "color": "#2196F3" +/// }, +/// "textAlign": "center", +/// "maxLines": 2, +/// "overflow": "ellipsis" +/// } +/// ``` +/// {@end-tool} @JsonSerializable() class StacText extends StacWidget { + /// Creates a text widget with the given text data and optional styling. StacText({ required this.data, this.children = const [], @@ -24,36 +62,68 @@ class StacText extends StacWidget { this.selectionColor, }); + /// The text to display. final String data; + /// Additional text spans for rich text formatting. + /// + /// These spans are combined with the main [data] to create rich text + /// with different styles for different parts of the text. final List children; + /// The text style to apply to the text. final StacTextStyle? style; + /// How the text should be aligned horizontally. final StacTextAlign? textAlign; + /// The directionality of the text. + /// + /// This determines the text direction (LTR or RTL) for proper rendering + /// of different languages. final StacTextDirection? textDirection; + /// Whether the text should break at soft line breaks. + /// + /// If false, the text will only break at explicit line breaks. final bool? softWrap; + /// How visual overflow should be handled. final StacTextOverflow? overflow; + /// The number of font pixels for each logical pixel. + /// + /// For example, if the text scale factor is 1.5, text will be 50% larger + /// than the specified font size. final double? textScaleFactor; + /// An optional maximum number of lines for the text to span. + /// + /// If the text exceeds the given number of lines, it will be truncated + /// according to [overflow]. final int? maxLines; + /// An alternative semantic label for this text. + /// + /// If present, the semantics of this widget will contain this value + /// instead of the actual text for accessibility purposes. final String? semanticsLabel; + /// The strategy to use when calculating the width of the text. final StacTextWidthBasis? textWidthBasis; + /// The color to use when painting the selection. + /// + /// This is used when the text is selectable. final StacColor? selectionColor; @override - String get type => 'text'; + String get type => WidgetType.text.name; @override Map toJson() => _$StacTextToJson(this); + /// Creates a [StacText] from a JSON map. factory StacText.fromJson(Map json) => _$StacTextFromJson(json); } diff --git a/packages/stac_core/lib/widgets/text_button/stac_text_button.dart b/packages/stac_core/lib/widgets/text_button/stac_text_button.dart index 604ab5fa..a5d6dc6f 100644 --- a/packages/stac_core/lib/widgets/text_button/stac_text_button.dart +++ b/packages/stac_core/lib/widgets/text_button/stac_text_button.dart @@ -1,8 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac_core/types/stac_clip.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_text_button.g.dart'; @@ -73,7 +72,7 @@ class StacTextButton extends StacWidget { /// Widget type identifier. @override - String get type => 'textButton'; + String get type => WidgetType.textButton.name; /// Creates a [StacTextButton] from JSON. factory StacTextButton.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/text_field/stac_text_field.dart b/packages/stac_core/lib/widgets/text_field/stac_text_field.dart index 08ec99b5..ab55a2e1 100644 --- a/packages/stac_core/lib/widgets/text_field/stac_text_field.dart +++ b/packages/stac_core/lib/widgets/text_field/stac_text_field.dart @@ -2,13 +2,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_action.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/painting.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_drag_start_behavior.dart'; -import 'package:stac_core/types/stac_mouse_cursor.dart'; -import 'package:stac_core/types/stac_scroll_physics.dart'; -import 'package:stac_core/types/stac_text_input_types.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_text_field.g.dart'; @@ -55,6 +49,7 @@ part 'stac_text_field.g.dart'; /// * Flutter's [TextField documentation](https://api.flutter.dev/flutter/material/TextField-class.html) @JsonSerializable(explicitToJson: true) class StacTextField extends StacWidget { + /// Creates a text field widget with the specified properties. const StacTextField({ this.initialValue, this.decoration, @@ -221,7 +216,7 @@ class StacTextField extends StacWidget { /// /// Used to identify this widget type during JSON serialization. @override - String get type => 'textField'; + String get type => WidgetType.textField.name; /// Creates a [StacTextField] from a JSON map. /// diff --git a/packages/stac_core/lib/widgets/text_form_field/stac_text_form_field.dart b/packages/stac_core/lib/widgets/text_form_field/stac_text_form_field.dart index c6eb0b1f..bbad20d7 100644 --- a/packages/stac_core/lib/widgets/text_form_field/stac_text_form_field.dart +++ b/packages/stac_core/lib/widgets/text_form_field/stac_text_form_field.dart @@ -1,16 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/painting.dart'; -import 'package:stac_core/types/stac_autovalidate_mode.dart'; -import 'package:stac_core/types/stac_brightness.dart'; -import 'package:stac_core/types/stac_form_field_validator/stac_form_field_validator.dart'; -import 'package:stac_core/types/stac_input_formatter/stac_input_formatter.dart'; -import 'package:stac_core/types/stac_max_length_enforcement.dart'; -import 'package:stac_core/types/stac_smart_dashes_type.dart'; -import 'package:stac_core/types/stac_smart_quotes_type.dart'; -import 'package:stac_core/types/stac_text_input_types.dart'; -import 'package:stac_core/types/stac_text_types.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_text_form_field.g.dart'; @@ -50,6 +41,7 @@ part 'stac_text_form_field.g.dart'; /// * Flutter's [TextFormField documentation](https://api.flutter.dev/flutter/material/TextFormField-class.html) @JsonSerializable(explicitToJson: true) class StacTextFormField extends StacWidget { + /// Creates a text form field widget with the specified properties. const StacTextFormField({ this.id, this.decoration, @@ -193,7 +185,7 @@ class StacTextFormField extends StacWidget { /// Widget type identifier. @override - String get type => 'textFormField'; + String get type => WidgetType.textFormField.name; /// Creates a [StacTextFormField] from a JSON map. factory StacTextFormField.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/vertical_divider/stac_vertical_divider.dart b/packages/stac_core/lib/widgets/vertical_divider/stac_vertical_divider.dart index f01ce568..7e7219ce 100644 --- a/packages/stac_core/lib/widgets/vertical_divider/stac_vertical_divider.dart +++ b/packages/stac_core/lib/widgets/vertical_divider/stac_vertical_divider.dart @@ -1,7 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/painting/stac_color/stac_colors.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_vertical_divider.g.dart'; @@ -99,7 +99,7 @@ class StacVerticalDivider extends StacWidget { /// /// This is used to identify the widget type in JSON serialization. @override - String get type => 'verticalDivider'; + String get type => WidgetType.verticalDivider.name; /// Creates a [StacVerticalDivider] instance from a JSON map. /// diff --git a/packages/stac_core/lib/widgets/visibility/stac_visibility.dart b/packages/stac_core/lib/widgets/visibility/stac_visibility.dart index 7c5624ab..4904a20d 100644 --- a/packages/stac_core/lib/widgets/visibility/stac_visibility.dart +++ b/packages/stac_core/lib/widgets/visibility/stac_visibility.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/stac_widget.dart'; +import 'package:stac_core/foundation/specifications/widget_type.dart'; part 'stac_visibility.g.dart'; @@ -72,7 +73,7 @@ class StacVisibility extends StacWidget { /// Widget type identifier. @override - String get type => 'visibility'; + String get type => WidgetType.visibility.name; /// Creates a [StacVisibility] from JSON. factory StacVisibility.fromJson(Map json) => diff --git a/packages/stac_core/lib/widgets/widgets.dart b/packages/stac_core/lib/widgets/widgets.dart index 41d92dd5..ca5612a4 100644 --- a/packages/stac_core/lib/widgets/widgets.dart +++ b/packages/stac_core/lib/widgets/widgets.dart @@ -1,26 +1,30 @@ library; +export 'alert_dialog/stac_alert_dialog.dart'; export 'app_bar/stac_app_bar.dart'; export 'aspect_ratio/stac_aspect_ratio.dart'; +export 'auto_complete/stac_auto_complete.dart'; export 'backdrop_filter/stac_backdrop_filter.dart'; export 'bottom_navigation_bar/stac_bottom_navigation_bar.dart'; export 'bottom_navigation_view/stac_bottom_navigation_view.dart'; -export 'center/stac_center.dart'; export 'card/stac_card.dart'; -export 'colored_box/stac_colored_box.dart'; -export 'clip_rrect/stac_clip_rrect.dart'; -export 'clip_oval/stac_clip_oval.dart'; -export 'circular_progress_indicator/stac_circular_progress_indicator.dart'; -export 'drawer/stac_drawer.dart'; -export 'default_tab_controller/stac_default_tab_controller.dart'; -export 'page_view/stac_page_view.dart'; -export 'tab/stac_tab.dart'; -export 'tab_bar/stac_tab_bar.dart'; -export 'tab_bar_view/stac_tab_bar_view.dart'; +export 'carousel_view/stac_carousel_view.dart'; +export 'center/stac_center.dart'; +export 'check_box/stac_check_box.dart'; export 'chip/stac_chip.dart'; +export 'circle_avatar/stac_circle_avatar.dart'; +export 'circular_progress_indicator/stac_circular_progress_indicator.dart'; +export 'clip_oval/stac_clip_oval.dart'; +export 'clip_rrect/stac_clip_rrect.dart'; +export 'colored_box/stac_colored_box.dart'; export 'column/stac_column.dart'; +export 'conditional/stac_conditional.dart'; export 'container/stac_container.dart'; +export 'custom_scroll_view/stac_custom_scroll_view.dart'; +export 'default_tab_controller/stac_default_tab_controller.dart'; export 'divider/stac_divider.dart'; +export 'drawer/stac_drawer.dart'; +export 'dropdown_menu/stac_dropdown_menu.dart'; export 'dynamic_view/stac_dynamic_view.dart'; export 'elevated_button/stac_elevated_button.dart'; export 'expanded/stac_expanded.dart'; @@ -30,34 +34,40 @@ export 'flexible/stac_flexible.dart'; export 'floating_action_button/stac_floating_action_button.dart'; export 'form/stac_form.dart'; export 'fractionally_sized_box/stac_fractionally_sized_box.dart'; +export 'grid_view/stac_grid_view.dart'; +export 'hero/stac_hero.dart'; export 'icon/stac_icon.dart'; export 'icon/stac_icons.dart'; export 'icon_button/stac_icon_button.dart'; export 'image/stac_image.dart'; export 'ink_well/stac_ink_well.dart'; -export 'hero/stac_hero.dart'; export 'limited_box/stac_limited_box.dart'; export 'network_widget/stac_network_widget.dart'; export 'opacity/stac_opacity.dart'; export 'outlined_button/stac_outlined_button.dart'; export 'padding/stac_padding.dart'; +export 'page_view/stac_page_view.dart'; export 'placeholder/stac_placeholder.dart'; export 'positioned/stac_positioned.dart'; -export 'refresh_indicator/stac_refresh_indicator.dart'; -export 'custom_scroll_view/stac_custom_scroll_view.dart'; -export 'check_box/stac_check_box.dart'; export 'radio/stac_radio.dart'; export 'radio_group/stac_radio_group.dart'; -export 'grid_view/stac_grid_view.dart'; -export 'slider/stac_slider.dart'; +export 'refresh_indicator/stac_refresh_indicator.dart'; export 'row/stac_row.dart'; export 'safe_area/stac_safe_area.dart'; export 'scaffold/stac_scaffold.dart'; export 'single_child_scroll_view/stac_single_child_scroll_view.dart'; export 'sized_box/stac_sized_box.dart'; +export 'slider/stac_slider.dart'; +export 'sliver_app_bar/stac_sliver_app_bar.dart'; export 'spacer/stac_spacer.dart'; export 'stack/stac_stack.dart'; export 'switch/stac_switch.dart'; +export 'tab/stac_tab.dart'; +export 'tab_bar/stac_tab_bar.dart'; +export 'tab_bar_view/stac_tab_bar_view.dart'; +export 'table/stac_table.dart'; +export 'table_cell/stac_table_cell.dart'; +export 'table_row/stac_table_row.dart'; export 'text/stac_text.dart'; export 'text_button/stac_text_button.dart'; export 'text_field/stac_text_field.dart'; @@ -65,13 +75,3 @@ export 'text_form_field/stac_text_form_field.dart'; export 'vertical_divider/stac_vertical_divider.dart'; export 'visibility/stac_visibility.dart'; export 'wrap/stac_wrap.dart'; -export 'carousel_view/stac_carousel_view.dart'; -export 'sliver_app_bar/stac_sliver_app_bar.dart'; -export 'auto_complete/stac_auto_complete.dart'; -export 'dropdown_menu/stac_dropdown_menu.dart'; -export 'circle_avatar/stac_circle_avatar.dart'; -export 'alert_dialog/stac_alert_dialog.dart'; -export 'table/stac_table.dart'; -export 'table_cell/stac_table_cell.dart'; -export 'table_row/stac_table_row.dart'; -export 'conditional/stac_conditional.dart'; diff --git a/packages/stac_core/lib/widgets/wrap/stac_wrap.dart b/packages/stac_core/lib/widgets/wrap/stac_wrap.dart index f9ea0763..8e3ec001 100644 --- a/packages/stac_core/lib/widgets/wrap/stac_wrap.dart +++ b/packages/stac_core/lib/widgets/wrap/stac_wrap.dart @@ -1,12 +1,7 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_core/core/converters/double_converter.dart'; import 'package:stac_core/core/stac_widget.dart'; -import 'package:stac_core/types/stac_axis.dart'; -import 'package:stac_core/types/stac_clip.dart'; -import 'package:stac_core/types/stac_text_types.dart'; -import 'package:stac_core/types/stac_vertical_direction.dart'; -import 'package:stac_core/types/stac_wrap_alignment.dart'; -import 'package:stac_core/types/stac_wrap_cross_alignment.dart'; +import 'package:stac_core/foundation/foundation.dart'; part 'stac_wrap.g.dart'; @@ -108,7 +103,7 @@ class StacWrap extends StacWidget { /// Widget type identifier. @override - String get type => 'wrap'; + String get type => WidgetType.wrap.name; /// Creates a [StacWrap] from JSON. factory StacWrap.fromJson(Map json) => diff --git a/packages/stac_core/pubspec.yaml b/packages/stac_core/pubspec.yaml index 10d30fe2..35b0f9ea 100644 --- a/packages/stac_core/pubspec.yaml +++ b/packages/stac_core/pubspec.yaml @@ -1,11 +1,18 @@ name: stac_core -description: "A new Flutter package project." -version: 0.0.1 -homepage: +description: A pure Dart package that provides the core functionalities and common interfaces for the Stac server-driven UI framework. +version: 0.1.0 +repository: https://github.com/StacDev/stac +homepage: https://github.com/StacDev/stac environment: sdk: ^3.8.1 +topics: + - ui + - widget + - server-driven-ui + - dynamic-widgets + dependencies: json_annotation: ^4.9.0