diff --git a/examples/stac_gallery/lib/main.dart b/examples/stac_gallery/lib/main.dart index e8d55773..2228c2a6 100644 --- a/examples/stac_gallery/lib/main.dart +++ b/examples/stac_gallery/lib/main.dart @@ -3,10 +3,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:stac/stac.dart' show Stac; import 'package:stac_gallery/app/example/example_screen_parser.dart'; -import 'package:stac_models/core/stac_model.dart'; -import 'package:stac_models/painting/painting.dart'; -import 'package:stac_models/painting/stac_color/stac_colors.dart'; -import 'package:stac_models/widgets/widgets.dart'; +import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; import 'package:stac_webview/stac_webview.dart'; class MyHttpOverrides extends HttpOverrides { @@ -64,8 +63,29 @@ StacWidget homeScreen() { color: StacColors.red, child: StacText(data: 'Hello, World!'), ), + StacElevatedButton( + onPressed: {}, + child: StacText(data: 'Hello, World!'), + style: StacButtonStyle( + shape: StacContinuousRectangleBorder( + borderRadius: StacBorderRadius.all(100), + side: StacBorderSide( + width: 10, + color: StacColors.black, + ), + ), + ), + ), + StacOutlinedButton( + onPressed: {}, + child: StacText(data: 'Hello, World!'), + ), ], ), + floatingActionButton: StacFloatingActionButton( + onPressed: {}, + child: StacText(data: '+'), + ), ); } diff --git a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.dart b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.dart index a7f19309..5e9f8469 100644 --- a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.dart +++ b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/actions/stac_snack_bar/stac_snack_bar_action.dart'; import 'package:stac/src/parsers/widgets/stac_duration/stac_duration.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; export 'stac_snack_bar_parser.dart'; diff --git a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.freezed.dart b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.freezed.dart index 2a7b9423..fd82f2b7 100644 --- a/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.freezed.dart +++ b/packages/stac/lib/src/parsers/actions/stac_snack_bar/stac_snack_bar.freezed.dart @@ -132,7 +132,6 @@ abstract mixin class $StacSnackBarCopyWith<$Res> { DismissDirection? dismissDirection, Clip clipBehavior}); - $StacShapeBorderCopyWith<$Res>? get shape; $StacSnackBarActionCopyWith<$Res>? get action; $StacDurationCopyWith<$Res> get duration; } @@ -239,20 +238,6 @@ class _$StacSnackBarCopyWithImpl<$Res> implements $StacSnackBarCopyWith<$Res> { )); } - /// Create a copy of StacSnackBar - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacSnackBar /// with the given fields replaced by the non-null parameter values. @override @@ -461,8 +446,6 @@ abstract mixin class _$StacSnackBarCopyWith<$Res> DismissDirection? dismissDirection, Clip clipBehavior}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; @override $StacSnackBarActionCopyWith<$Res>? get action; @override @@ -572,20 +555,6 @@ class __$StacSnackBarCopyWithImpl<$Res> )); } - /// Create a copy of StacSnackBar - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacSnackBar /// with the given fields replaced by the non-null parameter values. @override 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 7529f3c8..9b502625 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 @@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; import 'package:stac/src/parsers/actions/stac_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/parsers/widgets/stac_duration/stac_duration.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac/src/utils/action_type.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_framework/stac_framework.dart'; 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 ad8a4344..61d56a89 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 @@ -4,11 +4,12 @@ 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/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/parsers/widgets/widgets.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; import 'package:stac_models/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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_app_bar_theme/stac_app_bar_theme.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart index a9da4189..586a836e 100644 --- a/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.freezed.dart @@ -136,7 +136,6 @@ abstract mixin class $StacAppBarThemeCopyWith<$Res> { StacSystemUIOverlayStyle? systemOverlayStyle, StacEdgeInsets? actionsPadding}); - $StacShapeBorderCopyWith<$Res>? get shape; $StacIconThemeDataCopyWith<$Res>? get iconTheme; $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme; } @@ -244,20 +243,6 @@ class _$StacAppBarThemeCopyWithImpl<$Res> )); } - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacAppBarTheme /// with the given fields replaced by the non-null parameter values. @override @@ -455,8 +440,6 @@ abstract mixin class _$StacAppBarThemeCopyWith<$Res> StacSystemUIOverlayStyle? systemOverlayStyle, StacEdgeInsets? actionsPadding}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; @override $StacIconThemeDataCopyWith<$Res>? get iconTheme; @override @@ -566,20 +549,6 @@ class __$StacAppBarThemeCopyWithImpl<$Res> )); } - /// Create a copy of StacAppBarTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacAppBarTheme /// with the given fields replaced by the non-null parameter values. @override diff --git a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.freezed.dart deleted file mode 100644 index d1016d49..00000000 --- a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.freezed.dart +++ /dev/null @@ -1,907 +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_button_style.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacButtonStyle { - String? get foregroundColor; - String? get backgroundColor; - String? get disabledForegroundColor; - String? get disabledBackgroundColor; - String? get shadowColor; - String? get surfaceTintColor; - String? get iconColor; - double? get iconSize; - IconAlignment? get iconAlignment; - String? get disabledIconColor; - String? get overlayColor; - double? get elevation; - StacTextStyle? get textStyle; - StacEdgeInsets? get padding; - StacSize? get minimumSize; - StacSize? get fixedSize; - StacSize? get maximumSize; - StacBorderSide? get side; - StacRoundedRectangleBorder? get shape; - StacMouseCursor? get enabledMouseCursor; - StacMouseCursor? get disabledMouseCursor; - StacVisualDensity? get visualDensity; - MaterialTapTargetSize? get tapTargetSize; - Duration? get animationDuration; - bool? get enableFeedback; - StacAlignmentGeometry? get alignment; - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith get copyWith => - _$StacButtonStyleCopyWithImpl( - this as StacButtonStyle, _$identity); - - /// Serializes this StacButtonStyle to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacButtonStyle && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical( - other.disabledForegroundColor, disabledForegroundColor) || - other.disabledForegroundColor == disabledForegroundColor) && - (identical( - other.disabledBackgroundColor, disabledBackgroundColor) || - other.disabledBackgroundColor == disabledBackgroundColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical(other.iconAlignment, iconAlignment) || - other.iconAlignment == iconAlignment) && - (identical(other.disabledIconColor, disabledIconColor) || - other.disabledIconColor == disabledIconColor) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.minimumSize, minimumSize) || - other.minimumSize == minimumSize) && - (identical(other.fixedSize, fixedSize) || - other.fixedSize == fixedSize) && - (identical(other.maximumSize, maximumSize) || - other.maximumSize == maximumSize) && - (identical(other.side, side) || other.side == side) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.enabledMouseCursor, enabledMouseCursor) || - other.enabledMouseCursor == enabledMouseCursor) && - (identical(other.disabledMouseCursor, disabledMouseCursor) || - other.disabledMouseCursor == disabledMouseCursor) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.tapTargetSize, tapTargetSize) || - other.tapTargetSize == tapTargetSize) && - (identical(other.animationDuration, animationDuration) || - other.animationDuration == animationDuration) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.alignment, alignment) || - other.alignment == alignment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - foregroundColor, - backgroundColor, - disabledForegroundColor, - disabledBackgroundColor, - shadowColor, - surfaceTintColor, - iconColor, - iconSize, - iconAlignment, - disabledIconColor, - overlayColor, - elevation, - textStyle, - padding, - minimumSize, - fixedSize, - maximumSize, - side, - shape, - enabledMouseCursor, - disabledMouseCursor, - visualDensity, - tapTargetSize, - animationDuration, - enableFeedback, - alignment - ]); - - @override - String toString() { - return 'StacButtonStyle(foregroundColor: $foregroundColor, backgroundColor: $backgroundColor, disabledForegroundColor: $disabledForegroundColor, disabledBackgroundColor: $disabledBackgroundColor, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, iconColor: $iconColor, iconSize: $iconSize, iconAlignment: $iconAlignment, disabledIconColor: $disabledIconColor, overlayColor: $overlayColor, elevation: $elevation, textStyle: $textStyle, padding: $padding, minimumSize: $minimumSize, fixedSize: $fixedSize, maximumSize: $maximumSize, side: $side, shape: $shape, enabledMouseCursor: $enabledMouseCursor, disabledMouseCursor: $disabledMouseCursor, visualDensity: $visualDensity, tapTargetSize: $tapTargetSize, animationDuration: $animationDuration, enableFeedback: $enableFeedback, alignment: $alignment)'; - } -} - -/// @nodoc -abstract mixin class $StacButtonStyleCopyWith<$Res> { - factory $StacButtonStyleCopyWith( - StacButtonStyle value, $Res Function(StacButtonStyle) _then) = - _$StacButtonStyleCopyWithImpl; - @useResult - $Res call( - {String? foregroundColor, - String? backgroundColor, - String? disabledForegroundColor, - String? disabledBackgroundColor, - String? shadowColor, - String? surfaceTintColor, - String? iconColor, - double? iconSize, - IconAlignment? iconAlignment, - String? disabledIconColor, - String? overlayColor, - double? elevation, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacSize? minimumSize, - StacSize? fixedSize, - StacSize? maximumSize, - StacBorderSide? side, - StacRoundedRectangleBorder? shape, - StacMouseCursor? enabledMouseCursor, - StacMouseCursor? disabledMouseCursor, - StacVisualDensity? visualDensity, - MaterialTapTargetSize? tapTargetSize, - Duration? animationDuration, - bool? enableFeedback, - StacAlignmentGeometry? alignment}); - - $StacSizeCopyWith<$Res>? get minimumSize; - $StacSizeCopyWith<$Res>? get fixedSize; - $StacSizeCopyWith<$Res>? get maximumSize; - $StacRoundedRectangleBorderCopyWith<$Res>? get shape; - $StacVisualDensityCopyWith<$Res>? get visualDensity; - $StacAlignmentGeometryCopyWith<$Res>? get alignment; -} - -/// @nodoc -class _$StacButtonStyleCopyWithImpl<$Res> - implements $StacButtonStyleCopyWith<$Res> { - _$StacButtonStyleCopyWithImpl(this._self, this._then); - - final StacButtonStyle _self; - final $Res Function(StacButtonStyle) _then; - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? foregroundColor = freezed, - Object? backgroundColor = freezed, - Object? disabledForegroundColor = freezed, - Object? disabledBackgroundColor = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? iconColor = freezed, - Object? iconSize = freezed, - Object? iconAlignment = freezed, - Object? disabledIconColor = freezed, - Object? overlayColor = freezed, - Object? elevation = freezed, - Object? textStyle = freezed, - Object? padding = freezed, - Object? minimumSize = freezed, - Object? fixedSize = freezed, - Object? maximumSize = freezed, - Object? side = freezed, - Object? shape = freezed, - Object? enabledMouseCursor = freezed, - Object? disabledMouseCursor = freezed, - Object? visualDensity = freezed, - Object? tapTargetSize = freezed, - Object? animationDuration = freezed, - Object? enableFeedback = freezed, - Object? alignment = freezed, - }) { - return _then(_self.copyWith( - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledForegroundColor: freezed == disabledForegroundColor - ? _self.disabledForegroundColor - : disabledForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledBackgroundColor: freezed == disabledBackgroundColor - ? _self.disabledBackgroundColor - : disabledBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as double?, - iconAlignment: freezed == iconAlignment - ? _self.iconAlignment - : iconAlignment // ignore: cast_nullable_to_non_nullable - as IconAlignment?, - disabledIconColor: freezed == disabledIconColor - ? _self.disabledIconColor - : disabledIconColor // ignore: cast_nullable_to_non_nullable - as String?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - minimumSize: freezed == minimumSize - ? _self.minimumSize - : minimumSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - fixedSize: freezed == fixedSize - ? _self.fixedSize - : fixedSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - maximumSize: freezed == maximumSize - ? _self.maximumSize - : maximumSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacRoundedRectangleBorder?, - enabledMouseCursor: freezed == enabledMouseCursor - ? _self.enabledMouseCursor - : enabledMouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - disabledMouseCursor: freezed == disabledMouseCursor - ? _self.disabledMouseCursor - : disabledMouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - tapTargetSize: freezed == tapTargetSize - ? _self.tapTargetSize - : tapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - animationDuration: freezed == animationDuration - ? _self.animationDuration - : animationDuration // ignore: cast_nullable_to_non_nullable - as Duration?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - )); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get minimumSize { - if (_self.minimumSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.minimumSize!, (value) { - return _then(_self.copyWith(minimumSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get fixedSize { - if (_self.fixedSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.fixedSize!, (value) { - return _then(_self.copyWith(fixedSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get maximumSize { - if (_self.maximumSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.maximumSize!, (value) { - return _then(_self.copyWith(maximumSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacRoundedRectangleBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacRoundedRectangleBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// 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)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacAlignmentGeometryCopyWith<$Res>? get alignment { - if (_self.alignment == null) { - return null; - } - - return $StacAlignmentGeometryCopyWith<$Res>(_self.alignment!, (value) { - return _then(_self.copyWith(alignment: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacButtonStyle implements StacButtonStyle { - const _StacButtonStyle( - {this.foregroundColor, - this.backgroundColor, - this.disabledForegroundColor, - this.disabledBackgroundColor, - this.shadowColor, - this.surfaceTintColor, - this.iconColor, - this.iconSize, - this.iconAlignment, - this.disabledIconColor, - this.overlayColor, - this.elevation, - this.textStyle, - this.padding, - this.minimumSize, - this.fixedSize, - this.maximumSize, - this.side, - this.shape, - this.enabledMouseCursor, - this.disabledMouseCursor, - this.visualDensity, - this.tapTargetSize, - this.animationDuration, - this.enableFeedback, - this.alignment}); - factory _StacButtonStyle.fromJson(Map json) => - _$StacButtonStyleFromJson(json); - - @override - final String? foregroundColor; - @override - final String? backgroundColor; - @override - final String? disabledForegroundColor; - @override - final String? disabledBackgroundColor; - @override - final String? shadowColor; - @override - final String? surfaceTintColor; - @override - final String? iconColor; - @override - final double? iconSize; - @override - final IconAlignment? iconAlignment; - @override - final String? disabledIconColor; - @override - final String? overlayColor; - @override - final double? elevation; - @override - final StacTextStyle? textStyle; - @override - final StacEdgeInsets? padding; - @override - final StacSize? minimumSize; - @override - final StacSize? fixedSize; - @override - final StacSize? maximumSize; - @override - final StacBorderSide? side; - @override - final StacRoundedRectangleBorder? shape; - @override - final StacMouseCursor? enabledMouseCursor; - @override - final StacMouseCursor? disabledMouseCursor; - @override - final StacVisualDensity? visualDensity; - @override - final MaterialTapTargetSize? tapTargetSize; - @override - final Duration? animationDuration; - @override - final bool? enableFeedback; - @override - final StacAlignmentGeometry? alignment; - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacButtonStyleCopyWith<_StacButtonStyle> get copyWith => - __$StacButtonStyleCopyWithImpl<_StacButtonStyle>(this, _$identity); - - @override - Map toJson() { - return _$StacButtonStyleToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacButtonStyle && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical( - other.disabledForegroundColor, disabledForegroundColor) || - other.disabledForegroundColor == disabledForegroundColor) && - (identical( - other.disabledBackgroundColor, disabledBackgroundColor) || - other.disabledBackgroundColor == disabledBackgroundColor) && - (identical(other.shadowColor, shadowColor) || - other.shadowColor == shadowColor) && - (identical(other.surfaceTintColor, surfaceTintColor) || - other.surfaceTintColor == surfaceTintColor) && - (identical(other.iconColor, iconColor) || - other.iconColor == iconColor) && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical(other.iconAlignment, iconAlignment) || - other.iconAlignment == iconAlignment) && - (identical(other.disabledIconColor, disabledIconColor) || - other.disabledIconColor == disabledIconColor) && - (identical(other.overlayColor, overlayColor) || - other.overlayColor == overlayColor) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.minimumSize, minimumSize) || - other.minimumSize == minimumSize) && - (identical(other.fixedSize, fixedSize) || - other.fixedSize == fixedSize) && - (identical(other.maximumSize, maximumSize) || - other.maximumSize == maximumSize) && - (identical(other.side, side) || other.side == side) && - (identical(other.shape, shape) || other.shape == shape) && - (identical(other.enabledMouseCursor, enabledMouseCursor) || - other.enabledMouseCursor == enabledMouseCursor) && - (identical(other.disabledMouseCursor, disabledMouseCursor) || - other.disabledMouseCursor == disabledMouseCursor) && - (identical(other.visualDensity, visualDensity) || - other.visualDensity == visualDensity) && - (identical(other.tapTargetSize, tapTargetSize) || - other.tapTargetSize == tapTargetSize) && - (identical(other.animationDuration, animationDuration) || - other.animationDuration == animationDuration) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.alignment, alignment) || - other.alignment == alignment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - foregroundColor, - backgroundColor, - disabledForegroundColor, - disabledBackgroundColor, - shadowColor, - surfaceTintColor, - iconColor, - iconSize, - iconAlignment, - disabledIconColor, - overlayColor, - elevation, - textStyle, - padding, - minimumSize, - fixedSize, - maximumSize, - side, - shape, - enabledMouseCursor, - disabledMouseCursor, - visualDensity, - tapTargetSize, - animationDuration, - enableFeedback, - alignment - ]); - - @override - String toString() { - return 'StacButtonStyle(foregroundColor: $foregroundColor, backgroundColor: $backgroundColor, disabledForegroundColor: $disabledForegroundColor, disabledBackgroundColor: $disabledBackgroundColor, shadowColor: $shadowColor, surfaceTintColor: $surfaceTintColor, iconColor: $iconColor, iconSize: $iconSize, iconAlignment: $iconAlignment, disabledIconColor: $disabledIconColor, overlayColor: $overlayColor, elevation: $elevation, textStyle: $textStyle, padding: $padding, minimumSize: $minimumSize, fixedSize: $fixedSize, maximumSize: $maximumSize, side: $side, shape: $shape, enabledMouseCursor: $enabledMouseCursor, disabledMouseCursor: $disabledMouseCursor, visualDensity: $visualDensity, tapTargetSize: $tapTargetSize, animationDuration: $animationDuration, enableFeedback: $enableFeedback, alignment: $alignment)'; - } -} - -/// @nodoc -abstract mixin class _$StacButtonStyleCopyWith<$Res> - implements $StacButtonStyleCopyWith<$Res> { - factory _$StacButtonStyleCopyWith( - _StacButtonStyle value, $Res Function(_StacButtonStyle) _then) = - __$StacButtonStyleCopyWithImpl; - @override - @useResult - $Res call( - {String? foregroundColor, - String? backgroundColor, - String? disabledForegroundColor, - String? disabledBackgroundColor, - String? shadowColor, - String? surfaceTintColor, - String? iconColor, - double? iconSize, - IconAlignment? iconAlignment, - String? disabledIconColor, - String? overlayColor, - double? elevation, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacSize? minimumSize, - StacSize? fixedSize, - StacSize? maximumSize, - StacBorderSide? side, - StacRoundedRectangleBorder? shape, - StacMouseCursor? enabledMouseCursor, - StacMouseCursor? disabledMouseCursor, - StacVisualDensity? visualDensity, - MaterialTapTargetSize? tapTargetSize, - Duration? animationDuration, - bool? enableFeedback, - StacAlignmentGeometry? alignment}); - - @override - $StacSizeCopyWith<$Res>? get minimumSize; - @override - $StacSizeCopyWith<$Res>? get fixedSize; - @override - $StacSizeCopyWith<$Res>? get maximumSize; - @override - $StacRoundedRectangleBorderCopyWith<$Res>? get shape; - @override - $StacVisualDensityCopyWith<$Res>? get visualDensity; - @override - $StacAlignmentGeometryCopyWith<$Res>? get alignment; -} - -/// @nodoc -class __$StacButtonStyleCopyWithImpl<$Res> - implements _$StacButtonStyleCopyWith<$Res> { - __$StacButtonStyleCopyWithImpl(this._self, this._then); - - final _StacButtonStyle _self; - final $Res Function(_StacButtonStyle) _then; - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? foregroundColor = freezed, - Object? backgroundColor = freezed, - Object? disabledForegroundColor = freezed, - Object? disabledBackgroundColor = freezed, - Object? shadowColor = freezed, - Object? surfaceTintColor = freezed, - Object? iconColor = freezed, - Object? iconSize = freezed, - Object? iconAlignment = freezed, - Object? disabledIconColor = freezed, - Object? overlayColor = freezed, - Object? elevation = freezed, - Object? textStyle = freezed, - Object? padding = freezed, - Object? minimumSize = freezed, - Object? fixedSize = freezed, - Object? maximumSize = freezed, - Object? side = freezed, - Object? shape = freezed, - Object? enabledMouseCursor = freezed, - Object? disabledMouseCursor = freezed, - Object? visualDensity = freezed, - Object? tapTargetSize = freezed, - Object? animationDuration = freezed, - Object? enableFeedback = freezed, - Object? alignment = freezed, - }) { - return _then(_StacButtonStyle( - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledForegroundColor: freezed == disabledForegroundColor - ? _self.disabledForegroundColor - : disabledForegroundColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledBackgroundColor: freezed == disabledBackgroundColor - ? _self.disabledBackgroundColor - : disabledBackgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - shadowColor: freezed == shadowColor - ? _self.shadowColor - : shadowColor // ignore: cast_nullable_to_non_nullable - as String?, - surfaceTintColor: freezed == surfaceTintColor - ? _self.surfaceTintColor - : surfaceTintColor // ignore: cast_nullable_to_non_nullable - as String?, - iconColor: freezed == iconColor - ? _self.iconColor - : iconColor // ignore: cast_nullable_to_non_nullable - as String?, - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as double?, - iconAlignment: freezed == iconAlignment - ? _self.iconAlignment - : iconAlignment // ignore: cast_nullable_to_non_nullable - as IconAlignment?, - disabledIconColor: freezed == disabledIconColor - ? _self.disabledIconColor - : disabledIconColor // ignore: cast_nullable_to_non_nullable - as String?, - overlayColor: freezed == overlayColor - ? _self.overlayColor - : overlayColor // ignore: cast_nullable_to_non_nullable - as String?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as double?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - minimumSize: freezed == minimumSize - ? _self.minimumSize - : minimumSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - fixedSize: freezed == fixedSize - ? _self.fixedSize - : fixedSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - maximumSize: freezed == maximumSize - ? _self.maximumSize - : maximumSize // ignore: cast_nullable_to_non_nullable - as StacSize?, - side: freezed == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide?, - shape: freezed == shape - ? _self.shape - : shape // ignore: cast_nullable_to_non_nullable - as StacRoundedRectangleBorder?, - enabledMouseCursor: freezed == enabledMouseCursor - ? _self.enabledMouseCursor - : enabledMouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - disabledMouseCursor: freezed == disabledMouseCursor - ? _self.disabledMouseCursor - : disabledMouseCursor // ignore: cast_nullable_to_non_nullable - as StacMouseCursor?, - visualDensity: freezed == visualDensity - ? _self.visualDensity - : visualDensity // ignore: cast_nullable_to_non_nullable - as StacVisualDensity?, - tapTargetSize: freezed == tapTargetSize - ? _self.tapTargetSize - : tapTargetSize // ignore: cast_nullable_to_non_nullable - as MaterialTapTargetSize?, - animationDuration: freezed == animationDuration - ? _self.animationDuration - : animationDuration // ignore: cast_nullable_to_non_nullable - as Duration?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignmentGeometry?, - )); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get minimumSize { - if (_self.minimumSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.minimumSize!, (value) { - return _then(_self.copyWith(minimumSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get fixedSize { - if (_self.fixedSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.fixedSize!, (value) { - return _then(_self.copyWith(fixedSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacSizeCopyWith<$Res>? get maximumSize { - if (_self.maximumSize == null) { - return null; - } - - return $StacSizeCopyWith<$Res>(_self.maximumSize!, (value) { - return _then(_self.copyWith(maximumSize: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacRoundedRectangleBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacRoundedRectangleBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacButtonStyle - /// 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)); - }); - } - - /// Create a copy of StacButtonStyle - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacAlignmentGeometryCopyWith<$Res>? get alignment { - if (_self.alignment == null) { - return null; - } - - return $StacAlignmentGeometryCopyWith<$Res>(_self.alignment!, (value) { - return _then(_self.copyWith(alignment: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.dart b/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart similarity index 66% rename from packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.dart rename to packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart index 03f916c1..1588e89f 100644 --- a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.dart +++ b/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style_parser.dart @@ -1,55 +1,9 @@ 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_alignment_geometry/stac_alignment_geometry.dart'; -import 'package:stac/src/parsers/widgets/stac_mouse_cursor/stac_mouse_cursor.dart'; -import 'package:stac/src/parsers/widgets/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; -import 'package:stac/src/parsers/widgets/stac_size/stac_size.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_models/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; - -part 'stac_button_style.freezed.dart'; -part 'stac_button_style.g.dart'; - -@freezed -abstract class StacButtonStyle with _$StacButtonStyle { - const factory StacButtonStyle({ - String? foregroundColor, - String? backgroundColor, - String? disabledForegroundColor, - String? disabledBackgroundColor, - String? shadowColor, - String? surfaceTintColor, - String? iconColor, - double? iconSize, - IconAlignment? iconAlignment, - String? disabledIconColor, - String? overlayColor, - double? elevation, - StacTextStyle? textStyle, - StacEdgeInsets? padding, - StacSize? minimumSize, - StacSize? fixedSize, - StacSize? maximumSize, - StacBorderSide? side, - StacRoundedRectangleBorder? shape, - StacMouseCursor? enabledMouseCursor, - StacMouseCursor? disabledMouseCursor, - StacVisualDensity? visualDensity, - MaterialTapTargetSize? tapTargetSize, - Duration? animationDuration, - bool? enableFeedback, - StacAlignmentGeometry? alignment, - }) = _StacButtonStyle; - - factory StacButtonStyle.fromJson(Map json) => - _$StacButtonStyleFromJson(json); -} +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; extension StacButtonStyleParser on StacButtonStyle { ButtonStyle parseElevatedButton(BuildContext context) { @@ -62,7 +16,7 @@ extension StacButtonStyleParser on StacButtonStyle { surfaceTintColor: surfaceTintColor?.toColor(context), iconColor: iconColor?.toColor(context), iconSize: iconSize, - iconAlignment: iconAlignment, + iconAlignment: iconAlignment?.parse, disabledIconColor: disabledIconColor?.toColor(context), overlayColor: overlayColor?.toColor(context), elevation: elevation, @@ -73,11 +27,11 @@ extension StacButtonStyleParser on StacButtonStyle { maximumSize: maximumSize?.parse, side: side?.parse(context), shape: shape?.parse(context), - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); @@ -93,7 +47,7 @@ extension StacButtonStyleParser on StacButtonStyle { surfaceTintColor: surfaceTintColor?.toColor(context), iconColor: iconColor?.toColor(context), iconSize: iconSize, - iconAlignment: iconAlignment, + iconAlignment: iconAlignment?.parse, disabledIconColor: disabledIconColor?.toColor(context), overlayColor: overlayColor?.toColor(context), elevation: elevation, @@ -104,11 +58,11 @@ extension StacButtonStyleParser on StacButtonStyle { maximumSize: maximumSize?.parse, side: side?.parse(context), shape: shape?.parse(context), - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); @@ -124,7 +78,7 @@ extension StacButtonStyleParser on StacButtonStyle { surfaceTintColor: surfaceTintColor?.toColor(context), iconColor: iconColor?.toColor(context), iconSize: iconSize, - iconAlignment: iconAlignment, + iconAlignment: iconAlignment?.parse, disabledIconColor: disabledIconColor?.toColor(context), overlayColor: overlayColor?.toColor(context), elevation: elevation, @@ -134,12 +88,12 @@ extension StacButtonStyleParser on StacButtonStyle { fixedSize: fixedSize?.parse, maximumSize: maximumSize?.parse, side: side?.parse(context), - shape: shape.parse(context), - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + shape: shape?.parse(context), + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); @@ -160,13 +114,13 @@ extension StacButtonStyleParser on StacButtonStyle { maximumSize: maximumSize?.parse, iconSize: iconSize, side: side?.parse(context), - shape: shape?.parse(context), + // shape: shape?.parse(context), padding: padding?.parse, - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); @@ -182,7 +136,7 @@ extension StacButtonStyleParser on StacButtonStyle { surfaceTintColor: surfaceTintColor.toColor(context), iconColor: iconColor?.toColor(context), iconSize: iconSize, - iconAlignment: iconAlignment, + iconAlignment: iconAlignment?.parse, disabledIconColor: disabledIconColor?.toColor(context), overlayColor: overlayColor?.toColor(context), elevation: elevation, @@ -192,12 +146,12 @@ extension StacButtonStyleParser on StacButtonStyle { fixedSize: fixedSize?.parse, maximumSize: maximumSize?.parse, side: side?.parse(context), - shape: shape.parse(context), - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + shape: shape?.parse(context), + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); @@ -221,13 +175,13 @@ extension StacButtonStyleParser on StacButtonStyle { minimumSize: minimumSize?.parse, fixedSize: fixedSize?.parse, maximumSize: maximumSize?.parse, - enabledMouseCursor: enabledMouseCursor?.value, - disabledMouseCursor: disabledMouseCursor?.value, + enabledMouseCursor: enabledMouseCursor?.parse, + disabledMouseCursor: disabledMouseCursor?.parse, side: side?.parse(context), - shape: shape.parse(context), + shape: shape?.parse(context), visualDensity: visualDensity?.parse, - tapTargetSize: tapTargetSize, - animationDuration: animationDuration, + tapTargetSize: tapTargetSize?.parse, + animationDuration: animationDuration?.parse, enableFeedback: enableFeedback, alignment: alignment?.parse, ); 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 b4ddf543..ace8bbf9 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 @@ -2,9 +2,10 @@ 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/theme/stac_color_scheme/stac_color_scheme.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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_button_theme_data/stac_button_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart index a0bc195e..ebd203bc 100644 --- a/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.freezed.dart @@ -125,7 +125,6 @@ abstract mixin class $StacButtonThemeDataCopyWith<$Res> { StacColorScheme? colorScheme, MaterialTapTargetSize? materialTapTargetSize}); - $StacShapeBorderCopyWith<$Res>? get shape; $StacColorSchemeCopyWith<$Res>? get colorScheme; } @@ -222,20 +221,6 @@ class _$StacButtonThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacButtonThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -410,8 +395,6 @@ abstract mixin class _$StacButtonThemeDataCopyWith<$Res> StacColorScheme? colorScheme, MaterialTapTargetSize? materialTapTargetSize}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; @override $StacColorSchemeCopyWith<$Res>? get colorScheme; } @@ -509,20 +492,6 @@ class __$StacButtonThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacButtonThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacButtonThemeData /// with the given fields replaced by the non-null parameter values. @override 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 8d41c6a3..a1a322db 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 @@ -2,10 +2,10 @@ 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_shape_border/stac_rounded_rectangle_border.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_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; part 'stac_checkbox_theme_data.freezed.dart'; part 'stac_checkbox_theme_data.g.dart'; @@ -20,7 +20,7 @@ abstract class StacCheckboxThemeData with _$StacCheckboxThemeData { double? splashRadius, MaterialTapTargetSize? materialTapTargetSize, StacVisualDensity? visualDensity, - StacRoundedRactangleBorder? shape, + StacShapeBorder? shape, StacBorderSide? side, }) = _StacCheckboxThemeData; @@ -44,7 +44,7 @@ extension StacCheckboxThemeDataParser on StacCheckboxThemeData { splashRadius: splashRadius, materialTapTargetSize: materialTapTargetSize, visualDensity: visualDensity?.parse, - shape: shape?.parse(context) as OutlinedBorder?, + shape: shape?.parse(context), side: side?.parse(context), ); } 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 8e980341..c261bb72 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 @@ -22,7 +22,7 @@ mixin _$StacCheckboxThemeData { double? get splashRadius; MaterialTapTargetSize? get materialTapTargetSize; StacVisualDensity? get visualDensity; - StacRoundedRactangleBorder? get shape; + StacShapeBorder? get shape; StacBorderSide? get side; /// Create a copy of StacCheckboxThemeData @@ -93,11 +93,10 @@ abstract mixin class $StacCheckboxThemeDataCopyWith<$Res> { double? splashRadius, MaterialTapTargetSize? materialTapTargetSize, StacVisualDensity? visualDensity, - StacRoundedRactangleBorder? shape, + StacShapeBorder? shape, StacBorderSide? side}); $StacVisualDensityCopyWith<$Res>? get visualDensity; - $StacRoundedRactangleBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -155,7 +154,7 @@ class _$StacCheckboxThemeDataCopyWithImpl<$Res> shape: freezed == shape ? _self.shape : shape // ignore: cast_nullable_to_non_nullable - as StacRoundedRactangleBorder?, + as StacShapeBorder?, side: freezed == side ? _self.side : side // ignore: cast_nullable_to_non_nullable @@ -176,20 +175,6 @@ class _$StacCheckboxThemeDataCopyWithImpl<$Res> return _then(_self.copyWith(visualDensity: value)); }); } - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacRoundedRactangleBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacRoundedRactangleBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } /// @nodoc @@ -223,7 +208,7 @@ class _StacCheckboxThemeData implements StacCheckboxThemeData { @override final StacVisualDensity? visualDensity; @override - final StacRoundedRactangleBorder? shape; + final StacShapeBorder? shape; @override final StacBorderSide? side; @@ -302,13 +287,11 @@ abstract mixin class _$StacCheckboxThemeDataCopyWith<$Res> double? splashRadius, MaterialTapTargetSize? materialTapTargetSize, StacVisualDensity? visualDensity, - StacRoundedRactangleBorder? shape, + StacShapeBorder? shape, StacBorderSide? side}); @override $StacVisualDensityCopyWith<$Res>? get visualDensity; - @override - $StacRoundedRactangleBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -366,7 +349,7 @@ class __$StacCheckboxThemeDataCopyWithImpl<$Res> shape: freezed == shape ? _self.shape : shape // ignore: cast_nullable_to_non_nullable - as StacRoundedRactangleBorder?, + as StacShapeBorder?, side: freezed == side ? _self.side : side // ignore: cast_nullable_to_non_nullable @@ -387,20 +370,6 @@ class __$StacCheckboxThemeDataCopyWithImpl<$Res> return _then(_self.copyWith(visualDensity: value)); }); } - - /// Create a copy of StacCheckboxThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacRoundedRactangleBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacRoundedRactangleBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart index f4928c1f..dd0cdf0e 100644 --- a/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart +++ b/packages/stac/lib/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.g.dart @@ -23,8 +23,7 @@ _StacCheckboxThemeData _$StacCheckboxThemeDataFromJson( json['visualDensity'] as Map), shape: json['shape'] == null ? null - : StacRoundedRactangleBorder.fromJson( - json['shape'] as Map), + : StacShapeBorder.fromJson(json['shape'] as Map), side: json['side'] == null ? null : StacBorderSide.fromJson(json['side'] as Map), 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 3e4b7a2f..e574be88 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 @@ -8,6 +8,7 @@ import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; import 'package:stac_models/types/stac_box_constraints/stac_box_constraints.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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_chip_theme_data/stac_chip_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart index c2ac280a..644018a3 100644 --- a/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_chip_theme_data/stac_chip_theme_data.freezed.dart @@ -166,7 +166,6 @@ abstract mixin class $StacChipThemeDataCopyWith<$Res> { StacBoxConstraints? avatarBoxConstraints, StacBoxConstraints? deleteIconBoxConstraints}); - $StacShapeBorderCopyWith<$Res>? get shape; $StacIconThemeDataCopyWith<$Res>? get iconTheme; } @@ -303,20 +302,6 @@ class _$StacChipThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacChipThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -542,8 +527,6 @@ abstract mixin class _$StacChipThemeDataCopyWith<$Res> StacBoxConstraints? avatarBoxConstraints, StacBoxConstraints? deleteIconBoxConstraints}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; @override $StacIconThemeDataCopyWith<$Res>? get iconTheme; } @@ -681,20 +664,6 @@ class __$StacChipThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacChipThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacChipThemeData /// with the given fields replaced by the non-null parameter values. @override 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 5e0330ce..5dcb3a91 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 @@ -1,13 +1,14 @@ 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.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/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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 40289fde..fd5f3e10 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 @@ -242,12 +242,7 @@ abstract mixin class $StacDatePickerThemeDataCopyWith<$Res> { StacButtonStyle? cancelButtonStyle, StacButtonStyle? confirmButtonStyle}); - $StacShapeBorderCopyWith<$Res>? get shape; - $StacShapeBorderCopyWith<$Res>? get dayShape; - $StacShapeBorderCopyWith<$Res>? get rangePickerShape; $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; - $StacButtonStyleCopyWith<$Res>? get cancelButtonStyle; - $StacButtonStyleCopyWith<$Res>? get confirmButtonStyle; } /// @nodoc @@ -455,48 +450,6 @@ class _$StacDatePickerThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get dayShape { - if (_self.dayShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.dayShape!, (value) { - return _then(_self.copyWith(dayShape: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get rangePickerShape { - if (_self.rangePickerShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.rangePickerShape!, (value) { - return _then(_self.copyWith(rangePickerShape: value)); - }); - } - /// Create a copy of StacDatePickerThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -511,34 +464,6 @@ class _$StacDatePickerThemeDataCopyWithImpl<$Res> return _then(_self.copyWith(inputDecorationTheme: value)); }); } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get cancelButtonStyle { - if (_self.cancelButtonStyle == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.cancelButtonStyle!, (value) { - return _then(_self.copyWith(cancelButtonStyle: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get confirmButtonStyle { - if (_self.confirmButtonStyle == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.confirmButtonStyle!, (value) { - return _then(_self.copyWith(confirmButtonStyle: value)); - }); - } } /// @nodoc @@ -856,18 +781,8 @@ abstract mixin class _$StacDatePickerThemeDataCopyWith<$Res> StacButtonStyle? cancelButtonStyle, StacButtonStyle? confirmButtonStyle}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; - @override - $StacShapeBorderCopyWith<$Res>? get dayShape; - @override - $StacShapeBorderCopyWith<$Res>? get rangePickerShape; @override $StacInputDecorationThemeCopyWith<$Res>? get inputDecorationTheme; - @override - $StacButtonStyleCopyWith<$Res>? get cancelButtonStyle; - @override - $StacButtonStyleCopyWith<$Res>? get confirmButtonStyle; } /// @nodoc @@ -1075,48 +990,6 @@ class __$StacDatePickerThemeDataCopyWithImpl<$Res> )); } - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get dayShape { - if (_self.dayShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.dayShape!, (value) { - return _then(_self.copyWith(dayShape: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get rangePickerShape { - if (_self.rangePickerShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.rangePickerShape!, (value) { - return _then(_self.copyWith(rangePickerShape: value)); - }); - } - /// Create a copy of StacDatePickerThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -1131,34 +1004,6 @@ class __$StacDatePickerThemeDataCopyWithImpl<$Res> return _then(_self.copyWith(inputDecorationTheme: value)); }); } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get cancelButtonStyle { - if (_self.cancelButtonStyle == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.cancelButtonStyle!, (value) { - return _then(_self.copyWith(cancelButtonStyle: value)); - }); - } - - /// Create a copy of StacDatePickerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get confirmButtonStyle { - if (_self.confirmButtonStyle == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.confirmButtonStyle!, (value) { - return _then(_self.copyWith(confirmButtonStyle: value)); - }); - } } // dart format on 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 1ccd51e2..d97d55e9 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 @@ -1,6 +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/stac.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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_drawer_theme_data/stac_drawer_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart index 5fea6b0d..b75dd5f6 100644 --- a/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_drawer_theme_data/stac_drawer_theme_data.freezed.dart @@ -95,9 +95,6 @@ abstract mixin class $StacDrawerThemeDataCopyWith<$Res> { StacShapeBorder? endShape, double? width, Clip? clipBehavior}); - - $StacShapeBorderCopyWith<$Res>? get shape; - $StacShapeBorderCopyWith<$Res>? get endShape; } /// @nodoc @@ -162,34 +159,6 @@ class _$StacDrawerThemeDataCopyWithImpl<$Res> as Clip?, )); } - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get endShape { - if (_self.endShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.endShape!, (value) { - return _then(_self.copyWith(endShape: value)); - }); - } } /// @nodoc @@ -304,11 +273,6 @@ abstract mixin class _$StacDrawerThemeDataCopyWith<$Res> StacShapeBorder? endShape, double? width, Clip? clipBehavior}); - - @override - $StacShapeBorderCopyWith<$Res>? get shape; - @override - $StacShapeBorderCopyWith<$Res>? get endShape; } /// @nodoc @@ -373,34 +337,6 @@ class __$StacDrawerThemeDataCopyWithImpl<$Res> as Clip?, )); } - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - - /// Create a copy of StacDrawerThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get endShape { - if (_self.endShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.endShape!, (value) { - return _then(_self.copyWith(endShape: value)); - }); - } } // dart format on 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 51e0dbc7..681ba05c 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 @@ -2,10 +2,11 @@ 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_icon_theme_data/stac_icon_theme_data.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.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_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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 c147860c..f92f939f 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 @@ -105,7 +105,6 @@ abstract mixin class $StacNavigationDrawerThemeDataCopyWith<$Res> { StacTextStyle? labelTextStyle, StacIconThemeData? iconTheme}); - $StacShapeBorderCopyWith<$Res>? get indicatorShape; $StacSizeCopyWith<$Res>? get indicatorSize; $StacIconThemeDataCopyWith<$Res>? get iconTheme; } @@ -178,20 +177,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') - $StacShapeBorderCopyWith<$Res>? get indicatorShape { - if (_self.indicatorShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.indicatorShape!, (value) { - return _then(_self.copyWith(indicatorShape: value)); - }); - } - /// Create a copy of StacNavigationDrawerThemeData /// with the given fields replaced by the non-null parameter values. @override @@ -344,8 +329,6 @@ abstract mixin class _$StacNavigationDrawerThemeDataCopyWith<$Res> StacTextStyle? labelTextStyle, StacIconThemeData? iconTheme}); - @override - $StacShapeBorderCopyWith<$Res>? get indicatorShape; @override $StacSizeCopyWith<$Res>? get indicatorSize; @override @@ -420,20 +403,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') - $StacShapeBorderCopyWith<$Res>? get indicatorShape { - if (_self.indicatorShape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.indicatorShape!, (value) { - return _then(_self.copyWith(indicatorShape: 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_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 9dc3c53c..950ed104 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 @@ -2,10 +2,11 @@ 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/widgets/stac_shape_border/stac_shape_border.dart'; +import 'package:stac/src/parsers/types/type_parser.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.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_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart index 40b428d5..4d873321 100644 --- a/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart +++ b/packages/stac/lib/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_theme_data.freezed.dart @@ -129,8 +129,6 @@ abstract mixin class $StacSnackBarThemeDataCopyWith<$Res> { double? actionOverflowThreshold, String? actionBackgroundColor, String? disabledActionBackgroundColor}); - - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -225,20 +223,6 @@ class _$StacSnackBarThemeDataCopyWithImpl<$Res> as String?, )); } - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } /// @nodoc @@ -399,9 +383,6 @@ abstract mixin class _$StacSnackBarThemeDataCopyWith<$Res> double? actionOverflowThreshold, String? actionBackgroundColor, String? disabledActionBackgroundColor}); - - @override - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -496,20 +477,6 @@ class __$StacSnackBarThemeDataCopyWithImpl<$Res> as String?, )); } - - /// Create a copy of StacSnackBarThemeData - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } // dart format on 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 0fc1c1f0..b175e8bd 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 @@ -5,7 +5,7 @@ import 'package:stac/src/parsers/theme/stac_badge_theme_data/stac_badge_theme_da import 'package:stac/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; import 'package:stac/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart'; import 'package:stac/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; import 'package:stac/src/parsers/theme/stac_button_theme_data/stac_button_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_card_theme_data/stac_card_theme_data.dart'; import 'package:stac/src/parsers/theme/stac_checkbox_theme_data/stac_checkbox_theme_data.dart'; @@ -28,6 +28,7 @@ import 'package:stac/src/parsers/theme/stac_snack_bar_theme_data/stac_snack_bar_ 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/utils/color_utils.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.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 9084c145..3fccbb68 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 @@ -359,20 +359,13 @@ abstract mixin class $StacThemeCopyWith<$Res> { $StacDialogThemeCopyWith<$Res>? get dialogTheme; $StacDividerThemeDataCopyWith<$Res>? get dividerTheme; $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme; - $StacButtonStyleCopyWith<$Res>? get elevatedButtonTheme; - $StacButtonStyleCopyWith<$Res>? get filledButtonTheme; $StacFloatingActionButtonThemeDataCopyWith<$Res>? get floatingActionButtonTheme; - $StacButtonStyleCopyWith<$Res>? get iconButtonTheme; $StacListTileThemeDataCopyWith<$Res>? get listTileTheme; - $StacButtonStyleCopyWith<$Res>? get menuButtonTheme; $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme; $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme; - $StacButtonStyleCopyWith<$Res>? get outlinedButtonTheme; - $StacButtonStyleCopyWith<$Res>? get segmentedButtonTheme; $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme; $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme; - $StacButtonStyleCopyWith<$Res>? get textButtonTheme; } /// @nodoc @@ -1007,34 +1000,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') - $StacButtonStyleCopyWith<$Res>? get elevatedButtonTheme { - if (_self.elevatedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.elevatedButtonTheme!, (value) { - return _then(_self.copyWith(elevatedButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get filledButtonTheme { - if (_self.filledButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.filledButtonTheme!, (value) { - return _then(_self.copyWith(filledButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -1051,20 +1016,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') - $StacButtonStyleCopyWith<$Res>? get iconButtonTheme { - if (_self.iconButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.iconButtonTheme!, (value) { - return _then(_self.copyWith(iconButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -1079,20 +1030,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') - $StacButtonStyleCopyWith<$Res>? get menuButtonTheme { - if (_self.menuButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.menuButtonTheme!, (value) { - return _then(_self.copyWith(menuButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -1123,34 +1060,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') - $StacButtonStyleCopyWith<$Res>? get outlinedButtonTheme { - if (_self.outlinedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.outlinedButtonTheme!, (value) { - return _then(_self.copyWith(outlinedButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get segmentedButtonTheme { - if (_self.segmentedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.segmentedButtonTheme!, (value) { - return _then(_self.copyWith(segmentedButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -1178,20 +1087,6 @@ class _$StacThemeCopyWithImpl<$Res> implements $StacThemeCopyWith<$Res> { return _then(_self.copyWith(tabBarTheme: value)); }); } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get textButtonTheme { - if (_self.textButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.textButtonTheme!, (value) { - return _then(_self.copyWith(textButtonTheme: value)); - }); - } } /// @nodoc @@ -1713,32 +1608,18 @@ abstract mixin class _$StacThemeCopyWith<$Res> @override $StacDrawerThemeDataCopyWith<$Res>? get drawerTheme; @override - $StacButtonStyleCopyWith<$Res>? get elevatedButtonTheme; - @override - $StacButtonStyleCopyWith<$Res>? get filledButtonTheme; - @override $StacFloatingActionButtonThemeDataCopyWith<$Res>? get floatingActionButtonTheme; @override - $StacButtonStyleCopyWith<$Res>? get iconButtonTheme; - @override $StacListTileThemeDataCopyWith<$Res>? get listTileTheme; @override - $StacButtonStyleCopyWith<$Res>? get menuButtonTheme; - @override $StacNavigationBarThemeDataCopyWith<$Res>? get navigationBarTheme; @override $StacNavigationDrawerThemeDataCopyWith<$Res>? get navigationDrawerTheme; @override - $StacButtonStyleCopyWith<$Res>? get outlinedButtonTheme; - @override - $StacButtonStyleCopyWith<$Res>? get segmentedButtonTheme; - @override $StacSnackBarThemeDataCopyWith<$Res>? get snackBarTheme; @override $StacTabBarThemeDataCopyWith<$Res>? get tabBarTheme; - @override - $StacButtonStyleCopyWith<$Res>? get textButtonTheme; } /// @nodoc @@ -2373,34 +2254,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') - $StacButtonStyleCopyWith<$Res>? get elevatedButtonTheme { - if (_self.elevatedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.elevatedButtonTheme!, (value) { - return _then(_self.copyWith(elevatedButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get filledButtonTheme { - if (_self.filledButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.filledButtonTheme!, (value) { - return _then(_self.copyWith(filledButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -2417,20 +2270,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') - $StacButtonStyleCopyWith<$Res>? get iconButtonTheme { - if (_self.iconButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.iconButtonTheme!, (value) { - return _then(_self.copyWith(iconButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -2445,20 +2284,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') - $StacButtonStyleCopyWith<$Res>? get menuButtonTheme { - if (_self.menuButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.menuButtonTheme!, (value) { - return _then(_self.copyWith(menuButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -2489,34 +2314,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') - $StacButtonStyleCopyWith<$Res>? get outlinedButtonTheme { - if (_self.outlinedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.outlinedButtonTheme!, (value) { - return _then(_self.copyWith(outlinedButtonTheme: value)); - }); - } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get segmentedButtonTheme { - if (_self.segmentedButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.segmentedButtonTheme!, (value) { - return _then(_self.copyWith(segmentedButtonTheme: value)); - }); - } - /// Create a copy of StacTheme /// with the given fields replaced by the non-null parameter values. @override @@ -2544,20 +2341,6 @@ class __$StacThemeCopyWithImpl<$Res> implements _$StacThemeCopyWith<$Res> { return _then(_self.copyWith(tabBarTheme: value)); }); } - - /// Create a copy of StacTheme - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get textButtonTheme { - if (_self.textButtonTheme == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.textButtonTheme!, (value) { - return _then(_self.copyWith(textButtonTheme: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/theme/themes.dart b/packages/stac/lib/src/parsers/theme/themes.dart index ea92d0bb..5e433e71 100644 --- a/packages/stac/lib/src/parsers/theme/themes.dart +++ b/packages/stac/lib/src/parsers/theme/themes.dart @@ -2,13 +2,13 @@ export 'package:stac/src/parsers/theme/stac_app_bar_theme/stac_app_bar_theme.dar export 'package:stac/src/parsers/theme/stac_bottom_app_bar_theme/stac_bottom_app_bar_theme.dart'; export 'package:stac/src/parsers/theme/stac_bottom_nav_bar_theme/stac_bottom_nav_bar_theme.dart'; export 'package:stac/src/parsers/theme/stac_bottom_sheet_theme/stac_bottom_sheet_theme.dart'; -export 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; +export 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; 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'; export 'package:stac/src/parsers/theme/stac_tab_bar_theme_data/stac_tab_bar_theme_data.dart'; export 'package:stac/src/parsers/theme/stac_theme/stac_theme.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 028232ea..e18988dd 100644 --- a/packages/stac/lib/src/parsers/types/type_parser.dart +++ b/packages/stac/lib/src/parsers/types/type_parser.dart @@ -3,21 +3,21 @@ import 'dart:math' as math; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:stac/src/utils/color_utils.dart'; -import 'package:stac_models/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; +import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; import 'package:stac_models/types/stac_alignment.dart'; -import 'package:stac_models/types/stac_alignment_directional.dart'; +import 'package:stac_models/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; import 'package:stac_models/types/stac_blend_mode.dart'; import 'package:stac_models/types/stac_blur_style.dart'; import 'package:stac_models/types/stac_border/stac_border.dart'; -import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; import 'package:stac_models/types/stac_box_constraints/stac_box_constraints.dart'; import 'package:stac_models/types/stac_box_fit.dart'; import 'package:stac_models/types/stac_box_shadow/stac_box_shadow.dart'; import 'package:stac_models/types/stac_box_shape.dart'; +import 'package:stac_models/types/stac_circle_border/stac_circle_border.dart'; import 'package:stac_models/types/stac_clip.dart'; +import 'package:stac_models/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; import 'package:stac_models/types/stac_cross_axis_alignment.dart'; -import 'package:stac_models/types/stac_drag_start_behavior.dart'; import 'package:stac_models/types/stac_filter_quality.dart'; import 'package:stac_models/types/stac_flex_fit.dart'; import 'package:stac_models/types/stac_floating_action_button_location.dart'; @@ -27,6 +27,7 @@ import 'package:stac_models/types/stac_main_axis_alignment.dart'; import 'package:stac_models/types/stac_main_axis_size.dart'; import 'package:stac_models/types/stac_offset/stac_offset.dart'; import 'package:stac_models/types/stac_rect/stac_rect.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; import 'package:stac_models/types/stac_stack_fit.dart'; import 'package:stac_models/types/stac_text_types.dart'; import 'package:stac_models/types/stac_vertical_direction.dart'; @@ -649,6 +650,186 @@ extension StacStackFitParser on StacStackFit { } } +extension StacIconAlignmentParser on StacIconAlignment { + IconAlignment get parse { + switch (this) { + case StacIconAlignment.start: + return IconAlignment.start; + case StacIconAlignment.end: + return IconAlignment.end; + } + } +} + +extension StacSizeParser on StacSize { + Size get parse { + return Size(width, height); + } +} + +extension StacMouseCursorParser on StacMouseCursor { + MouseCursor get parse { + switch (this) { + case StacMouseCursor.none: + return SystemMouseCursors.basic; + 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; + } + } +} + +extension StacMaterialTapTargetSizeParser on StacMaterialTapTargetSize { + MaterialTapTargetSize get parse { + switch (this) { + case StacMaterialTapTargetSize.padded: + return MaterialTapTargetSize.padded; + case StacMaterialTapTargetSize.shrinkWrap: + return MaterialTapTargetSize.shrinkWrap; + } + } +} + +extension StacDurationParser on StacDuration { + Duration get parse { + return Duration( + days: days ?? 0, + hours: hours ?? 0, + minutes: minutes ?? 0, + seconds: seconds ?? 0, + milliseconds: milliseconds ?? 0, + microseconds: microseconds ?? 0, + ); + } +} + +extension StacVisualDensityParser on StacVisualDensity { + VisualDensity get parse { + return VisualDensity( + horizontal: horizontal ?? 0.0, + vertical: vertical ?? 0.0, + ); + } +} + +extension StacShapeBorderParser on StacShapeBorder { + OutlinedBorder parse(BuildContext context) { + switch (this) { + case StacRoundedRectangleBorder(): + return (this as StacRoundedRectangleBorder).parse(context); + case StacCircleBorder(): + return (this as StacCircleBorder).parse(context); + default: + return RoundedRectangleBorder( + side: BorderSide.none, + borderRadius: BorderRadius.zero, + ); + } + } +} + +extension StacRoundedRectangleBorderParser on StacRoundedRectangleBorder { + RoundedRectangleBorder parse(BuildContext context) { + return RoundedRectangleBorder( + side: side?.parse(context) ?? BorderSide.none, + borderRadius: borderRadius?.parse ?? BorderRadius.zero, + ); + } +} + +extension StacCircleBorderParser on StacCircleBorder { + CircleBorder parse(BuildContext context) { + return CircleBorder( + side: side?.parse(context) ?? BorderSide.none, + eccentricity: eccentricity ?? 0.0, + ); + } +} + +extension StacContinuousRectangleBorderParser on StacContinuousRectangleBorder { + ContinuousRectangleBorder parse(BuildContext context) { + return ContinuousRectangleBorder( + side: side?.parse(context) ?? BorderSide.none, + borderRadius: borderRadius?.parse ?? BorderRadius.zero, + ); + } +} + +extension StacBeveledRectangleBorderParser on StacBeveledRectangleBorder { + BeveledRectangleBorder parse(BuildContext context) { + return BeveledRectangleBorder( + side: side?.parse(context) ?? BorderSide.none, + ); + } +} + extension StacFlexFitParser on StacFlexFit { FlexFit get parse { switch (this) { diff --git a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.dart b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.dart index fb0fa9ed..5255e9a6 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; export 'stac_alert_dialog_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.freezed.dart index bd8b2f69..85a031b4 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_alert_dialog/stac_alert_dialog.freezed.dart @@ -183,7 +183,6 @@ abstract mixin class $StacAlertDialogCopyWith<$Res> { StacAlignmentGeometry? alignment, bool scrollable}); - $StacShapeBorderCopyWith<$Res>? get shape; $StacAlignmentGeometryCopyWith<$Res>? get alignment; } @@ -335,20 +334,6 @@ class _$StacAlertDialogCopyWithImpl<$Res> )); } - /// Create a copy of StacAlertDialog - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacAlertDialog /// with the given fields replaced by the non-null parameter values. @override @@ -637,8 +622,6 @@ abstract mixin class _$StacAlertDialogCopyWith<$Res> StacAlignmentGeometry? alignment, bool scrollable}); - @override - $StacShapeBorderCopyWith<$Res>? get shape; @override $StacAlignmentGeometryCopyWith<$Res>? get alignment; } @@ -791,20 +774,6 @@ class __$StacAlertDialogCopyWithImpl<$Res> )); } - /// Create a copy of StacAlertDialog - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } - /// Create a copy of StacAlertDialog /// with the given fields replaced by the non-null parameter values. @override 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 6e83b6b4..675f2f62 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 @@ -2,10 +2,10 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.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_alert_dialog/stac_alert_dialog.dart'; import 'package:stac/src/parsers/widgets/stac_alignment_geometry/stac_alignment_geometry.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.dart b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.dart index 69eb9872..6d3d2793 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.dart @@ -1,8 +1,8 @@ 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_shape_border/stac_shape_border.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; export 'stac_card_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.freezed.dart index 5e8093df..e9cd50a7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_card/stac_card.freezed.dart @@ -96,8 +96,6 @@ abstract mixin class $StacCardCopyWith<$Res> { Clip? clipBehavior, Map? child, bool semanticContainer}); - - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -166,20 +164,6 @@ class _$StacCardCopyWithImpl<$Res> implements $StacCardCopyWith<$Res> { as bool, )); } - - /// Create a copy of StacCard - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } /// @nodoc @@ -308,9 +292,6 @@ abstract mixin class _$StacCardCopyWith<$Res> Clip? clipBehavior, Map? child, bool semanticContainer}); - - @override - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -379,20 +360,6 @@ class __$StacCardCopyWithImpl<$Res> implements _$StacCardCopyWith<$Res> { as bool, )); } - - /// Create a copy of StacCard - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } // dart format on 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 705d2619..afa42b3d 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,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.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/widgets/stac_card/stac_card.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.dart b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.dart index e23a2ab7..b209425f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.dart @@ -1,7 +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_shape_border/stac_shape_border.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; export 'stac_drawer_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.freezed.dart index d99d2ecf..1e154020 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_drawer/stac_drawer.freezed.dart @@ -93,8 +93,6 @@ abstract mixin class $StacDrawerCopyWith<$Res> { Map? child, String? semanticLabel, Clip? clipBehavior}); - - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -158,20 +156,6 @@ class _$StacDrawerCopyWithImpl<$Res> implements $StacDrawerCopyWith<$Res> { as Clip?, )); } - - /// Create a copy of StacDrawer - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } /// @nodoc @@ -293,9 +277,6 @@ abstract mixin class _$StacDrawerCopyWith<$Res> Map? child, String? semanticLabel, Clip? clipBehavior}); - - @override - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -359,20 +340,6 @@ class __$StacDrawerCopyWithImpl<$Res> implements _$StacDrawerCopyWith<$Res> { as Clip?, )); } - - /// Create a copy of StacDrawer - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } // dart format on 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 e0e3033f..99fce58f 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,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/parsers/widgets/stac_drawer/stac_drawer.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/parsers/widgets/stac_shape_border/stac_shape_border.dart'; +import 'package:stac/src/parsers/widgets/stac_drawer/stac_drawer.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart index 68318e40..3ec2dc69 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/framework/framework.dart' show Stac; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style_parser.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; part 'stac_dropdown_menu_entry.freezed.dart'; part 'stac_dropdown_menu_entry.g.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart index 1608a00d..545ea5c7 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_menu_entry.freezed.dart @@ -87,8 +87,6 @@ abstract mixin class $StacDropdownMenuEntryCopyWith<$Res> { Map? trailingIcon, bool enabled, StacButtonStyle? style}); - - $StacButtonStyleCopyWith<$Res>? get style; } /// @nodoc @@ -143,20 +141,6 @@ class _$StacDropdownMenuEntryCopyWithImpl<$Res> as StacButtonStyle?, )); } - - /// Create a copy of StacDropdownMenuEntry - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } } /// @nodoc @@ -284,9 +268,6 @@ abstract mixin class _$StacBDropdownMenuEntryCopyWith<$Res> Map? trailingIcon, bool enabled, StacButtonStyle? style}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; } /// @nodoc @@ -341,20 +322,6 @@ class __$StacBDropdownMenuEntryCopyWithImpl<$Res> as StacButtonStyle?, )); } - - /// Create a copy of StacDropdownMenuEntry - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } } // dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.dart b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.dart deleted file mode 100644 index c5eec3cb..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; - -export 'stac_elevated_button_parser.dart'; - -part 'stac_elevated_button.freezed.dart'; -part 'stac_elevated_button.g.dart'; - -@freezed -abstract class StacElevatedButton with _$StacElevatedButton { - const factory StacElevatedButton({ - Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - @Default(false) bool autofocus, - @Default(Clip.none) Clip clipBehavior, - required Map child, - }) = _StacElevatedButton; - - factory StacElevatedButton.fromJson(Map json) => - _$StacElevatedButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.freezed.dart deleted file mode 100644 index 806ac4d2..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.freezed.dart +++ /dev/null @@ -1,393 +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_elevated_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacElevatedButton { - Map? get onPressed; - Map? get onLongPress; - Map? get onHover; - Map? get onFocusChange; - StacButtonStyle? get style; - bool get autofocus; - Clip get clipBehavior; - Map get child; - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacElevatedButtonCopyWith get copyWith => - _$StacElevatedButtonCopyWithImpl( - this as StacElevatedButton, _$identity); - - /// Serializes this StacElevatedButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacElevatedButton && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - const DeepCollectionEquality() - .equals(other.onLongPress, onLongPress) && - const DeepCollectionEquality().equals(other.onHover, onHover) && - const DeepCollectionEquality() - .equals(other.onFocusChange, onFocusChange) && - (identical(other.style, style) || other.style == style) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other.child, child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(onPressed), - const DeepCollectionEquality().hash(onLongPress), - const DeepCollectionEquality().hash(onHover), - const DeepCollectionEquality().hash(onFocusChange), - style, - autofocus, - clipBehavior, - const DeepCollectionEquality().hash(child)); - - @override - String toString() { - return 'StacElevatedButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class $StacElevatedButtonCopyWith<$Res> { - factory $StacElevatedButtonCopyWith( - StacElevatedButton value, $Res Function(StacElevatedButton) _then) = - _$StacElevatedButtonCopyWithImpl; - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - bool autofocus, - Clip clipBehavior, - Map child}); - - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class _$StacElevatedButtonCopyWithImpl<$Res> - implements $StacElevatedButtonCopyWith<$Res> { - _$StacElevatedButtonCopyWithImpl(this._self, this._then); - - final StacElevatedButton _self; - final $Res Function(StacElevatedButton) _then; - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = null, - Object? clipBehavior = null, - Object? child = null, - }) { - return _then(_self.copyWith( - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self.onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self.onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self.onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: null == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacElevatedButton implements StacElevatedButton { - const _StacElevatedButton( - {final Map? onPressed, - final Map? onLongPress, - final Map? onHover, - final Map? onFocusChange, - this.style, - this.autofocus = false, - this.clipBehavior = Clip.none, - required final Map child}) - : _onPressed = onPressed, - _onLongPress = onLongPress, - _onHover = onHover, - _onFocusChange = onFocusChange, - _child = child; - factory _StacElevatedButton.fromJson(Map json) => - _$StacElevatedButtonFromJson(json); - - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onLongPress; - @override - Map? get onLongPress { - final value = _onLongPress; - if (value == null) return null; - if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onHover; - @override - Map? get onHover { - final value = _onHover; - if (value == null) return null; - if (_onHover is EqualUnmodifiableMapView) return _onHover; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onFocusChange; - @override - Map? get onFocusChange { - final value = _onFocusChange; - if (value == null) return null; - if (_onFocusChange is EqualUnmodifiableMapView) return _onFocusChange; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacButtonStyle? style; - @override - @JsonKey() - final bool autofocus; - @override - @JsonKey() - final Clip clipBehavior; - final Map _child; - @override - Map get child { - if (_child is EqualUnmodifiableMapView) return _child; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_child); - } - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacElevatedButtonCopyWith<_StacElevatedButton> get copyWith => - __$StacElevatedButtonCopyWithImpl<_StacElevatedButton>(this, _$identity); - - @override - Map toJson() { - return _$StacElevatedButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacElevatedButton && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - const DeepCollectionEquality() - .equals(other._onLongPress, _onLongPress) && - const DeepCollectionEquality().equals(other._onHover, _onHover) && - const DeepCollectionEquality() - .equals(other._onFocusChange, _onFocusChange) && - (identical(other.style, style) || other.style == style) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other._child, _child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_onPressed), - const DeepCollectionEquality().hash(_onLongPress), - const DeepCollectionEquality().hash(_onHover), - const DeepCollectionEquality().hash(_onFocusChange), - style, - autofocus, - clipBehavior, - const DeepCollectionEquality().hash(_child)); - - @override - String toString() { - return 'StacElevatedButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class _$StacElevatedButtonCopyWith<$Res> - implements $StacElevatedButtonCopyWith<$Res> { - factory _$StacElevatedButtonCopyWith( - _StacElevatedButton value, $Res Function(_StacElevatedButton) _then) = - __$StacElevatedButtonCopyWithImpl; - @override - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - bool autofocus, - Clip clipBehavior, - Map child}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class __$StacElevatedButtonCopyWithImpl<$Res> - implements _$StacElevatedButtonCopyWith<$Res> { - __$StacElevatedButtonCopyWithImpl(this._self, this._then); - - final _StacElevatedButton _self; - final $Res Function(_StacElevatedButton) _then; - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = null, - Object? clipBehavior = null, - Object? child = null, - }) { - return _then(_StacElevatedButton( - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self._onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self._onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self._onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: null == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacElevatedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -// dart format on 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 b71c38cf..48bcb8c9 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 @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.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_framework/stac_framework.dart'; - -import 'stac_elevated_button.dart'; +import 'package:stac_models/widgets/elevated_button/stac_elevated_button.dart'; class StacElevatedButtonParser extends StacParser { const StacElevatedButtonParser(); @@ -29,9 +30,9 @@ class StacElevatedButtonParser extends StacParser { onFocusChange: (bool value) => value == false ? null : model.onFocusChange, style: model.style?.parseElevatedButton(context), - autofocus: model.autofocus, - clipBehavior: model.clipBehavior, - child: Stac.fromJson(model.child, context), + autofocus: model.autofocus ?? false, + clipBehavior: model.clipBehavior?.parse, + child: model.child?.parse(context), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.dart b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.dart deleted file mode 100644 index 29e14828..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; - -export 'stac_filled_button_parser.dart'; - -part 'stac_filled_button.freezed.dart'; -part 'stac_filled_button.g.dart'; - -@freezed -abstract class StacFilledButton with _$StacFilledButton { - const factory StacFilledButton({ - Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - @Default(false) bool autofocus, - @Default(Clip.none) Clip clipBehavior, - Map? child, - }) = _StacFilledButton; - - factory StacFilledButton.fromJson(Map json) => - _$StacFilledButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.freezed.dart deleted file mode 100644 index 4de76ead..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.freezed.dart +++ /dev/null @@ -1,395 +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_filled_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacFilledButton { - Map? get onPressed; - Map? get onLongPress; - Map? get onHover; - Map? get onFocusChange; - StacButtonStyle? get style; - bool get autofocus; - Clip get clipBehavior; - Map? get child; - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacFilledButtonCopyWith get copyWith => - _$StacFilledButtonCopyWithImpl( - this as StacFilledButton, _$identity); - - /// Serializes this StacFilledButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacFilledButton && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - const DeepCollectionEquality() - .equals(other.onLongPress, onLongPress) && - const DeepCollectionEquality().equals(other.onHover, onHover) && - const DeepCollectionEquality() - .equals(other.onFocusChange, onFocusChange) && - (identical(other.style, style) || other.style == style) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other.child, child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(onPressed), - const DeepCollectionEquality().hash(onLongPress), - const DeepCollectionEquality().hash(onHover), - const DeepCollectionEquality().hash(onFocusChange), - style, - autofocus, - clipBehavior, - const DeepCollectionEquality().hash(child)); - - @override - String toString() { - return 'StacFilledButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class $StacFilledButtonCopyWith<$Res> { - factory $StacFilledButtonCopyWith( - StacFilledButton value, $Res Function(StacFilledButton) _then) = - _$StacFilledButtonCopyWithImpl; - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - bool autofocus, - Clip clipBehavior, - Map? child}); - - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class _$StacFilledButtonCopyWithImpl<$Res> - implements $StacFilledButtonCopyWith<$Res> { - _$StacFilledButtonCopyWithImpl(this._self, this._then); - - final StacFilledButton _self; - final $Res Function(StacFilledButton) _then; - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = null, - Object? clipBehavior = null, - Object? child = freezed, - }) { - return _then(_self.copyWith( - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self.onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self.onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self.onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: freezed == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable - as Map?, - )); - } - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacFilledButton implements StacFilledButton { - const _StacFilledButton( - {final Map? onPressed, - final Map? onLongPress, - final Map? onHover, - final Map? onFocusChange, - this.style, - this.autofocus = false, - this.clipBehavior = Clip.none, - final Map? child}) - : _onPressed = onPressed, - _onLongPress = onLongPress, - _onHover = onHover, - _onFocusChange = onFocusChange, - _child = child; - factory _StacFilledButton.fromJson(Map json) => - _$StacFilledButtonFromJson(json); - - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onLongPress; - @override - Map? get onLongPress { - final value = _onLongPress; - if (value == null) return null; - if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onHover; - @override - Map? get onHover { - final value = _onHover; - if (value == null) return null; - if (_onHover is EqualUnmodifiableMapView) return _onHover; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onFocusChange; - @override - Map? get onFocusChange { - final value = _onFocusChange; - if (value == null) return null; - if (_onFocusChange is EqualUnmodifiableMapView) return _onFocusChange; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacButtonStyle? style; - @override - @JsonKey() - final bool autofocus; - @override - @JsonKey() - final Clip clipBehavior; - final Map? _child; - @override - Map? get child { - final value = _child; - if (value == null) return null; - if (_child is EqualUnmodifiableMapView) return _child; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacFilledButtonCopyWith<_StacFilledButton> get copyWith => - __$StacFilledButtonCopyWithImpl<_StacFilledButton>(this, _$identity); - - @override - Map toJson() { - return _$StacFilledButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacFilledButton && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - const DeepCollectionEquality() - .equals(other._onLongPress, _onLongPress) && - const DeepCollectionEquality().equals(other._onHover, _onHover) && - const DeepCollectionEquality() - .equals(other._onFocusChange, _onFocusChange) && - (identical(other.style, style) || other.style == style) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other._child, _child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_onPressed), - const DeepCollectionEquality().hash(_onLongPress), - const DeepCollectionEquality().hash(_onHover), - const DeepCollectionEquality().hash(_onFocusChange), - style, - autofocus, - clipBehavior, - const DeepCollectionEquality().hash(_child)); - - @override - String toString() { - return 'StacFilledButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class _$StacFilledButtonCopyWith<$Res> - implements $StacFilledButtonCopyWith<$Res> { - factory _$StacFilledButtonCopyWith( - _StacFilledButton value, $Res Function(_StacFilledButton) _then) = - __$StacFilledButtonCopyWithImpl; - @override - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - bool autofocus, - Clip clipBehavior, - Map? child}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class __$StacFilledButtonCopyWithImpl<$Res> - implements _$StacFilledButtonCopyWith<$Res> { - __$StacFilledButtonCopyWithImpl(this._self, this._then); - - final _StacFilledButton _self; - final $Res Function(_StacFilledButton) _then; - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = null, - Object? clipBehavior = null, - Object? child = freezed, - }) { - return _then(_StacFilledButton( - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self._onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self._onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self._onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: freezed == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable - as Map?, - )); - } - - /// Create a copy of StacFilledButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -// dart format on 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 ca2984dc..e8663d85 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 @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.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_framework/stac_framework.dart'; - -import 'stac_filled_button.dart'; +import 'package:stac_models/widgets/filled_button/stac_filled_button.dart'; class StacFilledButtonParser extends StacParser { const StacFilledButtonParser(); @@ -25,13 +26,16 @@ class StacFilledButtonParser extends StacParser { onLongPress: model.onLongPress == null ? null : () => Stac.onCallFromJson(model.onLongPress, context), - onHover: (bool value) => value == false ? null : model.onHover, - onFocusChange: (bool value) => - value == false ? null : model.onFocusChange, + onHover: model.onHover == null + ? null + : (bool value) => Stac.onCallFromJson(model.onHover, context), + onFocusChange: model.onFocusChange == null + ? null + : (bool value) => Stac.onCallFromJson(model.onFocusChange, context), style: model.style?.parseFilledButton(context), - autofocus: model.autofocus, - clipBehavior: model.clipBehavior, - child: Stac.fromJson(model.child, context), + autofocus: model.autofocus ?? false, + clipBehavior: model.clipBehavior?.parse, + child: model.child?.parse(context), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.dart b/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.dart deleted file mode 100644 index ece0828a..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.dart +++ /dev/null @@ -1,40 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/utils/button_utils.dart'; -import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; - -export 'stac_floating_action_button_parser.dart'; - -part 'stac_floating_action_button.freezed.dart'; -part 'stac_floating_action_button.g.dart'; - -@freezed -abstract class StacFloatingActionButton with _$StacFloatingActionButton { - const factory StacFloatingActionButton({ - Map? onPressed, - StacTextStyle? textStyle, - @Default(FloatingActionButtonType.small) - FloatingActionButtonType buttonType, - @Default(false) bool autofocus, - Map? icon, - String? backgroundColor, - String? foregroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - StacTextStyle? extendedTextStyle, - StacDouble? elevation, - StacDouble? focusElevation, - StacDouble? hoverElevation, - StacDouble? disabledElevation, - StacDouble? highlightElevation, - StacDouble? extendedIconLabelSpacing, - bool? enableFeedback, - String? tooltip, - Object? heroTag, - required Map child, - }) = _StacFloatingActionButton; - - factory StacFloatingActionButton.fromJson(Map json) => - _$StacFloatingActionButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.freezed.dart deleted file mode 100644 index 67ec1fc6..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.freezed.dart +++ /dev/null @@ -1,625 +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_floating_action_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacFloatingActionButton { - Map? get onPressed; - StacTextStyle? get textStyle; - FloatingActionButtonType get buttonType; - bool get autofocus; - Map? get icon; - String? get backgroundColor; - String? get foregroundColor; - String? get focusColor; - String? get hoverColor; - String? get splashColor; - StacTextStyle? get extendedTextStyle; - StacDouble? get elevation; - StacDouble? get focusElevation; - StacDouble? get hoverElevation; - StacDouble? get disabledElevation; - StacDouble? get highlightElevation; - StacDouble? get extendedIconLabelSpacing; - bool? get enableFeedback; - String? get tooltip; - Object? get heroTag; - Map get child; - - /// Create a copy of StacFloatingActionButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacFloatingActionButtonCopyWith get copyWith => - _$StacFloatingActionButtonCopyWithImpl( - this as StacFloatingActionButton, _$identity); - - /// Serializes this StacFloatingActionButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacFloatingActionButton && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.buttonType, buttonType) || - other.buttonType == buttonType) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - const DeepCollectionEquality().equals(other.icon, icon) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.extendedTextStyle, extendedTextStyle) || - other.extendedTextStyle == extendedTextStyle) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.focusElevation, focusElevation) || - other.focusElevation == focusElevation) && - (identical(other.hoverElevation, hoverElevation) || - other.hoverElevation == hoverElevation) && - (identical(other.disabledElevation, disabledElevation) || - other.disabledElevation == disabledElevation) && - (identical(other.highlightElevation, highlightElevation) || - other.highlightElevation == highlightElevation) && - (identical( - other.extendedIconLabelSpacing, extendedIconLabelSpacing) || - other.extendedIconLabelSpacing == extendedIconLabelSpacing) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.tooltip, tooltip) || other.tooltip == tooltip) && - const DeepCollectionEquality().equals(other.heroTag, heroTag) && - const DeepCollectionEquality().equals(other.child, child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - const DeepCollectionEquality().hash(onPressed), - textStyle, - buttonType, - autofocus, - const DeepCollectionEquality().hash(icon), - backgroundColor, - foregroundColor, - focusColor, - hoverColor, - splashColor, - extendedTextStyle, - elevation, - focusElevation, - hoverElevation, - disabledElevation, - highlightElevation, - extendedIconLabelSpacing, - enableFeedback, - tooltip, - const DeepCollectionEquality().hash(heroTag), - const DeepCollectionEquality().hash(child) - ]); - - @override - String toString() { - return 'StacFloatingActionButton(onPressed: $onPressed, textStyle: $textStyle, buttonType: $buttonType, autofocus: $autofocus, icon: $icon, backgroundColor: $backgroundColor, foregroundColor: $foregroundColor, focusColor: $focusColor, hoverColor: $hoverColor, splashColor: $splashColor, extendedTextStyle: $extendedTextStyle, elevation: $elevation, focusElevation: $focusElevation, hoverElevation: $hoverElevation, disabledElevation: $disabledElevation, highlightElevation: $highlightElevation, extendedIconLabelSpacing: $extendedIconLabelSpacing, enableFeedback: $enableFeedback, tooltip: $tooltip, heroTag: $heroTag, child: $child)'; - } -} - -/// @nodoc -abstract mixin class $StacFloatingActionButtonCopyWith<$Res> { - factory $StacFloatingActionButtonCopyWith(StacFloatingActionButton value, - $Res Function(StacFloatingActionButton) _then) = - _$StacFloatingActionButtonCopyWithImpl; - @useResult - $Res call( - {Map? onPressed, - StacTextStyle? textStyle, - FloatingActionButtonType buttonType, - bool autofocus, - Map? icon, - String? backgroundColor, - String? foregroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - StacTextStyle? extendedTextStyle, - StacDouble? elevation, - StacDouble? focusElevation, - StacDouble? hoverElevation, - StacDouble? disabledElevation, - StacDouble? highlightElevation, - StacDouble? extendedIconLabelSpacing, - bool? enableFeedback, - String? tooltip, - Object? heroTag, - Map child}); -} - -/// @nodoc -class _$StacFloatingActionButtonCopyWithImpl<$Res> - implements $StacFloatingActionButtonCopyWith<$Res> { - _$StacFloatingActionButtonCopyWithImpl(this._self, this._then); - - final StacFloatingActionButton _self; - final $Res Function(StacFloatingActionButton) _then; - - /// Create a copy of StacFloatingActionButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? onPressed = freezed, - Object? textStyle = freezed, - Object? buttonType = null, - Object? autofocus = null, - Object? icon = freezed, - Object? backgroundColor = freezed, - Object? foregroundColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? splashColor = freezed, - Object? extendedTextStyle = freezed, - Object? elevation = freezed, - Object? focusElevation = freezed, - Object? hoverElevation = freezed, - Object? disabledElevation = freezed, - Object? highlightElevation = freezed, - Object? extendedIconLabelSpacing = freezed, - Object? enableFeedback = freezed, - Object? tooltip = freezed, - Object? heroTag = freezed, - Object? child = null, - }) { - return _then(_self.copyWith( - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - buttonType: null == buttonType - ? _self.buttonType - : buttonType // ignore: cast_nullable_to_non_nullable - as FloatingActionButtonType, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - icon: freezed == icon - ? _self.icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - 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?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - extendedTextStyle: freezed == extendedTextStyle - ? _self.extendedTextStyle - : extendedTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - focusElevation: freezed == focusElevation - ? _self.focusElevation - : focusElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - hoverElevation: freezed == hoverElevation - ? _self.hoverElevation - : hoverElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - disabledElevation: freezed == disabledElevation - ? _self.disabledElevation - : disabledElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - highlightElevation: freezed == highlightElevation - ? _self.highlightElevation - : highlightElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - extendedIconLabelSpacing: freezed == extendedIconLabelSpacing - ? _self.extendedIconLabelSpacing - : extendedIconLabelSpacing // ignore: cast_nullable_to_non_nullable - as StacDouble?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - tooltip: freezed == tooltip - ? _self.tooltip - : tooltip // ignore: cast_nullable_to_non_nullable - as String?, - heroTag: freezed == heroTag ? _self.heroTag : heroTag, - child: null == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacFloatingActionButton implements StacFloatingActionButton { - const _StacFloatingActionButton( - {final Map? onPressed, - this.textStyle, - this.buttonType = FloatingActionButtonType.small, - this.autofocus = false, - final Map? icon, - this.backgroundColor, - this.foregroundColor, - this.focusColor, - this.hoverColor, - this.splashColor, - this.extendedTextStyle, - this.elevation, - this.focusElevation, - this.hoverElevation, - this.disabledElevation, - this.highlightElevation, - this.extendedIconLabelSpacing, - this.enableFeedback, - this.tooltip, - this.heroTag, - required final Map child}) - : _onPressed = onPressed, - _icon = icon, - _child = child; - factory _StacFloatingActionButton.fromJson(Map json) => - _$StacFloatingActionButtonFromJson(json); - - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacTextStyle? textStyle; - @override - @JsonKey() - final FloatingActionButtonType buttonType; - @override - @JsonKey() - final bool autofocus; - 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? backgroundColor; - @override - final String? foregroundColor; - @override - final String? focusColor; - @override - final String? hoverColor; - @override - final String? splashColor; - @override - final StacTextStyle? extendedTextStyle; - @override - final StacDouble? elevation; - @override - final StacDouble? focusElevation; - @override - final StacDouble? hoverElevation; - @override - final StacDouble? disabledElevation; - @override - final StacDouble? highlightElevation; - @override - final StacDouble? extendedIconLabelSpacing; - @override - final bool? enableFeedback; - @override - final String? tooltip; - @override - final Object? heroTag; - final Map _child; - @override - Map get child { - if (_child is EqualUnmodifiableMapView) return _child; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_child); - } - - /// Create a copy of StacFloatingActionButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacFloatingActionButtonCopyWith<_StacFloatingActionButton> get copyWith => - __$StacFloatingActionButtonCopyWithImpl<_StacFloatingActionButton>( - this, _$identity); - - @override - Map toJson() { - return _$StacFloatingActionButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacFloatingActionButton && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - (identical(other.textStyle, textStyle) || - other.textStyle == textStyle) && - (identical(other.buttonType, buttonType) || - other.buttonType == buttonType) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - const DeepCollectionEquality().equals(other._icon, _icon) && - (identical(other.backgroundColor, backgroundColor) || - other.backgroundColor == backgroundColor) && - (identical(other.foregroundColor, foregroundColor) || - other.foregroundColor == foregroundColor) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.extendedTextStyle, extendedTextStyle) || - other.extendedTextStyle == extendedTextStyle) && - (identical(other.elevation, elevation) || - other.elevation == elevation) && - (identical(other.focusElevation, focusElevation) || - other.focusElevation == focusElevation) && - (identical(other.hoverElevation, hoverElevation) || - other.hoverElevation == hoverElevation) && - (identical(other.disabledElevation, disabledElevation) || - other.disabledElevation == disabledElevation) && - (identical(other.highlightElevation, highlightElevation) || - other.highlightElevation == highlightElevation) && - (identical( - other.extendedIconLabelSpacing, extendedIconLabelSpacing) || - other.extendedIconLabelSpacing == extendedIconLabelSpacing) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.tooltip, tooltip) || other.tooltip == tooltip) && - const DeepCollectionEquality().equals(other.heroTag, heroTag) && - const DeepCollectionEquality().equals(other._child, _child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - const DeepCollectionEquality().hash(_onPressed), - textStyle, - buttonType, - autofocus, - const DeepCollectionEquality().hash(_icon), - backgroundColor, - foregroundColor, - focusColor, - hoverColor, - splashColor, - extendedTextStyle, - elevation, - focusElevation, - hoverElevation, - disabledElevation, - highlightElevation, - extendedIconLabelSpacing, - enableFeedback, - tooltip, - const DeepCollectionEquality().hash(heroTag), - const DeepCollectionEquality().hash(_child) - ]); - - @override - String toString() { - return 'StacFloatingActionButton(onPressed: $onPressed, textStyle: $textStyle, buttonType: $buttonType, autofocus: $autofocus, icon: $icon, backgroundColor: $backgroundColor, foregroundColor: $foregroundColor, focusColor: $focusColor, hoverColor: $hoverColor, splashColor: $splashColor, extendedTextStyle: $extendedTextStyle, elevation: $elevation, focusElevation: $focusElevation, hoverElevation: $hoverElevation, disabledElevation: $disabledElevation, highlightElevation: $highlightElevation, extendedIconLabelSpacing: $extendedIconLabelSpacing, enableFeedback: $enableFeedback, tooltip: $tooltip, heroTag: $heroTag, child: $child)'; - } -} - -/// @nodoc -abstract mixin class _$StacFloatingActionButtonCopyWith<$Res> - implements $StacFloatingActionButtonCopyWith<$Res> { - factory _$StacFloatingActionButtonCopyWith(_StacFloatingActionButton value, - $Res Function(_StacFloatingActionButton) _then) = - __$StacFloatingActionButtonCopyWithImpl; - @override - @useResult - $Res call( - {Map? onPressed, - StacTextStyle? textStyle, - FloatingActionButtonType buttonType, - bool autofocus, - Map? icon, - String? backgroundColor, - String? foregroundColor, - String? focusColor, - String? hoverColor, - String? splashColor, - StacTextStyle? extendedTextStyle, - StacDouble? elevation, - StacDouble? focusElevation, - StacDouble? hoverElevation, - StacDouble? disabledElevation, - StacDouble? highlightElevation, - StacDouble? extendedIconLabelSpacing, - bool? enableFeedback, - String? tooltip, - Object? heroTag, - Map child}); -} - -/// @nodoc -class __$StacFloatingActionButtonCopyWithImpl<$Res> - implements _$StacFloatingActionButtonCopyWith<$Res> { - __$StacFloatingActionButtonCopyWithImpl(this._self, this._then); - - final _StacFloatingActionButton _self; - final $Res Function(_StacFloatingActionButton) _then; - - /// Create a copy of StacFloatingActionButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? onPressed = freezed, - Object? textStyle = freezed, - Object? buttonType = null, - Object? autofocus = null, - Object? icon = freezed, - Object? backgroundColor = freezed, - Object? foregroundColor = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? splashColor = freezed, - Object? extendedTextStyle = freezed, - Object? elevation = freezed, - Object? focusElevation = freezed, - Object? hoverElevation = freezed, - Object? disabledElevation = freezed, - Object? highlightElevation = freezed, - Object? extendedIconLabelSpacing = freezed, - Object? enableFeedback = freezed, - Object? tooltip = freezed, - Object? heroTag = freezed, - Object? child = null, - }) { - return _then(_StacFloatingActionButton( - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - textStyle: freezed == textStyle - ? _self.textStyle - : textStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - buttonType: null == buttonType - ? _self.buttonType - : buttonType // ignore: cast_nullable_to_non_nullable - as FloatingActionButtonType, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - icon: freezed == icon - ? _self._icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - backgroundColor: freezed == backgroundColor - ? _self.backgroundColor - : backgroundColor // ignore: cast_nullable_to_non_nullable - as String?, - foregroundColor: freezed == foregroundColor - ? _self.foregroundColor - : foregroundColor // ignore: cast_nullable_to_non_nullable - as String?, - 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?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - extendedTextStyle: freezed == extendedTextStyle - ? _self.extendedTextStyle - : extendedTextStyle // ignore: cast_nullable_to_non_nullable - as StacTextStyle?, - elevation: freezed == elevation - ? _self.elevation - : elevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - focusElevation: freezed == focusElevation - ? _self.focusElevation - : focusElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - hoverElevation: freezed == hoverElevation - ? _self.hoverElevation - : hoverElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - disabledElevation: freezed == disabledElevation - ? _self.disabledElevation - : disabledElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - highlightElevation: freezed == highlightElevation - ? _self.highlightElevation - : highlightElevation // ignore: cast_nullable_to_non_nullable - as StacDouble?, - extendedIconLabelSpacing: freezed == extendedIconLabelSpacing - ? _self.extendedIconLabelSpacing - : extendedIconLabelSpacing // ignore: cast_nullable_to_non_nullable - as StacDouble?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - tooltip: freezed == tooltip - ? _self.tooltip - : tooltip // ignore: cast_nullable_to_non_nullable - as String?, - heroTag: freezed == heroTag ? _self.heroTag : heroTag, - child: null == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.g.dart b/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.g.dart deleted file mode 100644 index cf7d7bbe..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.g.dart +++ /dev/null @@ -1,85 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_floating_action_button.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacFloatingActionButton _$StacFloatingActionButtonFromJson( - Map json) => - _StacFloatingActionButton( - onPressed: json['onPressed'] as Map?, - textStyle: json['textStyle'] == null - ? null - : StacTextStyle.fromJson(json['textStyle'] as Map), - buttonType: $enumDecodeNullable( - _$FloatingActionButtonTypeEnumMap, json['buttonType']) ?? - FloatingActionButtonType.small, - autofocus: json['autofocus'] as bool? ?? false, - icon: json['icon'] as Map?, - backgroundColor: json['backgroundColor'] as String?, - foregroundColor: json['foregroundColor'] as String?, - focusColor: json['focusColor'] as String?, - hoverColor: json['hoverColor'] as String?, - splashColor: json['splashColor'] as String?, - extendedTextStyle: json['extendedTextStyle'] == null - ? null - : StacTextStyle.fromJson( - json['extendedTextStyle'] as Map), - elevation: json['elevation'] == null - ? null - : StacDouble.fromJson(json['elevation']), - focusElevation: json['focusElevation'] == null - ? null - : StacDouble.fromJson(json['focusElevation']), - hoverElevation: json['hoverElevation'] == null - ? null - : StacDouble.fromJson(json['hoverElevation']), - disabledElevation: json['disabledElevation'] == null - ? null - : StacDouble.fromJson(json['disabledElevation']), - highlightElevation: json['highlightElevation'] == null - ? null - : StacDouble.fromJson(json['highlightElevation']), - extendedIconLabelSpacing: json['extendedIconLabelSpacing'] == null - ? null - : StacDouble.fromJson(json['extendedIconLabelSpacing']), - enableFeedback: json['enableFeedback'] as bool?, - tooltip: json['tooltip'] as String?, - heroTag: json['heroTag'], - child: json['child'] as Map, - ); - -Map _$StacFloatingActionButtonToJson( - _StacFloatingActionButton instance) => - { - 'onPressed': instance.onPressed, - 'textStyle': instance.textStyle, - 'buttonType': _$FloatingActionButtonTypeEnumMap[instance.buttonType]!, - 'autofocus': instance.autofocus, - 'icon': instance.icon, - 'backgroundColor': instance.backgroundColor, - 'foregroundColor': instance.foregroundColor, - 'focusColor': instance.focusColor, - 'hoverColor': instance.hoverColor, - 'splashColor': instance.splashColor, - 'extendedTextStyle': instance.extendedTextStyle, - 'elevation': instance.elevation, - 'focusElevation': instance.focusElevation, - 'hoverElevation': instance.hoverElevation, - 'disabledElevation': instance.disabledElevation, - 'highlightElevation': instance.highlightElevation, - 'extendedIconLabelSpacing': instance.extendedIconLabelSpacing, - 'enableFeedback': instance.enableFeedback, - 'tooltip': instance.tooltip, - 'heroTag': instance.heroTag, - 'child': instance.child, - }; - -const _$FloatingActionButtonTypeEnumMap = { - FloatingActionButtonType.extended: 'extended', - FloatingActionButtonType.large: 'large', - FloatingActionButtonType.medium: 'medium', - FloatingActionButtonType.small: 'small', -}; 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 8d8f5c68..a69f5651 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 @@ -1,12 +1,12 @@ 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/parsers/painting/stac_text_style_parser.dart'; -import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button.dart'; -import 'package:stac/src/utils/button_utils.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; +import 'package:stac_models/types/stac_floating_action_button_type.dart'; +import 'package:stac_models/widgets/floating_action_button/stac_floating_action_button.dart'; class StacFloatingActionButtonParser extends StacParser { @@ -22,7 +22,7 @@ class StacFloatingActionButtonParser @override Widget parse(BuildContext context, StacFloatingActionButton model) { switch (model.buttonType) { - case FloatingActionButtonType.extended: + case StacFloatingActionButtonType.extended: return FloatingActionButton.extended( onPressed: model.onPressed == null ? null @@ -34,20 +34,20 @@ class StacFloatingActionButtonParser hoverColor: model.hoverColor?.toColor(context), splashColor: model.splashColor?.toColor(context), extendedTextStyle: model.extendedTextStyle?.parse(context), - elevation: model.elevation?.parse, - focusElevation: model.focusElevation?.parse, - hoverElevation: model.hoverElevation?.parse, - disabledElevation: model.disabledElevation?.parse, - highlightElevation: model.highlightElevation?.parse, - extendedIconLabelSpacing: model.extendedIconLabelSpacing?.parse, + elevation: model.elevation, + focusElevation: model.focusElevation, + hoverElevation: model.hoverElevation, + disabledElevation: model.disabledElevation, + highlightElevation: model.highlightElevation, + extendedIconLabelSpacing: model.extendedIconLabelSpacing, enableFeedback: model.enableFeedback, - autofocus: model.autofocus, + autofocus: model.autofocus ?? false, tooltip: model.tooltip, heroTag: model.heroTag, - label: Stac.fromJson(model.child, context) ?? const SizedBox(), + label: model.child?.parse(context) ?? const SizedBox(), ); - case FloatingActionButtonType.large: + case StacFloatingActionButtonType.large: return FloatingActionButton.large( onPressed: model.onPressed == null ? null @@ -57,19 +57,19 @@ class StacFloatingActionButtonParser focusColor: model.focusColor?.toColor(context), hoverColor: model.hoverColor?.toColor(context), splashColor: model.splashColor?.toColor(context), - elevation: model.elevation?.parse, - focusElevation: model.focusElevation?.parse, - hoverElevation: model.hoverElevation?.parse, - disabledElevation: model.disabledElevation?.parse, - highlightElevation: model.highlightElevation?.parse, + elevation: model.elevation, + focusElevation: model.focusElevation, + hoverElevation: model.hoverElevation, + disabledElevation: model.disabledElevation, + highlightElevation: model.highlightElevation, enableFeedback: model.enableFeedback, - autofocus: model.autofocus, + autofocus: model.autofocus ?? false, tooltip: model.tooltip, heroTag: model.heroTag, - child: Stac.fromJson(model.child, context), + child: model.child?.parse(context), ); - case FloatingActionButtonType.medium: + case StacFloatingActionButtonType.medium: return FloatingActionButton( onPressed: model.onPressed == null ? null @@ -79,19 +79,19 @@ class StacFloatingActionButtonParser focusColor: model.focusColor?.toColor(context), hoverColor: model.hoverColor?.toColor(context), splashColor: model.splashColor?.toColor(context), - elevation: model.elevation?.parse, - focusElevation: model.focusElevation?.parse, - hoverElevation: model.hoverElevation?.parse, - disabledElevation: model.disabledElevation?.parse, - highlightElevation: model.highlightElevation?.parse, + elevation: model.elevation, + focusElevation: model.focusElevation, + hoverElevation: model.hoverElevation, + disabledElevation: model.disabledElevation, + highlightElevation: model.highlightElevation, enableFeedback: model.enableFeedback, - autofocus: model.autofocus, + autofocus: model.autofocus ?? false, tooltip: model.tooltip, heroTag: model.heroTag, - child: Stac.fromJson(model.child, context), + child: model.child?.parse(context), ); - case FloatingActionButtonType.small: + case StacFloatingActionButtonType.small: return FloatingActionButton.small( onPressed: model.onPressed == null ? null @@ -101,16 +101,16 @@ class StacFloatingActionButtonParser focusColor: model.focusColor?.toColor(context), hoverColor: model.hoverColor?.toColor(context), splashColor: model.splashColor?.toColor(context), - elevation: model.elevation?.parse, - focusElevation: model.focusElevation?.parse, - hoverElevation: model.hoverElevation?.parse, - disabledElevation: model.disabledElevation?.parse, - highlightElevation: model.highlightElevation?.parse, + elevation: model.elevation, + focusElevation: model.focusElevation, + hoverElevation: model.hoverElevation, + disabledElevation: model.disabledElevation, + highlightElevation: model.highlightElevation, enableFeedback: model.enableFeedback, - autofocus: model.autofocus, + autofocus: model.autofocus ?? false, tooltip: model.tooltip, heroTag: model.heroTag, - child: Stac.fromJson(model.child, context), + child: model.child?.parse(context), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.dart b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.dart deleted file mode 100644 index eea2a203..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.dart +++ /dev/null @@ -1,39 +0,0 @@ -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac/src/parsers/widgets/stac_alignment/stac_alignment.dart'; -import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; -import 'package:stac_models/types/stac_box_constraints/stac_box_constraints.dart'; - -export 'stac_icon_button_parser.dart'; - -part 'stac_icon_button.freezed.dart'; -part 'stac_icon_button.g.dart'; - -@freezed -abstract class StacIconButton with _$StacIconButton { - const factory StacIconButton({ - StacDouble? iconSize, - StacEdgeInsets? padding, - StacAlignment? alignment, - StacDouble? splashRadius, - String? color, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - String? disabledColor, - Map? onPressed, - @Default(false) bool autofocus, - String? tooltip, - bool? enableFeedback, - StacBoxConstraints? constraints, - StacButtonStyle? style, - bool? isSelected, - Map? selectedIcon, - Map? icon, - }) = _StacIconButton; - - factory StacIconButton.fromJson(Map json) => - _$StacIconButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.freezed.dart deleted file mode 100644 index 4c27d3dc..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.freezed.dart +++ /dev/null @@ -1,616 +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_icon_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacIconButton { - StacDouble? get iconSize; - StacEdgeInsets? get padding; - StacAlignment? get alignment; - StacDouble? get splashRadius; - String? get color; - String? get focusColor; - String? get hoverColor; - String? get highlightColor; - String? get splashColor; - String? get disabledColor; - Map? get onPressed; - bool get autofocus; - String? get tooltip; - bool? get enableFeedback; - StacBoxConstraints? get constraints; - StacButtonStyle? get style; - bool? get isSelected; - Map? get selectedIcon; - Map? get icon; - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacIconButtonCopyWith get copyWith => - _$StacIconButtonCopyWithImpl( - this as StacIconButton, _$identity); - - /// Serializes this StacIconButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacIconButton && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.splashRadius, splashRadius) || - other.splashRadius == splashRadius) && - (identical(other.color, color) || other.color == color) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.tooltip, tooltip) || other.tooltip == tooltip) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.constraints, constraints) || - other.constraints == constraints) && - (identical(other.style, style) || other.style == style) && - (identical(other.isSelected, isSelected) || - other.isSelected == isSelected) && - const DeepCollectionEquality() - .equals(other.selectedIcon, selectedIcon) && - const DeepCollectionEquality().equals(other.icon, icon)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - iconSize, - padding, - alignment, - splashRadius, - color, - focusColor, - hoverColor, - highlightColor, - splashColor, - disabledColor, - const DeepCollectionEquality().hash(onPressed), - autofocus, - tooltip, - enableFeedback, - constraints, - style, - isSelected, - const DeepCollectionEquality().hash(selectedIcon), - const DeepCollectionEquality().hash(icon) - ]); - - @override - String toString() { - return 'StacIconButton(iconSize: $iconSize, padding: $padding, alignment: $alignment, splashRadius: $splashRadius, color: $color, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, splashColor: $splashColor, disabledColor: $disabledColor, onPressed: $onPressed, autofocus: $autofocus, tooltip: $tooltip, enableFeedback: $enableFeedback, constraints: $constraints, style: $style, isSelected: $isSelected, selectedIcon: $selectedIcon, icon: $icon)'; - } -} - -/// @nodoc -abstract mixin class $StacIconButtonCopyWith<$Res> { - factory $StacIconButtonCopyWith( - StacIconButton value, $Res Function(StacIconButton) _then) = - _$StacIconButtonCopyWithImpl; - @useResult - $Res call( - {StacDouble? iconSize, - StacEdgeInsets? padding, - StacAlignment? alignment, - StacDouble? splashRadius, - String? color, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - String? disabledColor, - Map? onPressed, - bool autofocus, - String? tooltip, - bool? enableFeedback, - StacBoxConstraints? constraints, - StacButtonStyle? style, - bool? isSelected, - Map? selectedIcon, - Map? icon}); - - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class _$StacIconButtonCopyWithImpl<$Res> - implements $StacIconButtonCopyWith<$Res> { - _$StacIconButtonCopyWithImpl(this._self, this._then); - - final StacIconButton _self; - final $Res Function(StacIconButton) _then; - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? iconSize = freezed, - Object? padding = freezed, - Object? alignment = freezed, - Object? splashRadius = freezed, - Object? color = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? highlightColor = freezed, - Object? splashColor = freezed, - Object? disabledColor = freezed, - Object? onPressed = freezed, - Object? autofocus = null, - Object? tooltip = freezed, - Object? enableFeedback = freezed, - Object? constraints = freezed, - Object? style = freezed, - Object? isSelected = freezed, - Object? selectedIcon = freezed, - Object? icon = freezed, - }) { - return _then(_self.copyWith( - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as StacDouble?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignment?, - splashRadius: freezed == splashRadius - ? _self.splashRadius - : splashRadius // ignore: cast_nullable_to_non_nullable - as StacDouble?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - 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?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - tooltip: freezed == tooltip - ? _self.tooltip - : tooltip // ignore: cast_nullable_to_non_nullable - as String?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - isSelected: freezed == isSelected - ? _self.isSelected - : isSelected // ignore: cast_nullable_to_non_nullable - as bool?, - selectedIcon: freezed == selectedIcon - ? _self.selectedIcon - : selectedIcon // ignore: cast_nullable_to_non_nullable - as Map?, - icon: freezed == icon - ? _self.icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - )); - } - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacIconButton implements StacIconButton { - const _StacIconButton( - {this.iconSize, - this.padding, - this.alignment, - this.splashRadius, - this.color, - this.focusColor, - this.hoverColor, - this.highlightColor, - this.splashColor, - this.disabledColor, - final Map? onPressed, - this.autofocus = false, - this.tooltip, - this.enableFeedback, - this.constraints, - this.style, - this.isSelected, - final Map? selectedIcon, - final Map? icon}) - : _onPressed = onPressed, - _selectedIcon = selectedIcon, - _icon = icon; - factory _StacIconButton.fromJson(Map json) => - _$StacIconButtonFromJson(json); - - @override - final StacDouble? iconSize; - @override - final StacEdgeInsets? padding; - @override - final StacAlignment? alignment; - @override - final StacDouble? splashRadius; - @override - final String? color; - @override - final String? focusColor; - @override - final String? hoverColor; - @override - final String? highlightColor; - @override - final String? splashColor; - @override - final String? disabledColor; - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - @JsonKey() - final bool autofocus; - @override - final String? tooltip; - @override - final bool? enableFeedback; - @override - final StacBoxConstraints? constraints; - @override - final StacButtonStyle? style; - @override - final bool? isSelected; - final Map? _selectedIcon; - @override - Map? get selectedIcon { - final value = _selectedIcon; - if (value == null) return null; - if (_selectedIcon is EqualUnmodifiableMapView) return _selectedIcon; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - 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); - } - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacIconButtonCopyWith<_StacIconButton> get copyWith => - __$StacIconButtonCopyWithImpl<_StacIconButton>(this, _$identity); - - @override - Map toJson() { - return _$StacIconButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacIconButton && - (identical(other.iconSize, iconSize) || - other.iconSize == iconSize) && - (identical(other.padding, padding) || other.padding == padding) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.splashRadius, splashRadius) || - other.splashRadius == splashRadius) && - (identical(other.color, color) || other.color == color) && - (identical(other.focusColor, focusColor) || - other.focusColor == focusColor) && - (identical(other.hoverColor, hoverColor) || - other.hoverColor == hoverColor) && - (identical(other.highlightColor, highlightColor) || - other.highlightColor == highlightColor) && - (identical(other.splashColor, splashColor) || - other.splashColor == splashColor) && - (identical(other.disabledColor, disabledColor) || - other.disabledColor == disabledColor) && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - (identical(other.autofocus, autofocus) || - other.autofocus == autofocus) && - (identical(other.tooltip, tooltip) || other.tooltip == tooltip) && - (identical(other.enableFeedback, enableFeedback) || - other.enableFeedback == enableFeedback) && - (identical(other.constraints, constraints) || - other.constraints == constraints) && - (identical(other.style, style) || other.style == style) && - (identical(other.isSelected, isSelected) || - other.isSelected == isSelected) && - const DeepCollectionEquality() - .equals(other._selectedIcon, _selectedIcon) && - const DeepCollectionEquality().equals(other._icon, _icon)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hashAll([ - runtimeType, - iconSize, - padding, - alignment, - splashRadius, - color, - focusColor, - hoverColor, - highlightColor, - splashColor, - disabledColor, - const DeepCollectionEquality().hash(_onPressed), - autofocus, - tooltip, - enableFeedback, - constraints, - style, - isSelected, - const DeepCollectionEquality().hash(_selectedIcon), - const DeepCollectionEquality().hash(_icon) - ]); - - @override - String toString() { - return 'StacIconButton(iconSize: $iconSize, padding: $padding, alignment: $alignment, splashRadius: $splashRadius, color: $color, focusColor: $focusColor, hoverColor: $hoverColor, highlightColor: $highlightColor, splashColor: $splashColor, disabledColor: $disabledColor, onPressed: $onPressed, autofocus: $autofocus, tooltip: $tooltip, enableFeedback: $enableFeedback, constraints: $constraints, style: $style, isSelected: $isSelected, selectedIcon: $selectedIcon, icon: $icon)'; - } -} - -/// @nodoc -abstract mixin class _$StacIconButtonCopyWith<$Res> - implements $StacIconButtonCopyWith<$Res> { - factory _$StacIconButtonCopyWith( - _StacIconButton value, $Res Function(_StacIconButton) _then) = - __$StacIconButtonCopyWithImpl; - @override - @useResult - $Res call( - {StacDouble? iconSize, - StacEdgeInsets? padding, - StacAlignment? alignment, - StacDouble? splashRadius, - String? color, - String? focusColor, - String? hoverColor, - String? highlightColor, - String? splashColor, - String? disabledColor, - Map? onPressed, - bool autofocus, - String? tooltip, - bool? enableFeedback, - StacBoxConstraints? constraints, - StacButtonStyle? style, - bool? isSelected, - Map? selectedIcon, - Map? icon}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class __$StacIconButtonCopyWithImpl<$Res> - implements _$StacIconButtonCopyWith<$Res> { - __$StacIconButtonCopyWithImpl(this._self, this._then); - - final _StacIconButton _self; - final $Res Function(_StacIconButton) _then; - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? iconSize = freezed, - Object? padding = freezed, - Object? alignment = freezed, - Object? splashRadius = freezed, - Object? color = freezed, - Object? focusColor = freezed, - Object? hoverColor = freezed, - Object? highlightColor = freezed, - Object? splashColor = freezed, - Object? disabledColor = freezed, - Object? onPressed = freezed, - Object? autofocus = null, - Object? tooltip = freezed, - Object? enableFeedback = freezed, - Object? constraints = freezed, - Object? style = freezed, - Object? isSelected = freezed, - Object? selectedIcon = freezed, - Object? icon = freezed, - }) { - return _then(_StacIconButton( - iconSize: freezed == iconSize - ? _self.iconSize - : iconSize // ignore: cast_nullable_to_non_nullable - as StacDouble?, - padding: freezed == padding - ? _self.padding - : padding // ignore: cast_nullable_to_non_nullable - as StacEdgeInsets?, - alignment: freezed == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignment?, - splashRadius: freezed == splashRadius - ? _self.splashRadius - : splashRadius // ignore: cast_nullable_to_non_nullable - as StacDouble?, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - 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?, - highlightColor: freezed == highlightColor - ? _self.highlightColor - : highlightColor // ignore: cast_nullable_to_non_nullable - as String?, - splashColor: freezed == splashColor - ? _self.splashColor - : splashColor // ignore: cast_nullable_to_non_nullable - as String?, - disabledColor: freezed == disabledColor - ? _self.disabledColor - : disabledColor // ignore: cast_nullable_to_non_nullable - as String?, - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - autofocus: null == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as bool, - tooltip: freezed == tooltip - ? _self.tooltip - : tooltip // ignore: cast_nullable_to_non_nullable - as String?, - enableFeedback: freezed == enableFeedback - ? _self.enableFeedback - : enableFeedback // ignore: cast_nullable_to_non_nullable - as bool?, - constraints: freezed == constraints - ? _self.constraints - : constraints // ignore: cast_nullable_to_non_nullable - as StacBoxConstraints?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - isSelected: freezed == isSelected - ? _self.isSelected - : isSelected // ignore: cast_nullable_to_non_nullable - as bool?, - selectedIcon: freezed == selectedIcon - ? _self._selectedIcon - : selectedIcon // ignore: cast_nullable_to_non_nullable - as Map?, - icon: freezed == icon - ? _self._icon - : icon // ignore: cast_nullable_to_non_nullable - as Map?, - )); - } - - /// Create a copy of StacIconButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.g.dart b/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.g.dart deleted file mode 100644 index e85af1a1..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_icon_button/stac_icon_button.g.dart +++ /dev/null @@ -1,76 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_icon_button.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacIconButton _$StacIconButtonFromJson(Map json) => - _StacIconButton( - iconSize: json['iconSize'] == null - ? null - : StacDouble.fromJson(json['iconSize']), - padding: json['padding'] == null - ? null - : StacEdgeInsets.fromJson(json['padding']), - alignment: $enumDecodeNullable(_$StacAlignmentEnumMap, json['alignment']), - splashRadius: json['splashRadius'] == null - ? null - : StacDouble.fromJson(json['splashRadius']), - color: json['color'] as String?, - focusColor: json['focusColor'] as String?, - hoverColor: json['hoverColor'] as String?, - highlightColor: json['highlightColor'] as String?, - splashColor: json['splashColor'] as String?, - disabledColor: json['disabledColor'] as String?, - onPressed: json['onPressed'] as Map?, - autofocus: json['autofocus'] as bool? ?? false, - tooltip: json['tooltip'] as String?, - enableFeedback: json['enableFeedback'] as bool?, - constraints: json['constraints'] == null - ? null - : StacBoxConstraints.fromJson( - json['constraints'] as Map), - style: json['style'] == null - ? null - : StacButtonStyle.fromJson(json['style'] as Map), - isSelected: json['isSelected'] as bool?, - selectedIcon: json['selectedIcon'] as Map?, - icon: json['icon'] as Map?, - ); - -Map _$StacIconButtonToJson(_StacIconButton instance) => - { - 'iconSize': instance.iconSize, - 'padding': instance.padding, - 'alignment': _$StacAlignmentEnumMap[instance.alignment], - 'splashRadius': instance.splashRadius, - 'color': instance.color, - 'focusColor': instance.focusColor, - 'hoverColor': instance.hoverColor, - 'highlightColor': instance.highlightColor, - 'splashColor': instance.splashColor, - 'disabledColor': instance.disabledColor, - 'onPressed': instance.onPressed, - 'autofocus': instance.autofocus, - 'tooltip': instance.tooltip, - 'enableFeedback': instance.enableFeedback, - 'constraints': instance.constraints, - 'style': instance.style, - 'isSelected': instance.isSelected, - 'selectedIcon': instance.selectedIcon, - 'icon': instance.icon, - }; - -const _$StacAlignmentEnumMap = { - StacAlignment.topLeft: 'topLeft', - StacAlignment.topCenter: 'topCenter', - StacAlignment.topRight: 'topRight', - StacAlignment.centerLeft: 'centerLeft', - StacAlignment.center: 'center', - StacAlignment.centerRight: 'centerRight', - StacAlignment.bottomLeft: 'bottomLeft', - StacAlignment.bottomCenter: 'bottomCenter', - StacAlignment.bottomRight: 'bottomRight', -}; 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 fb504d28..c73d3453 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 @@ -1,14 +1,13 @@ 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/parsers/painting/stac_edge_insets_parser.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.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/parsers/widgets/stac_double/stac_double.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; - -import 'stac_icon_button.dart'; +import 'package:stac_models/widgets/icon_button/stac_icon_button.dart'; class StacIconButtonParser extends StacParser { const StacIconButtonParser(); @@ -23,27 +22,34 @@ class StacIconButtonParser extends StacParser { @override Widget parse(BuildContext context, StacIconButton model) { return IconButton( - iconSize: model.iconSize?.parse, + iconSize: model.iconSize, padding: model.padding?.parse, - alignment: model.alignment?.value, - splashRadius: model.splashRadius?.parse, - color: model.color.toColor(context), - focusColor: model.focusColor.toColor(context), - hoverColor: model.hoverColor.toColor(context), - highlightColor: model.highlightColor.toColor(context), - splashColor: model.splashColor.toColor(context), - disabledColor: model.disabledColor.toColor(context), + alignment: model.alignment?.parse, + splashRadius: model.splashRadius, + color: model.color?.toColor(context), + focusColor: model.focusColor?.toColor(context), + hoverColor: model.hoverColor?.toColor(context), + highlightColor: model.highlightColor?.toColor(context), + splashColor: model.splashColor?.toColor(context), + disabledColor: model.disabledColor?.toColor(context), onPressed: model.onPressed == null ? null : () => Stac.onCallFromJson(model.onPressed, context), - autofocus: model.autofocus, + onHover: model.onHover == null + ? null + : (bool value) => Stac.onCallFromJson(model.onHover, context), + onLongPress: model.onLongPress == null + ? null + : () => Stac.onCallFromJson(model.onLongPress, context), + mouseCursor: model.mouseCursor?.parse, + autofocus: model.autofocus ?? false, tooltip: model.tooltip, enableFeedback: model.enableFeedback, constraints: model.constraints?.parse, style: model.style?.parseIconButton(context), isSelected: model.isSelected, - selectedIcon: Stac.fromJson(model.selectedIcon, context), - icon: Stac.fromJson(model.icon, context) ?? const SizedBox(), + selectedIcon: model.selectedIcon?.parse(context), + icon: model.icon?.parse(context) ?? const SizedBox(), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.freezed.dart deleted file mode 100644 index e90687e4..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.freezed.dart +++ /dev/null @@ -1,275 +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_image.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacImage { - String get src; - StacAlignment get alignment; - StacImageType get imageType; - String? get color; - StacDouble? get width; - StacDouble? get height; - BoxFit? get fit; - - /// Create a copy of StacImage - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacImageCopyWith get copyWith => - _$StacImageCopyWithImpl(this as StacImage, _$identity); - - /// Serializes this StacImage to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacImage && - (identical(other.src, src) || other.src == src) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.imageType, imageType) || - other.imageType == imageType) && - (identical(other.color, color) || other.color == color) && - (identical(other.width, width) || other.width == width) && - (identical(other.height, height) || other.height == height) && - (identical(other.fit, fit) || other.fit == fit)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, src, alignment, imageType, color, width, height, fit); - - @override - String toString() { - return 'StacImage(src: $src, alignment: $alignment, imageType: $imageType, color: $color, width: $width, height: $height, fit: $fit)'; - } -} - -/// @nodoc -abstract mixin class $StacImageCopyWith<$Res> { - factory $StacImageCopyWith(StacImage value, $Res Function(StacImage) _then) = - _$StacImageCopyWithImpl; - @useResult - $Res call( - {String src, - StacAlignment alignment, - StacImageType imageType, - String? color, - StacDouble? width, - StacDouble? height, - BoxFit? fit}); -} - -/// @nodoc -class _$StacImageCopyWithImpl<$Res> implements $StacImageCopyWith<$Res> { - _$StacImageCopyWithImpl(this._self, this._then); - - final StacImage _self; - final $Res Function(StacImage) _then; - - /// Create a copy of StacImage - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? src = null, - Object? alignment = null, - Object? imageType = null, - Object? color = freezed, - Object? width = freezed, - Object? height = freezed, - Object? fit = freezed, - }) { - return _then(_self.copyWith( - src: null == src - ? _self.src - : src // ignore: cast_nullable_to_non_nullable - as String, - alignment: null == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignment, - imageType: null == imageType - ? _self.imageType - : imageType // ignore: cast_nullable_to_non_nullable - as StacImageType, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as StacDouble?, - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as StacDouble?, - fit: freezed == fit - ? _self.fit - : fit // ignore: cast_nullable_to_non_nullable - as BoxFit?, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacImage implements StacImage { - const _StacImage( - {required this.src, - this.alignment = StacAlignment.center, - this.imageType = StacImageType.network, - this.color, - this.width, - this.height, - this.fit}); - factory _StacImage.fromJson(Map json) => - _$StacImageFromJson(json); - - @override - final String src; - @override - @JsonKey() - final StacAlignment alignment; - @override - @JsonKey() - final StacImageType imageType; - @override - final String? color; - @override - final StacDouble? width; - @override - final StacDouble? height; - @override - final BoxFit? fit; - - /// Create a copy of StacImage - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacImageCopyWith<_StacImage> get copyWith => - __$StacImageCopyWithImpl<_StacImage>(this, _$identity); - - @override - Map toJson() { - return _$StacImageToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacImage && - (identical(other.src, src) || other.src == src) && - (identical(other.alignment, alignment) || - other.alignment == alignment) && - (identical(other.imageType, imageType) || - other.imageType == imageType) && - (identical(other.color, color) || other.color == color) && - (identical(other.width, width) || other.width == width) && - (identical(other.height, height) || other.height == height) && - (identical(other.fit, fit) || other.fit == fit)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, src, alignment, imageType, color, width, height, fit); - - @override - String toString() { - return 'StacImage(src: $src, alignment: $alignment, imageType: $imageType, color: $color, width: $width, height: $height, fit: $fit)'; - } -} - -/// @nodoc -abstract mixin class _$StacImageCopyWith<$Res> - implements $StacImageCopyWith<$Res> { - factory _$StacImageCopyWith( - _StacImage value, $Res Function(_StacImage) _then) = - __$StacImageCopyWithImpl; - @override - @useResult - $Res call( - {String src, - StacAlignment alignment, - StacImageType imageType, - String? color, - StacDouble? width, - StacDouble? height, - BoxFit? fit}); -} - -/// @nodoc -class __$StacImageCopyWithImpl<$Res> implements _$StacImageCopyWith<$Res> { - __$StacImageCopyWithImpl(this._self, this._then); - - final _StacImage _self; - final $Res Function(_StacImage) _then; - - /// Create a copy of StacImage - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? src = null, - Object? alignment = null, - Object? imageType = null, - Object? color = freezed, - Object? width = freezed, - Object? height = freezed, - Object? fit = freezed, - }) { - return _then(_StacImage( - src: null == src - ? _self.src - : src // ignore: cast_nullable_to_non_nullable - as String, - alignment: null == alignment - ? _self.alignment - : alignment // ignore: cast_nullable_to_non_nullable - as StacAlignment, - imageType: null == imageType - ? _self.imageType - : imageType // ignore: cast_nullable_to_non_nullable - as StacImageType, - color: freezed == color - ? _self.color - : color // ignore: cast_nullable_to_non_nullable - as String?, - width: freezed == width - ? _self.width - : width // ignore: cast_nullable_to_non_nullable - as StacDouble?, - height: freezed == height - ? _self.height - : height // ignore: cast_nullable_to_non_nullable - as StacDouble?, - fit: freezed == fit - ? _self.fit - : fit // ignore: cast_nullable_to_non_nullable - as BoxFit?, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.g.dart b/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.g.dart deleted file mode 100644 index a437e8f2..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_image/stac_image.g.dart +++ /dev/null @@ -1,61 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_image.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacImage _$StacImageFromJson(Map json) => _StacImage( - src: json['src'] as String, - alignment: - $enumDecodeNullable(_$StacAlignmentEnumMap, json['alignment']) ?? - StacAlignment.center, - imageType: - $enumDecodeNullable(_$StacImageTypeEnumMap, json['imageType']) ?? - StacImageType.network, - color: json['color'] as String?, - width: json['width'] == null ? null : StacDouble.fromJson(json['width']), - height: - json['height'] == null ? null : StacDouble.fromJson(json['height']), - fit: $enumDecodeNullable(_$BoxFitEnumMap, json['fit']), - ); - -Map _$StacImageToJson(_StacImage instance) => - { - 'src': instance.src, - 'alignment': _$StacAlignmentEnumMap[instance.alignment]!, - 'imageType': _$StacImageTypeEnumMap[instance.imageType]!, - 'color': instance.color, - 'width': instance.width, - 'height': instance.height, - 'fit': _$BoxFitEnumMap[instance.fit], - }; - -const _$StacAlignmentEnumMap = { - StacAlignment.topLeft: 'topLeft', - StacAlignment.topCenter: 'topCenter', - StacAlignment.topRight: 'topRight', - StacAlignment.centerLeft: 'centerLeft', - StacAlignment.center: 'center', - StacAlignment.centerRight: 'centerRight', - StacAlignment.bottomLeft: 'bottomLeft', - StacAlignment.bottomCenter: 'bottomCenter', - StacAlignment.bottomRight: 'bottomRight', -}; - -const _$StacImageTypeEnumMap = { - StacImageType.file: 'file', - StacImageType.network: 'network', - StacImageType.asset: 'asset', -}; - -const _$BoxFitEnumMap = { - BoxFit.fill: 'fill', - BoxFit.contain: 'contain', - BoxFit.cover: 'cover', - BoxFit.fitWidth: 'fitWidth', - BoxFit.fitHeight: 'fitHeight', - BoxFit.none: 'none', - BoxFit.scaleDown: 'scaleDown', -}; diff --git a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.dart b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.dart deleted file mode 100644 index 888ef8ac..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; - -export 'stac_outlined_button_parser.dart'; - -part 'stac_outlined_button.freezed.dart'; -part 'stac_outlined_button.g.dart'; - -@freezed -abstract class StacOutlinedButton with _$StacOutlinedButton { - const factory StacOutlinedButton({ - Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - @Default(false) autofocus, - @Default(Clip.none) Clip clipBehavior, - required Map child, - }) = _StacOutlinedButton; - - factory StacOutlinedButton.fromJson(Map json) => - _$StacOutlinedButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.freezed.dart deleted file mode 100644 index 2d66f31f..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.freezed.dart +++ /dev/null @@ -1,391 +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_outlined_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacOutlinedButton { - Map? get onPressed; - Map? get onLongPress; - Map? get onHover; - Map? get onFocusChange; - StacButtonStyle? get style; - dynamic get autofocus; - Clip get clipBehavior; - Map get child; - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacOutlinedButtonCopyWith get copyWith => - _$StacOutlinedButtonCopyWithImpl( - this as StacOutlinedButton, _$identity); - - /// Serializes this StacOutlinedButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacOutlinedButton && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - const DeepCollectionEquality() - .equals(other.onLongPress, onLongPress) && - const DeepCollectionEquality().equals(other.onHover, onHover) && - const DeepCollectionEquality() - .equals(other.onFocusChange, onFocusChange) && - (identical(other.style, style) || other.style == style) && - const DeepCollectionEquality().equals(other.autofocus, autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other.child, child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(onPressed), - const DeepCollectionEquality().hash(onLongPress), - const DeepCollectionEquality().hash(onHover), - const DeepCollectionEquality().hash(onFocusChange), - style, - const DeepCollectionEquality().hash(autofocus), - clipBehavior, - const DeepCollectionEquality().hash(child)); - - @override - String toString() { - return 'StacOutlinedButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class $StacOutlinedButtonCopyWith<$Res> { - factory $StacOutlinedButtonCopyWith( - StacOutlinedButton value, $Res Function(StacOutlinedButton) _then) = - _$StacOutlinedButtonCopyWithImpl; - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - dynamic autofocus, - Clip clipBehavior, - Map child}); - - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class _$StacOutlinedButtonCopyWithImpl<$Res> - implements $StacOutlinedButtonCopyWith<$Res> { - _$StacOutlinedButtonCopyWithImpl(this._self, this._then); - - final StacOutlinedButton _self; - final $Res Function(StacOutlinedButton) _then; - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = freezed, - Object? clipBehavior = null, - Object? child = null, - }) { - return _then(_self.copyWith( - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self.onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self.onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self.onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: freezed == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as dynamic, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: null == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacOutlinedButton implements StacOutlinedButton { - const _StacOutlinedButton( - {final Map? onPressed, - final Map? onLongPress, - final Map? onHover, - final Map? onFocusChange, - this.style, - this.autofocus = false, - this.clipBehavior = Clip.none, - required final Map child}) - : _onPressed = onPressed, - _onLongPress = onLongPress, - _onHover = onHover, - _onFocusChange = onFocusChange, - _child = child; - factory _StacOutlinedButton.fromJson(Map json) => - _$StacOutlinedButtonFromJson(json); - - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onLongPress; - @override - Map? get onLongPress { - final value = _onLongPress; - if (value == null) return null; - if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onHover; - @override - Map? get onHover { - final value = _onHover; - if (value == null) return null; - if (_onHover is EqualUnmodifiableMapView) return _onHover; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onFocusChange; - @override - Map? get onFocusChange { - final value = _onFocusChange; - if (value == null) return null; - if (_onFocusChange is EqualUnmodifiableMapView) return _onFocusChange; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacButtonStyle? style; - @override - @JsonKey() - final dynamic autofocus; - @override - @JsonKey() - final Clip clipBehavior; - final Map _child; - @override - Map get child { - if (_child is EqualUnmodifiableMapView) return _child; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_child); - } - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacOutlinedButtonCopyWith<_StacOutlinedButton> get copyWith => - __$StacOutlinedButtonCopyWithImpl<_StacOutlinedButton>(this, _$identity); - - @override - Map toJson() { - return _$StacOutlinedButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacOutlinedButton && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - const DeepCollectionEquality() - .equals(other._onLongPress, _onLongPress) && - const DeepCollectionEquality().equals(other._onHover, _onHover) && - const DeepCollectionEquality() - .equals(other._onFocusChange, _onFocusChange) && - (identical(other.style, style) || other.style == style) && - const DeepCollectionEquality().equals(other.autofocus, autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - const DeepCollectionEquality().equals(other._child, _child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_onPressed), - const DeepCollectionEquality().hash(_onLongPress), - const DeepCollectionEquality().hash(_onHover), - const DeepCollectionEquality().hash(_onFocusChange), - style, - const DeepCollectionEquality().hash(autofocus), - clipBehavior, - const DeepCollectionEquality().hash(_child)); - - @override - String toString() { - return 'StacOutlinedButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, child: $child)'; - } -} - -/// @nodoc -abstract mixin class _$StacOutlinedButtonCopyWith<$Res> - implements $StacOutlinedButtonCopyWith<$Res> { - factory _$StacOutlinedButtonCopyWith( - _StacOutlinedButton value, $Res Function(_StacOutlinedButton) _then) = - __$StacOutlinedButtonCopyWithImpl; - @override - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - dynamic autofocus, - Clip clipBehavior, - Map child}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class __$StacOutlinedButtonCopyWithImpl<$Res> - implements _$StacOutlinedButtonCopyWith<$Res> { - __$StacOutlinedButtonCopyWithImpl(this._self, this._then); - - final _StacOutlinedButton _self; - final $Res Function(_StacOutlinedButton) _then; - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = freezed, - Object? clipBehavior = null, - Object? child = null, - }) { - return _then(_StacOutlinedButton( - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self._onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self._onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self._onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: freezed == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as dynamic, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - child: null == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacOutlinedButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -// dart format on 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 8025df05..0e9a6312 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 @@ -1,10 +1,11 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.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_framework/stac_framework.dart'; - -import 'stac_outlined_button.dart'; +import 'package:stac_models/widgets/outlined_button/stac_outlined_button.dart'; class StacOutlinedButtonParser extends StacParser { const StacOutlinedButtonParser(); @@ -25,13 +26,16 @@ class StacOutlinedButtonParser extends StacParser { onLongPress: model.onLongPress == null ? null : () => Stac.onCallFromJson(model.onLongPress, context), - onHover: (bool value) => value == false ? null : model.onHover, - onFocusChange: (bool value) => - value == false ? null : model.onFocusChange, + onHover: model.onHover == null + ? null + : (bool value) => Stac.onCallFromJson(model.onHover, context), + onFocusChange: model.onFocusChange == null + ? null + : (bool value) => Stac.onCallFromJson(model.onFocusChange, context), style: model.style?.parseOutlinedButton(context), - autofocus: model.autofocus, - clipBehavior: model.clipBehavior, - child: Stac.fromJson(model.child, context), + autofocus: model.autofocus ?? false, + clipBehavior: model.clipBehavior?.parse, + child: model.child?.parse(context), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.dart deleted file mode 100644 index a1ecda49..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; - -part 'stac_beveled_rectangle_border.freezed.dart'; -part 'stac_beveled_rectangle_border.g.dart'; - -@freezed -abstract class StacBeveledRectangleBorder with _$StacBeveledRectangleBorder { - const factory StacBeveledRectangleBorder({ - @Default(StacBorderSide.none) StacBorderSide side, - @Default(StacBorderRadius()) StacBorderRadius borderRadius, - }) = _StacBeveledRectangleBorder; - - factory StacBeveledRectangleBorder.fromJson(Map json) => - _$StacBeveledRectangleBorderFromJson(json); -} - -extension MiralBeveledRactangleBorderParser on StacBeveledRectangleBorder { - ShapeBorder parse(BuildContext context) { - return BeveledRectangleBorder( - side: side.parse(context), - borderRadius: borderRadius.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.freezed.dart deleted file mode 100644 index 34b36ff5..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.freezed.dart +++ /dev/null @@ -1,184 +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_beveled_rectangle_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacBeveledRectangleBorder { - StacBorderSide get side; - StacBorderRadius get borderRadius; - - /// Create a copy of StacBeveledRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacBeveledRectangleBorderCopyWith - get copyWith => - _$StacBeveledRectangleBorderCopyWithImpl( - this as StacBeveledRectangleBorder, _$identity); - - /// Serializes this StacBeveledRectangleBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacBeveledRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacBeveledRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class $StacBeveledRectangleBorderCopyWith<$Res> { - factory $StacBeveledRectangleBorderCopyWith(StacBeveledRectangleBorder value, - $Res Function(StacBeveledRectangleBorder) _then) = - _$StacBeveledRectangleBorderCopyWithImpl; - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class _$StacBeveledRectangleBorderCopyWithImpl<$Res> - implements $StacBeveledRectangleBorderCopyWith<$Res> { - _$StacBeveledRectangleBorderCopyWithImpl(this._self, this._then); - - final StacBeveledRectangleBorder _self; - final $Res Function(StacBeveledRectangleBorder) _then; - - /// Create a copy of StacBeveledRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_self.copyWith( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacBeveledRectangleBorder implements StacBeveledRectangleBorder { - const _StacBeveledRectangleBorder( - {this.side = StacBorderSide.none, - this.borderRadius = const StacBorderRadius()}); - factory _StacBeveledRectangleBorder.fromJson(Map json) => - _$StacBeveledRectangleBorderFromJson(json); - - @override - @JsonKey() - final StacBorderSide side; - @override - @JsonKey() - final StacBorderRadius borderRadius; - - /// Create a copy of StacBeveledRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacBeveledRectangleBorderCopyWith<_StacBeveledRectangleBorder> - get copyWith => __$StacBeveledRectangleBorderCopyWithImpl< - _StacBeveledRectangleBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacBeveledRectangleBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacBeveledRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacBeveledRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class _$StacBeveledRectangleBorderCopyWith<$Res> - implements $StacBeveledRectangleBorderCopyWith<$Res> { - factory _$StacBeveledRectangleBorderCopyWith( - _StacBeveledRectangleBorder value, - $Res Function(_StacBeveledRectangleBorder) _then) = - __$StacBeveledRectangleBorderCopyWithImpl; - @override - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class __$StacBeveledRectangleBorderCopyWithImpl<$Res> - implements _$StacBeveledRectangleBorderCopyWith<$Res> { - __$StacBeveledRectangleBorderCopyWithImpl(this._self, this._then); - - final _StacBeveledRectangleBorder _self; - final $Res Function(_StacBeveledRectangleBorder) _then; - - /// Create a copy of StacBeveledRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_StacBeveledRectangleBorder( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.g.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.g.dart deleted file mode 100644 index 240bd337..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_beveled_rectangle_border.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_beveled_rectangle_border.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacBeveledRectangleBorder _$StacBeveledRectangleBorderFromJson( - Map json) => - _StacBeveledRectangleBorder( - side: json['side'] == null - ? StacBorderSide.none - : StacBorderSide.fromJson(json['side'] as Map), - borderRadius: json['borderRadius'] == null - ? const StacBorderRadius() - : StacBorderRadius.fromJson(json['borderRadius']), - ); - -Map _$StacBeveledRectangleBorderToJson( - _StacBeveledRectangleBorder instance) => - { - 'side': instance.side, - 'borderRadius': instance.borderRadius, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.dart deleted file mode 100644 index c3945e7d..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.dart +++ /dev/null @@ -1,28 +0,0 @@ -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_double/stac_double.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; - -part 'stac_circle_border.freezed.dart'; -part 'stac_circle_border.g.dart'; - -@freezed -abstract class StacCircleBorder with _$StacCircleBorder { - const factory StacCircleBorder({ - @Default(StacBorderSide.none) StacBorderSide side, - @Default(StacDouble.zero) StacDouble eccentricity, - }) = _StacCircleBorder; - - factory StacCircleBorder.fromJson(Map json) => - _$StacCircleBorderFromJson(json); -} - -extension StacCircleBorderParser on StacCircleBorder { - ShapeBorder parse(BuildContext context) { - return CircleBorder( - side: side.parse(context), - eccentricity: eccentricity.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.freezed.dart deleted file mode 100644 index 9a5a9775..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.freezed.dart +++ /dev/null @@ -1,180 +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_circle_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacCircleBorder { - StacBorderSide get side; - StacDouble get eccentricity; - - /// Create a copy of StacCircleBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacCircleBorderCopyWith get copyWith => - _$StacCircleBorderCopyWithImpl( - this as StacCircleBorder, _$identity); - - /// Serializes this StacCircleBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacCircleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.eccentricity, eccentricity) || - other.eccentricity == eccentricity)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, eccentricity); - - @override - String toString() { - return 'StacCircleBorder(side: $side, eccentricity: $eccentricity)'; - } -} - -/// @nodoc -abstract mixin class $StacCircleBorderCopyWith<$Res> { - factory $StacCircleBorderCopyWith( - StacCircleBorder value, $Res Function(StacCircleBorder) _then) = - _$StacCircleBorderCopyWithImpl; - @useResult - $Res call({StacBorderSide side, StacDouble eccentricity}); -} - -/// @nodoc -class _$StacCircleBorderCopyWithImpl<$Res> - implements $StacCircleBorderCopyWith<$Res> { - _$StacCircleBorderCopyWithImpl(this._self, this._then); - - final StacCircleBorder _self; - final $Res Function(StacCircleBorder) _then; - - /// Create a copy of StacCircleBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? side = null, - Object? eccentricity = null, - }) { - return _then(_self.copyWith( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - eccentricity: null == eccentricity - ? _self.eccentricity - : eccentricity // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacCircleBorder implements StacCircleBorder { - const _StacCircleBorder( - {this.side = StacBorderSide.none, this.eccentricity = StacDouble.zero}); - factory _StacCircleBorder.fromJson(Map json) => - _$StacCircleBorderFromJson(json); - - @override - @JsonKey() - final StacBorderSide side; - @override - @JsonKey() - final StacDouble eccentricity; - - /// Create a copy of StacCircleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacCircleBorderCopyWith<_StacCircleBorder> get copyWith => - __$StacCircleBorderCopyWithImpl<_StacCircleBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacCircleBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacCircleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.eccentricity, eccentricity) || - other.eccentricity == eccentricity)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, eccentricity); - - @override - String toString() { - return 'StacCircleBorder(side: $side, eccentricity: $eccentricity)'; - } -} - -/// @nodoc -abstract mixin class _$StacCircleBorderCopyWith<$Res> - implements $StacCircleBorderCopyWith<$Res> { - factory _$StacCircleBorderCopyWith( - _StacCircleBorder value, $Res Function(_StacCircleBorder) _then) = - __$StacCircleBorderCopyWithImpl; - @override - @useResult - $Res call({StacBorderSide side, StacDouble eccentricity}); -} - -/// @nodoc -class __$StacCircleBorderCopyWithImpl<$Res> - implements _$StacCircleBorderCopyWith<$Res> { - __$StacCircleBorderCopyWithImpl(this._self, this._then); - - final _StacCircleBorder _self; - final $Res Function(_StacCircleBorder) _then; - - /// Create a copy of StacCircleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? side = null, - Object? eccentricity = null, - }) { - return _then(_StacCircleBorder( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - eccentricity: null == eccentricity - ? _self.eccentricity - : eccentricity // ignore: cast_nullable_to_non_nullable - as StacDouble, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.g.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.g.dart deleted file mode 100644 index 314035d1..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_circle_border.g.dart +++ /dev/null @@ -1,23 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_circle_border.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacCircleBorder _$StacCircleBorderFromJson(Map json) => - _StacCircleBorder( - side: json['side'] == null - ? StacBorderSide.none - : StacBorderSide.fromJson(json['side'] as Map), - eccentricity: json['eccentricity'] == null - ? StacDouble.zero - : StacDouble.fromJson(json['eccentricity']), - ); - -Map _$StacCircleBorderToJson(_StacCircleBorder instance) => - { - 'side': instance.side, - 'eccentricity': instance.eccentricity, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.dart deleted file mode 100644 index fd3ef95b..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.dart +++ /dev/null @@ -1,29 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; - -part 'stac_continous_rectangle_border.freezed.dart'; -part 'stac_continous_rectangle_border.g.dart'; - -@freezed -abstract class StacContinousRectangleBorder - with _$StacContinousRectangleBorder { - const factory StacContinousRectangleBorder({ - @Default(StacBorderSide.none) StacBorderSide side, - @Default(StacBorderRadius()) StacBorderRadius borderRadius, - }) = _StacContinousRectangleBorder; - - factory StacContinousRectangleBorder.fromJson(Map json) => - _$StacContinousRectangleBorderFromJson(json); -} - -extension MiralContinousRectangleBorderParser on StacContinousRectangleBorder { - ShapeBorder parse(BuildContext context) { - return ContinuousRectangleBorder( - side: side.parse(context), - borderRadius: borderRadius.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.freezed.dart deleted file mode 100644 index 8f80d219..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.freezed.dart +++ /dev/null @@ -1,185 +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_continous_rectangle_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacContinousRectangleBorder { - StacBorderSide get side; - StacBorderRadius get borderRadius; - - /// Create a copy of StacContinousRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacContinousRectangleBorderCopyWith - get copyWith => _$StacContinousRectangleBorderCopyWithImpl< - StacContinousRectangleBorder>( - this as StacContinousRectangleBorder, _$identity); - - /// Serializes this StacContinousRectangleBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacContinousRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacContinousRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class $StacContinousRectangleBorderCopyWith<$Res> { - factory $StacContinousRectangleBorderCopyWith( - StacContinousRectangleBorder value, - $Res Function(StacContinousRectangleBorder) _then) = - _$StacContinousRectangleBorderCopyWithImpl; - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class _$StacContinousRectangleBorderCopyWithImpl<$Res> - implements $StacContinousRectangleBorderCopyWith<$Res> { - _$StacContinousRectangleBorderCopyWithImpl(this._self, this._then); - - final StacContinousRectangleBorder _self; - final $Res Function(StacContinousRectangleBorder) _then; - - /// Create a copy of StacContinousRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_self.copyWith( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacContinousRectangleBorder implements StacContinousRectangleBorder { - const _StacContinousRectangleBorder( - {this.side = StacBorderSide.none, - this.borderRadius = const StacBorderRadius()}); - factory _StacContinousRectangleBorder.fromJson(Map json) => - _$StacContinousRectangleBorderFromJson(json); - - @override - @JsonKey() - final StacBorderSide side; - @override - @JsonKey() - final StacBorderRadius borderRadius; - - /// Create a copy of StacContinousRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacContinousRectangleBorderCopyWith<_StacContinousRectangleBorder> - get copyWith => __$StacContinousRectangleBorderCopyWithImpl< - _StacContinousRectangleBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacContinousRectangleBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacContinousRectangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacContinousRectangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class _$StacContinousRectangleBorderCopyWith<$Res> - implements $StacContinousRectangleBorderCopyWith<$Res> { - factory _$StacContinousRectangleBorderCopyWith( - _StacContinousRectangleBorder value, - $Res Function(_StacContinousRectangleBorder) _then) = - __$StacContinousRectangleBorderCopyWithImpl; - @override - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class __$StacContinousRectangleBorderCopyWithImpl<$Res> - implements _$StacContinousRectangleBorderCopyWith<$Res> { - __$StacContinousRectangleBorderCopyWithImpl(this._self, this._then); - - final _StacContinousRectangleBorder _self; - final $Res Function(_StacContinousRectangleBorder) _then; - - /// Create a copy of StacContinousRectangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_StacContinousRectangleBorder( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.g.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.g.dart deleted file mode 100644 index b1ed7269..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_continous_rectangle_border.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_continous_rectangle_border.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacContinousRectangleBorder _$StacContinousRectangleBorderFromJson( - Map json) => - _StacContinousRectangleBorder( - side: json['side'] == null - ? StacBorderSide.none - : StacBorderSide.fromJson(json['side'] as Map), - borderRadius: json['borderRadius'] == null - ? const StacBorderRadius() - : StacBorderRadius.fromJson(json['borderRadius']), - ); - -Map _$StacContinousRectangleBorderToJson( - _StacContinousRectangleBorder instance) => - { - 'side': instance.side, - 'borderRadius': instance.borderRadius, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.dart deleted file mode 100644 index 6c40859a..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.dart +++ /dev/null @@ -1,28 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/types/type_parser.dart'; -import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; -import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; - -part 'stac_rounded_rectangle_border.freezed.dart'; -part 'stac_rounded_rectangle_border.g.dart'; - -@freezed -abstract class StacRoundedRactangleBorder with _$StacRoundedRactangleBorder { - const factory StacRoundedRactangleBorder({ - @Default(StacBorderSide.none) StacBorderSide side, - @Default(StacBorderRadius()) StacBorderRadius borderRadius, - }) = _StacRoundedRactangleBorder; - - factory StacRoundedRactangleBorder.fromJson(Map json) => - _$StacRoundedRactangleBorderFromJson(json); -} - -extension StacRoundedRactangleBorderParser on StacRoundedRactangleBorder { - ShapeBorder parse(BuildContext context) { - return RoundedRectangleBorder( - side: side.parse(context), - borderRadius: borderRadius.parse, - ); - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.freezed.dart deleted file mode 100644 index 62052258..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.freezed.dart +++ /dev/null @@ -1,184 +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_rounded_rectangle_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacRoundedRactangleBorder { - StacBorderSide get side; - StacBorderRadius get borderRadius; - - /// Create a copy of StacRoundedRactangleBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacRoundedRactangleBorderCopyWith - get copyWith => - _$StacRoundedRactangleBorderCopyWithImpl( - this as StacRoundedRactangleBorder, _$identity); - - /// Serializes this StacRoundedRactangleBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacRoundedRactangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacRoundedRactangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class $StacRoundedRactangleBorderCopyWith<$Res> { - factory $StacRoundedRactangleBorderCopyWith(StacRoundedRactangleBorder value, - $Res Function(StacRoundedRactangleBorder) _then) = - _$StacRoundedRactangleBorderCopyWithImpl; - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class _$StacRoundedRactangleBorderCopyWithImpl<$Res> - implements $StacRoundedRactangleBorderCopyWith<$Res> { - _$StacRoundedRactangleBorderCopyWithImpl(this._self, this._then); - - final StacRoundedRactangleBorder _self; - final $Res Function(StacRoundedRactangleBorder) _then; - - /// Create a copy of StacRoundedRactangleBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_self.copyWith( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacRoundedRactangleBorder implements StacRoundedRactangleBorder { - const _StacRoundedRactangleBorder( - {this.side = StacBorderSide.none, - this.borderRadius = const StacBorderRadius()}); - factory _StacRoundedRactangleBorder.fromJson(Map json) => - _$StacRoundedRactangleBorderFromJson(json); - - @override - @JsonKey() - final StacBorderSide side; - @override - @JsonKey() - final StacBorderRadius borderRadius; - - /// Create a copy of StacRoundedRactangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacRoundedRactangleBorderCopyWith<_StacRoundedRactangleBorder> - get copyWith => __$StacRoundedRactangleBorderCopyWithImpl< - _StacRoundedRactangleBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacRoundedRactangleBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacRoundedRactangleBorder && - (identical(other.side, side) || other.side == side) && - (identical(other.borderRadius, borderRadius) || - other.borderRadius == borderRadius)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, side, borderRadius); - - @override - String toString() { - return 'StacRoundedRactangleBorder(side: $side, borderRadius: $borderRadius)'; - } -} - -/// @nodoc -abstract mixin class _$StacRoundedRactangleBorderCopyWith<$Res> - implements $StacRoundedRactangleBorderCopyWith<$Res> { - factory _$StacRoundedRactangleBorderCopyWith( - _StacRoundedRactangleBorder value, - $Res Function(_StacRoundedRactangleBorder) _then) = - __$StacRoundedRactangleBorderCopyWithImpl; - @override - @useResult - $Res call({StacBorderSide side, StacBorderRadius borderRadius}); -} - -/// @nodoc -class __$StacRoundedRactangleBorderCopyWithImpl<$Res> - implements _$StacRoundedRactangleBorderCopyWith<$Res> { - __$StacRoundedRactangleBorderCopyWithImpl(this._self, this._then); - - final _StacRoundedRactangleBorder _self; - final $Res Function(_StacRoundedRactangleBorder) _then; - - /// Create a copy of StacRoundedRactangleBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? side = null, - Object? borderRadius = null, - }) { - return _then(_StacRoundedRactangleBorder( - side: null == side - ? _self.side - : side // ignore: cast_nullable_to_non_nullable - as StacBorderSide, - borderRadius: null == borderRadius - ? _self.borderRadius - : borderRadius // ignore: cast_nullable_to_non_nullable - as StacBorderRadius, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.g.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.g.dart deleted file mode 100644 index 17b80dac..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_rounded_rectangle_border.g.dart +++ /dev/null @@ -1,25 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'stac_rounded_rectangle_border.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_StacRoundedRactangleBorder _$StacRoundedRactangleBorderFromJson( - Map json) => - _StacRoundedRactangleBorder( - side: json['side'] == null - ? StacBorderSide.none - : StacBorderSide.fromJson(json['side'] as Map), - borderRadius: json['borderRadius'] == null - ? const StacBorderRadius() - : StacBorderRadius.fromJson(json['borderRadius']), - ); - -Map _$StacRoundedRactangleBorderToJson( - _StacRoundedRactangleBorder instance) => - { - 'side': instance.side, - 'borderRadius': instance.borderRadius, - }; diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.dart deleted file mode 100644 index 30cec5ad..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.dart +++ /dev/null @@ -1,43 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; - -import 'stac_beveled_rectangle_border.dart'; -import 'stac_circle_border.dart'; -import 'stac_continous_rectangle_border.dart'; -import 'stac_rounded_rectangle_border.dart'; - -part 'stac_shape_border.freezed.dart'; -part 'stac_shape_border.g.dart'; - -enum StacShapeBorderType { - circleBorder, - roundedRectangleBorder, - continuousRectangleBorder, - beveledRectangleBorder, -} - -@freezed -abstract class StacShapeBorder with _$StacShapeBorder { - const factory StacShapeBorder({ - required StacShapeBorderType borderType, - required Map data, - }) = _StacShapeBorder; - - factory StacShapeBorder.fromJson(Map json) => - _$StacShapeBorderFromJson(json); -} - -extension StacShapeBorderParser on StacShapeBorder { - ShapeBorder parse(BuildContext context) { - switch (borderType) { - case StacShapeBorderType.circleBorder: - return StacCircleBorder.fromJson(data).parse(context); - case StacShapeBorderType.roundedRectangleBorder: - return StacRoundedRactangleBorder.fromJson(data).parse(context); - case StacShapeBorderType.continuousRectangleBorder: - return StacContinousRectangleBorder.fromJson(data).parse(context); - case StacShapeBorderType.beveledRectangleBorder: - return StacBeveledRectangleBorder.fromJson(data).parse(context); - } - } -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.freezed.dart deleted file mode 100644 index 90770067..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.freezed.dart +++ /dev/null @@ -1,186 +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_shape_border.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacShapeBorder { - StacShapeBorderType get borderType; - Map get data; - - /// Create a copy of StacShapeBorder - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith get copyWith => - _$StacShapeBorderCopyWithImpl( - this as StacShapeBorder, _$identity); - - /// Serializes this StacShapeBorder to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacShapeBorder && - (identical(other.borderType, borderType) || - other.borderType == borderType) && - const DeepCollectionEquality().equals(other.data, data)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, borderType, const DeepCollectionEquality().hash(data)); - - @override - String toString() { - return 'StacShapeBorder(borderType: $borderType, data: $data)'; - } -} - -/// @nodoc -abstract mixin class $StacShapeBorderCopyWith<$Res> { - factory $StacShapeBorderCopyWith( - StacShapeBorder value, $Res Function(StacShapeBorder) _then) = - _$StacShapeBorderCopyWithImpl; - @useResult - $Res call({StacShapeBorderType borderType, Map data}); -} - -/// @nodoc -class _$StacShapeBorderCopyWithImpl<$Res> - implements $StacShapeBorderCopyWith<$Res> { - _$StacShapeBorderCopyWithImpl(this._self, this._then); - - final StacShapeBorder _self; - final $Res Function(StacShapeBorder) _then; - - /// Create a copy of StacShapeBorder - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? borderType = null, - Object? data = null, - }) { - return _then(_self.copyWith( - borderType: null == borderType - ? _self.borderType - : borderType // ignore: cast_nullable_to_non_nullable - as StacShapeBorderType, - data: null == data - ? _self.data - : data // ignore: cast_nullable_to_non_nullable - as Map, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _StacShapeBorder implements StacShapeBorder { - const _StacShapeBorder( - {required this.borderType, required final Map data}) - : _data = data; - factory _StacShapeBorder.fromJson(Map json) => - _$StacShapeBorderFromJson(json); - - @override - final StacShapeBorderType borderType; - final Map _data; - @override - Map get data { - if (_data is EqualUnmodifiableMapView) return _data; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_data); - } - - /// Create a copy of StacShapeBorder - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacShapeBorderCopyWith<_StacShapeBorder> get copyWith => - __$StacShapeBorderCopyWithImpl<_StacShapeBorder>(this, _$identity); - - @override - Map toJson() { - return _$StacShapeBorderToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacShapeBorder && - (identical(other.borderType, borderType) || - other.borderType == borderType) && - const DeepCollectionEquality().equals(other._data, _data)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, borderType, const DeepCollectionEquality().hash(_data)); - - @override - String toString() { - return 'StacShapeBorder(borderType: $borderType, data: $data)'; - } -} - -/// @nodoc -abstract mixin class _$StacShapeBorderCopyWith<$Res> - implements $StacShapeBorderCopyWith<$Res> { - factory _$StacShapeBorderCopyWith( - _StacShapeBorder value, $Res Function(_StacShapeBorder) _then) = - __$StacShapeBorderCopyWithImpl; - @override - @useResult - $Res call({StacShapeBorderType borderType, Map data}); -} - -/// @nodoc -class __$StacShapeBorderCopyWithImpl<$Res> - implements _$StacShapeBorderCopyWith<$Res> { - __$StacShapeBorderCopyWithImpl(this._self, this._then); - - final _StacShapeBorder _self; - final $Res Function(_StacShapeBorder) _then; - - /// Create a copy of StacShapeBorder - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? borderType = null, - Object? data = null, - }) { - return _then(_StacShapeBorder( - borderType: null == borderType - ? _self.borderType - : borderType // ignore: cast_nullable_to_non_nullable - as StacShapeBorderType, - data: null == data - ? _self._data - : data // ignore: cast_nullable_to_non_nullable - as Map, - )); - } -} - -// dart format on diff --git a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.dart b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.dart index 7963dcb1..f31b269f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.dart @@ -2,10 +2,10 @@ import 'package:flutter/material.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:stac/src/parsers/theme/stac_icon_theme_data/stac_icon_theme_data.dart'; import 'package:stac/src/parsers/widgets/stac_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; import 'package:stac_models/painting/stac_system_ui_overlay_style/stac_system_ui_overlay_style.dart'; import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; export 'stac_sliver_app_bar_parser.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.freezed.dart index a3c306de..7163518d 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_sliver_app_bar/stac_sliver_app_bar.freezed.dart @@ -224,7 +224,6 @@ abstract mixin class $StacSliverAppBarCopyWith<$Res> { $StacIconThemeDataCopyWith<$Res>? get iconTheme; $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme; - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -447,20 +446,6 @@ class _$StacSliverAppBarCopyWithImpl<$Res> return _then(_self.copyWith(actionsIconTheme: value)); }); } - - /// Create a copy of StacSliverAppBar - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } /// @nodoc @@ -813,8 +798,6 @@ abstract mixin class _$StacSliverAppBarCopyWith<$Res> $StacIconThemeDataCopyWith<$Res>? get iconTheme; @override $StacIconThemeDataCopyWith<$Res>? get actionsIconTheme; - @override - $StacShapeBorderCopyWith<$Res>? get shape; } /// @nodoc @@ -1037,20 +1020,6 @@ class __$StacSliverAppBarCopyWithImpl<$Res> return _then(_self.copyWith(actionsIconTheme: value)); }); } - - /// Create a copy of StacSliverAppBar - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacShapeBorderCopyWith<$Res>? get shape { - if (_self.shape == null) { - return null; - } - - return $StacShapeBorderCopyWith<$Res>(_self.shape!, (value) { - return _then(_self.copyWith(shape: value)); - }); - } } // dart format on 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 edbdc0f5..3406aa42 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 @@ -4,8 +4,8 @@ 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/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_double/stac_double.dart'; -import 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; import 'package:stac_framework/stac_framework.dart'; diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.dart b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.dart deleted file mode 100644 index eea05f4a..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:freezed_annotation/freezed_annotation.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; - -export 'stac_text_button_parser.dart'; - -part 'stac_text_button.freezed.dart'; -part 'stac_text_button.g.dart'; - -@freezed -abstract class StacTextButton with _$StacTextButton { - const factory StacTextButton({ - Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - @Default(false) autofocus, - @Default(Clip.none) Clip clipBehavior, - @Default(true) bool isSemanticButton, - required Map child, - }) = _StacTextButton; - - factory StacTextButton.fromJson(Map json) => - _$StacTextButtonFromJson(json); -} diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.freezed.dart deleted file mode 100644 index 134a20f8..00000000 --- a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.freezed.dart +++ /dev/null @@ -1,414 +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_text_button.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$StacTextButton { - Map? get onPressed; - Map? get onLongPress; - Map? get onHover; - Map? get onFocusChange; - StacButtonStyle? get style; - dynamic get autofocus; - Clip get clipBehavior; - bool get isSemanticButton; - Map get child; - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $StacTextButtonCopyWith get copyWith => - _$StacTextButtonCopyWithImpl( - this as StacTextButton, _$identity); - - /// Serializes this StacTextButton to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is StacTextButton && - const DeepCollectionEquality().equals(other.onPressed, onPressed) && - const DeepCollectionEquality() - .equals(other.onLongPress, onLongPress) && - const DeepCollectionEquality().equals(other.onHover, onHover) && - const DeepCollectionEquality() - .equals(other.onFocusChange, onFocusChange) && - (identical(other.style, style) || other.style == style) && - const DeepCollectionEquality().equals(other.autofocus, autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.isSemanticButton, isSemanticButton) || - other.isSemanticButton == isSemanticButton) && - const DeepCollectionEquality().equals(other.child, child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(onPressed), - const DeepCollectionEquality().hash(onLongPress), - const DeepCollectionEquality().hash(onHover), - const DeepCollectionEquality().hash(onFocusChange), - style, - const DeepCollectionEquality().hash(autofocus), - clipBehavior, - isSemanticButton, - const DeepCollectionEquality().hash(child)); - - @override - String toString() { - return 'StacTextButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, isSemanticButton: $isSemanticButton, child: $child)'; - } -} - -/// @nodoc -abstract mixin class $StacTextButtonCopyWith<$Res> { - factory $StacTextButtonCopyWith( - StacTextButton value, $Res Function(StacTextButton) _then) = - _$StacTextButtonCopyWithImpl; - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - dynamic autofocus, - Clip clipBehavior, - bool isSemanticButton, - Map child}); - - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class _$StacTextButtonCopyWithImpl<$Res> - implements $StacTextButtonCopyWith<$Res> { - _$StacTextButtonCopyWithImpl(this._self, this._then); - - final StacTextButton _self; - final $Res Function(StacTextButton) _then; - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = freezed, - Object? clipBehavior = null, - Object? isSemanticButton = null, - Object? child = null, - }) { - return _then(_self.copyWith( - onPressed: freezed == onPressed - ? _self.onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self.onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self.onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self.onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: freezed == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as dynamic, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - isSemanticButton: null == isSemanticButton - ? _self.isSemanticButton - : isSemanticButton // ignore: cast_nullable_to_non_nullable - as bool, - child: null == child - ? _self.child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _StacTextButton implements StacTextButton { - const _StacTextButton( - {final Map? onPressed, - final Map? onLongPress, - final Map? onHover, - final Map? onFocusChange, - this.style, - this.autofocus = false, - this.clipBehavior = Clip.none, - this.isSemanticButton = true, - required final Map child}) - : _onPressed = onPressed, - _onLongPress = onLongPress, - _onHover = onHover, - _onFocusChange = onFocusChange, - _child = child; - factory _StacTextButton.fromJson(Map json) => - _$StacTextButtonFromJson(json); - - final Map? _onPressed; - @override - Map? get onPressed { - final value = _onPressed; - if (value == null) return null; - if (_onPressed is EqualUnmodifiableMapView) return _onPressed; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onLongPress; - @override - Map? get onLongPress { - final value = _onLongPress; - if (value == null) return null; - if (_onLongPress is EqualUnmodifiableMapView) return _onLongPress; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onHover; - @override - Map? get onHover { - final value = _onHover; - if (value == null) return null; - if (_onHover is EqualUnmodifiableMapView) return _onHover; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - final Map? _onFocusChange; - @override - Map? get onFocusChange { - final value = _onFocusChange; - if (value == null) return null; - if (_onFocusChange is EqualUnmodifiableMapView) return _onFocusChange; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(value); - } - - @override - final StacButtonStyle? style; - @override - @JsonKey() - final dynamic autofocus; - @override - @JsonKey() - final Clip clipBehavior; - @override - @JsonKey() - final bool isSemanticButton; - final Map _child; - @override - Map get child { - if (_child is EqualUnmodifiableMapView) return _child; - // ignore: implicit_dynamic_type - return EqualUnmodifiableMapView(_child); - } - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$StacTextButtonCopyWith<_StacTextButton> get copyWith => - __$StacTextButtonCopyWithImpl<_StacTextButton>(this, _$identity); - - @override - Map toJson() { - return _$StacTextButtonToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _StacTextButton && - const DeepCollectionEquality() - .equals(other._onPressed, _onPressed) && - const DeepCollectionEquality() - .equals(other._onLongPress, _onLongPress) && - const DeepCollectionEquality().equals(other._onHover, _onHover) && - const DeepCollectionEquality() - .equals(other._onFocusChange, _onFocusChange) && - (identical(other.style, style) || other.style == style) && - const DeepCollectionEquality().equals(other.autofocus, autofocus) && - (identical(other.clipBehavior, clipBehavior) || - other.clipBehavior == clipBehavior) && - (identical(other.isSemanticButton, isSemanticButton) || - other.isSemanticButton == isSemanticButton) && - const DeepCollectionEquality().equals(other._child, _child)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - const DeepCollectionEquality().hash(_onPressed), - const DeepCollectionEquality().hash(_onLongPress), - const DeepCollectionEquality().hash(_onHover), - const DeepCollectionEquality().hash(_onFocusChange), - style, - const DeepCollectionEquality().hash(autofocus), - clipBehavior, - isSemanticButton, - const DeepCollectionEquality().hash(_child)); - - @override - String toString() { - return 'StacTextButton(onPressed: $onPressed, onLongPress: $onLongPress, onHover: $onHover, onFocusChange: $onFocusChange, style: $style, autofocus: $autofocus, clipBehavior: $clipBehavior, isSemanticButton: $isSemanticButton, child: $child)'; - } -} - -/// @nodoc -abstract mixin class _$StacTextButtonCopyWith<$Res> - implements $StacTextButtonCopyWith<$Res> { - factory _$StacTextButtonCopyWith( - _StacTextButton value, $Res Function(_StacTextButton) _then) = - __$StacTextButtonCopyWithImpl; - @override - @useResult - $Res call( - {Map? onPressed, - Map? onLongPress, - Map? onHover, - Map? onFocusChange, - StacButtonStyle? style, - dynamic autofocus, - Clip clipBehavior, - bool isSemanticButton, - Map child}); - - @override - $StacButtonStyleCopyWith<$Res>? get style; -} - -/// @nodoc -class __$StacTextButtonCopyWithImpl<$Res> - implements _$StacTextButtonCopyWith<$Res> { - __$StacTextButtonCopyWithImpl(this._self, this._then); - - final _StacTextButton _self; - final $Res Function(_StacTextButton) _then; - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? onPressed = freezed, - Object? onLongPress = freezed, - Object? onHover = freezed, - Object? onFocusChange = freezed, - Object? style = freezed, - Object? autofocus = freezed, - Object? clipBehavior = null, - Object? isSemanticButton = null, - Object? child = null, - }) { - return _then(_StacTextButton( - onPressed: freezed == onPressed - ? _self._onPressed - : onPressed // ignore: cast_nullable_to_non_nullable - as Map?, - onLongPress: freezed == onLongPress - ? _self._onLongPress - : onLongPress // ignore: cast_nullable_to_non_nullable - as Map?, - onHover: freezed == onHover - ? _self._onHover - : onHover // ignore: cast_nullable_to_non_nullable - as Map?, - onFocusChange: freezed == onFocusChange - ? _self._onFocusChange - : onFocusChange // ignore: cast_nullable_to_non_nullable - as Map?, - style: freezed == style - ? _self.style - : style // ignore: cast_nullable_to_non_nullable - as StacButtonStyle?, - autofocus: freezed == autofocus - ? _self.autofocus - : autofocus // ignore: cast_nullable_to_non_nullable - as dynamic, - clipBehavior: null == clipBehavior - ? _self.clipBehavior - : clipBehavior // ignore: cast_nullable_to_non_nullable - as Clip, - isSemanticButton: null == isSemanticButton - ? _self.isSemanticButton - : isSemanticButton // ignore: cast_nullable_to_non_nullable - as bool, - child: null == child - ? _self._child - : child // ignore: cast_nullable_to_non_nullable - as Map, - )); - } - - /// Create a copy of StacTextButton - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $StacButtonStyleCopyWith<$Res>? get style { - if (_self.style == null) { - return null; - } - - return $StacButtonStyleCopyWith<$Res>(_self.style!, (value) { - return _then(_self.copyWith(style: value)); - }); - } -} - -// dart format on 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 98e8261f..8c0c5867 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 @@ -1,9 +1,11 @@ import 'package:flutter/material.dart'; import 'package:stac/src/framework/framework.dart'; -import 'package:stac/src/parsers/theme/stac_button_style/stac_button_style.dart'; -import 'package:stac/src/parsers/widgets/stac_text_button/stac_text_button.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_framework/stac_framework.dart'; +import 'package:stac_models/widgets/text_button/stac_text_button.dart'; class StacTextButtonParser extends StacParser { const StacTextButtonParser(); @@ -24,14 +26,17 @@ class StacTextButtonParser extends StacParser { onLongPress: model.onLongPress == null ? null : () => Stac.onCallFromJson(model.onLongPress, context), - onHover: (bool value) => value == false ? null : model.onHover, - onFocusChange: (bool value) => - value == false ? null : model.onFocusChange, + onHover: model.onHover == null + ? null + : (bool value) => Stac.onCallFromJson(model.onHover, context), + onFocusChange: model.onFocusChange == null + ? null + : (bool value) => Stac.onCallFromJson(model.onFocusChange, context), style: model.style?.parseTextButton(context), - autofocus: model.autofocus, - clipBehavior: model.clipBehavior, + autofocus: model.autofocus ?? false, + clipBehavior: model.clipBehavior?.parse, isSemanticButton: model.isSemanticButton, - child: Stac.fromJson(model.child, context) ?? const SizedBox(), + child: model.child?.parse(context) ?? const SizedBox(), ); } } diff --git a/packages/stac/lib/src/parsers/widgets/widgets.dart b/packages/stac/lib/src/parsers/widgets/widgets.dart index a3295060..b0e4d045 100644 --- a/packages/stac/lib/src/parsers/widgets/widgets.dart +++ b/packages/stac/lib/src/parsers/widgets/widgets.dart @@ -20,8 +20,8 @@ export 'package:stac/src/parsers/widgets/stac_circular_progress_indicator/stac_c export 'package:stac/src/parsers/widgets/stac_clip_oval/stac_clip_oval.dart'; export 'package:stac/src/parsers/widgets/stac_clip_rrect/stac_clip_rrect.dart'; export 'package:stac/src/parsers/widgets/stac_colored_box/stac_colored_box.dart'; -export 'package:stac/src/parsers/widgets/stac_conditional/stac_conditional.dart'; export 'package:stac/src/parsers/widgets/stac_column/stac_column_parser.dart'; +export 'package:stac/src/parsers/widgets/stac_conditional/stac_conditional.dart'; export 'package:stac/src/parsers/widgets/stac_container/stac_container_parser.dart'; export 'package:stac/src/parsers/widgets/stac_custom_scroll_view/stac_custom_scroll_view.dart'; export 'package:stac/src/parsers/widgets/stac_default_bottom_navigation_controller/stac_default_bottom_navigation_controller.dart'; @@ -33,8 +33,12 @@ export 'package:stac/src/parsers/widgets/stac_dropdown_menu_entry/stac_dropdown_ export 'package:stac/src/parsers/widgets/stac_duration/stac_duration.dart'; export 'package:stac/src/parsers/widgets/stac_dynamic_view/stac_dynamic_view.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.dart'; +export 'package:stac/src/parsers/widgets/stac_elevated_button/stac_elevated_button_parser.dart'; export 'package:stac/src/parsers/widgets/stac_expanded/stac_expanded_parser.dart'; +export 'package:stac/src/parsers/widgets/stac_filled_button/stac_filled_button_parser.dart'; +export 'package:stac/src/parsers/widgets/stac_fitted_box/stac_fitted_box.dart'; +export 'package:stac/src/parsers/widgets/stac_flexible/stac_flexible.dart'; +export 'package:stac/src/parsers/widgets/stac_floating_action_button/stac_floating_action_button_parser.dart'; export 'package:stac/src/parsers/widgets/stac_filled_button/stac_filled_button.dart'; export 'package:stac/src/parsers/widgets/stac_fitted_box/stac_fitted_box_parser.dart'; export 'package:stac/src/parsers/widgets/stac_flexible/stac_flexible_parser.dart'; @@ -49,7 +53,7 @@ export 'package:stac/src/parsers/widgets/stac_gradient/stac_gradient.dart'; export 'package:stac/src/parsers/widgets/stac_grid_view/stac_grid_view.dart'; export 'package:stac/src/parsers/widgets/stac_hero/stac_hero.dart'; export 'package:stac/src/parsers/widgets/stac_icon/stac_icon.dart'; -export 'package:stac/src/parsers/widgets/stac_icon_button/stac_icon_button.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'; @@ -59,7 +63,7 @@ export 'package:stac/src/parsers/widgets/stac_list_tile/stac_list_tile.dart'; export 'package:stac/src/parsers/widgets/stac_list_view/stac_list_view.dart'; export 'package:stac/src/parsers/widgets/stac_network_widget/stac_network_widget.dart'; export 'package:stac/src/parsers/widgets/stac_opacity/stac_opacity.dart'; -export 'package:stac/src/parsers/widgets/stac_outlined_button/stac_outlined_button.dart'; +export 'package:stac/src/parsers/widgets/stac_outlined_button/stac_outlined_button_parser.dart'; export 'package:stac/src/parsers/widgets/stac_padding/stac_padding_parser.dart'; export 'package:stac/src/parsers/widgets/stac_page_view/stac_page_view.dart'; export 'package:stac/src/parsers/widgets/stac_placeholder/stac_placeholder.dart'; @@ -70,7 +74,6 @@ export 'package:stac/src/parsers/widgets/stac_refresh_indicator/stac_refresh_ind export 'package:stac/src/parsers/widgets/stac_safe_area/stac_safe_area.dart'; export 'package:stac/src/parsers/widgets/stac_scaffold/stac_scaffold_parser.dart'; export 'package:stac/src/parsers/widgets/stac_set_value/stac_set_value.dart'; -export 'package:stac/src/parsers/widgets/stac_shape_border/stac_shape_border.dart'; export 'package:stac/src/parsers/widgets/stac_single_child_scroll_view/stac_single_child_scroll_view.dart'; export 'package:stac/src/parsers/widgets/stac_sized_box/stac_sized_box_parser.dart'; export 'package:stac/src/parsers/widgets/stac_slider/stac_slider.dart'; @@ -83,7 +86,7 @@ export 'package:stac/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart'; export 'package:stac/src/parsers/widgets/stac_tab_bar_view/stac_tab_bar_view.dart'; export 'package:stac/src/parsers/widgets/stac_table/stac_table.dart'; export 'package:stac/src/parsers/widgets/stac_table_cell/stac_table_cell.dart'; -export 'package:stac/src/parsers/widgets/stac_text_button/stac_text_button.dart'; +export 'package:stac/src/parsers/widgets/stac_text_button/stac_text_button_parser.dart'; export 'package:stac/src/parsers/widgets/stac_text_field/stac_text_field.dart'; export 'package:stac/src/parsers/widgets/stac_text_form_field/stac_text_form_field.dart'; export 'package:stac/src/parsers/widgets/stac_text_style/stac_text_style.dart'; diff --git a/packages/stac_models/lib/painting/stac_box_decoration/stac_box_decoration.dart b/packages/stac_models/lib/painting/stac_box_decoration/stac_box_decoration.dart index 487cbc75..8e90297e 100644 --- a/packages/stac_models/lib/painting/stac_box_decoration/stac_box_decoration.dart +++ b/packages/stac_models/lib/painting/stac_box_decoration/stac_box_decoration.dart @@ -2,7 +2,6 @@ import 'package:json_annotation/json_annotation.dart'; import 'package:stac_models/stac_models.dart'; import 'package:stac_models/types/stac_blend_mode.dart'; import 'package:stac_models/types/stac_border/stac_border.dart'; -import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; import 'package:stac_models/types/stac_box_shadow/stac_box_shadow.dart'; import 'package:stac_models/types/stac_box_shape.dart'; import 'package:stac_models/types/stac_gradient/stac_gradient.dart'; diff --git a/packages/stac_models/lib/theme/stac_button_style/stac_button_style.dart b/packages/stac_models/lib/theme/stac_button_style/stac_button_style.dart new file mode 100644 index 00000000..d21efe42 --- /dev/null +++ b/packages/stac_models/lib/theme/stac_button_style/stac_button_style.dart @@ -0,0 +1,165 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/stac_model.dart'; +import 'package:stac_models/painting/stac_color/stac_colors.dart'; +import 'package:stac_models/painting/stac_edge_insets/stac_edge_insets.dart'; +import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_alignment.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_duration/stac_duration.dart'; +import 'package:stac_models/types/stac_mouse_cursor.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; +import 'package:stac_models/types/stac_size/stac_size.dart'; +import 'package:stac_models/types/stac_visual_density/stac_visual_density.dart'; + +part 'stac_button_style.g.dart'; + +/// Enum for icon alignment in buttons +enum StacIconAlignment { start, end } + +/// Enum for Material tap target size +enum StacMaterialTapTargetSize { padded, shrinkWrap } + +/// A Stac model representing Flutter's ButtonStyle. +/// +/// Defines the visual properties of Material buttons like ElevatedButton, +/// TextButton, OutlinedButton, etc. +/// +/// ```dart +/// StacButtonStyle( +/// foregroundColor: StacColors.white, +/// backgroundColor: StacColors.blue, +/// elevation: 4.0, +/// padding: StacEdgeInsets.all(16.0), +/// ) +/// ``` +/// +/// ```json +/// { +/// "foregroundColor": "#FFFFFF", +/// "backgroundColor": "#2196F3", +/// "elevation": 4.0, +/// "padding": {"all": 16.0} +/// } +/// ``` +@JsonSerializable() +class StacButtonStyle extends StacElement { + /// Creates a [StacButtonStyle] with the given properties. + const StacButtonStyle({ + this.foregroundColor, + this.backgroundColor, + this.disabledForegroundColor, + this.disabledBackgroundColor, + this.shadowColor, + this.surfaceTintColor, + this.iconColor, + this.iconSize, + this.iconAlignment, + this.disabledIconColor, + this.overlayColor, + this.elevation, + this.textStyle, + this.padding, + this.minimumSize, + this.fixedSize, + this.maximumSize, + this.side, + this.shape, + this.enableFeedback, + this.alignment, + this.tapTargetSize, + this.animationDuration, + this.enabledMouseCursor, + this.disabledMouseCursor, + this.visualDensity, + }); + + /// The color to use for this button's text and icons. + final StacColor? foregroundColor; + + /// The background fill color. + final StacColor? backgroundColor; + + /// The foreground color to use when this button is disabled. + final StacColor? disabledForegroundColor; + + /// The background color to use when this button is disabled. + final StacColor? disabledBackgroundColor; + + /// The shadow color of the button's [Material]. + final StacColor? shadowColor; + + /// The surface tint color of the button's [Material]. + final StacColor? surfaceTintColor; + + /// The color to use for this button's icons. + final StacColor? iconColor; + + /// The size of this button's icon. + final double? iconSize; + + /// The alignment of the button's icon relative to its text label. + final StacIconAlignment? iconAlignment; + + /// The color to use for this button's icons when the button is disabled. + final StacColor? disabledIconColor; + + /// The overlay color of the button's [InkWell]. + final StacColor? overlayColor; + + /// The elevation of the button's [Material]. + final double? elevation; + + /// The style to use for this button's [Text] widget descendants. + final StacTextStyle? textStyle; + + /// The internal padding for the button's [child]. + final StacEdgeInsets? padding; + + /// The minimum size of the button. + /// Represented as {"width": 64.0, "height": 36.0} + final StacSize? minimumSize; + + /// The button's size. + /// Represented as {"width": 200.0, "height": 50.0} + final StacSize? fixedSize; + + /// The maximum size of the button. + /// Represented as {"width": 300.0, "height": 100.0} + final StacSize? maximumSize; + + /// The color and weight of the button's outline. + final StacBorderSide? side; + + /// The shape of the button's border. + final StacShapeBorder? shape; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + final bool? enableFeedback; + + /// Typically used to size the button's [child]. + final StacAlignment? alignment; + + /// Configures the minimum size of the area within which the button may be pressed. + final StacMaterialTapTargetSize? tapTargetSize; + + /// Defines the duration of animated changes for shape and elevation. + /// Duration in milliseconds. + final StacDuration? animationDuration; + + /// The mouse cursor to use when the button is enabled. + final StacMouseCursor? enabledMouseCursor; + + /// The mouse cursor to use when the button is disabled. + final StacMouseCursor? disabledMouseCursor; + + /// The visual density of the button's [Material]. + final StacVisualDensity? visualDensity; + + /// Creates a [StacButtonStyle] from JSON. + factory StacButtonStyle.fromJson(Map json) => + _$StacButtonStyleFromJson(json); + + /// Converts this button style to JSON. + @override + Map toJson() => _$StacButtonStyleToJson(this); +} diff --git a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.g.dart b/packages/stac_models/lib/theme/stac_button_style/stac_button_style.g.dart similarity index 56% rename from packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.g.dart rename to packages/stac_models/lib/theme/stac_button_style/stac_button_style.g.dart index f81a6882..949d9afb 100644 --- a/packages/stac/lib/src/parsers/theme/stac_button_style/stac_button_style.g.dart +++ b/packages/stac_models/lib/theme/stac_button_style/stac_button_style.g.dart @@ -6,8 +6,8 @@ part of 'stac_button_style.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacButtonStyle _$StacButtonStyleFromJson(Map json) => - _StacButtonStyle( +StacButtonStyle _$StacButtonStyleFromJson(Map json) => + StacButtonStyle( foregroundColor: json['foregroundColor'] as String?, backgroundColor: json['backgroundColor'] as String?, disabledForegroundColor: json['disabledForegroundColor'] as String?, @@ -16,8 +16,10 @@ _StacButtonStyle _$StacButtonStyleFromJson(Map json) => surfaceTintColor: json['surfaceTintColor'] as String?, iconColor: json['iconColor'] as String?, iconSize: (json['iconSize'] as num?)?.toDouble(), - iconAlignment: - $enumDecodeNullable(_$IconAlignmentEnumMap, json['iconAlignment']), + iconAlignment: $enumDecodeNullable( + _$StacIconAlignmentEnumMap, + json['iconAlignment'], + ), disabledIconColor: json['disabledIconColor'] as String?, overlayColor: json['overlayColor'] as String?, elevation: (json['elevation'] as num?)?.toDouble(), @@ -41,63 +43,84 @@ _StacButtonStyle _$StacButtonStyleFromJson(Map json) => : StacBorderSide.fromJson(json['side'] as Map), shape: json['shape'] == null ? null - : StacRoundedRectangleBorder.fromJson( - json['shape'] as Map), + : StacShapeBorder.fromJson(json['shape'] as Map), + enableFeedback: json['enableFeedback'] as bool?, + alignment: $enumDecodeNullable(_$StacAlignmentEnumMap, json['alignment']), + tapTargetSize: $enumDecodeNullable( + _$StacMaterialTapTargetSizeEnumMap, + json['tapTargetSize'], + ), + animationDuration: json['animationDuration'] == null + ? null + : StacDuration.fromJson( + json['animationDuration'] as Map, + ), enabledMouseCursor: $enumDecodeNullable( - _$StacMouseCursorEnumMap, json['enabledMouseCursor']), + _$StacMouseCursorEnumMap, + json['enabledMouseCursor'], + ), disabledMouseCursor: $enumDecodeNullable( - _$StacMouseCursorEnumMap, json['disabledMouseCursor']), + _$StacMouseCursorEnumMap, + json['disabledMouseCursor'], + ), visualDensity: json['visualDensity'] == null ? null : StacVisualDensity.fromJson( - json['visualDensity'] as Map), - tapTargetSize: $enumDecodeNullable( - _$MaterialTapTargetSizeEnumMap, json['tapTargetSize']), - animationDuration: json['animationDuration'] == null - ? null - : Duration(microseconds: (json['animationDuration'] as num).toInt()), - enableFeedback: json['enableFeedback'] as bool?, - alignment: json['alignment'] == null - ? null - : StacAlignmentGeometry.fromJson( - json['alignment'] as Map), + json['visualDensity'] as Map, + ), ); -Map _$StacButtonStyleToJson(_StacButtonStyle instance) => - { - 'foregroundColor': instance.foregroundColor, - 'backgroundColor': instance.backgroundColor, - 'disabledForegroundColor': instance.disabledForegroundColor, - 'disabledBackgroundColor': instance.disabledBackgroundColor, - 'shadowColor': instance.shadowColor, - 'surfaceTintColor': instance.surfaceTintColor, - 'iconColor': instance.iconColor, - 'iconSize': instance.iconSize, - 'iconAlignment': _$IconAlignmentEnumMap[instance.iconAlignment], - 'disabledIconColor': instance.disabledIconColor, - 'overlayColor': instance.overlayColor, - 'elevation': instance.elevation, - 'textStyle': instance.textStyle, - 'padding': instance.padding, - 'minimumSize': instance.minimumSize, - 'fixedSize': instance.fixedSize, - 'maximumSize': instance.maximumSize, - 'side': instance.side, - 'shape': instance.shape, - 'enabledMouseCursor': - _$StacMouseCursorEnumMap[instance.enabledMouseCursor], - 'disabledMouseCursor': - _$StacMouseCursorEnumMap[instance.disabledMouseCursor], - 'visualDensity': instance.visualDensity, - 'tapTargetSize': _$MaterialTapTargetSizeEnumMap[instance.tapTargetSize], - 'animationDuration': instance.animationDuration?.inMicroseconds, - 'enableFeedback': instance.enableFeedback, - 'alignment': instance.alignment, - }; +Map _$StacButtonStyleToJson( + StacButtonStyle instance, +) => { + 'foregroundColor': instance.foregroundColor, + 'backgroundColor': instance.backgroundColor, + 'disabledForegroundColor': instance.disabledForegroundColor, + 'disabledBackgroundColor': instance.disabledBackgroundColor, + 'shadowColor': instance.shadowColor, + 'surfaceTintColor': instance.surfaceTintColor, + 'iconColor': instance.iconColor, + 'iconSize': instance.iconSize, + 'iconAlignment': _$StacIconAlignmentEnumMap[instance.iconAlignment], + 'disabledIconColor': instance.disabledIconColor, + 'overlayColor': instance.overlayColor, + 'elevation': instance.elevation, + 'textStyle': instance.textStyle?.toJson(), + 'padding': instance.padding?.toJson(), + 'minimumSize': instance.minimumSize?.toJson(), + 'fixedSize': instance.fixedSize?.toJson(), + 'maximumSize': instance.maximumSize?.toJson(), + 'side': instance.side?.toJson(), + 'shape': instance.shape?.toJson(), + 'enableFeedback': instance.enableFeedback, + 'alignment': _$StacAlignmentEnumMap[instance.alignment], + 'tapTargetSize': _$StacMaterialTapTargetSizeEnumMap[instance.tapTargetSize], + 'animationDuration': instance.animationDuration?.toJson(), + 'enabledMouseCursor': _$StacMouseCursorEnumMap[instance.enabledMouseCursor], + 'disabledMouseCursor': _$StacMouseCursorEnumMap[instance.disabledMouseCursor], + 'visualDensity': instance.visualDensity?.toJson(), +}; + +const _$StacIconAlignmentEnumMap = { + StacIconAlignment.start: 'start', + StacIconAlignment.end: 'end', +}; + +const _$StacAlignmentEnumMap = { + StacAlignment.topLeft: 'topLeft', + StacAlignment.topCenter: 'topCenter', + StacAlignment.topRight: 'topRight', + StacAlignment.centerLeft: 'centerLeft', + StacAlignment.center: 'center', + StacAlignment.centerRight: 'centerRight', + StacAlignment.bottomLeft: 'bottomLeft', + StacAlignment.bottomCenter: 'bottomCenter', + StacAlignment.bottomRight: 'bottomRight', +}; -const _$IconAlignmentEnumMap = { - IconAlignment.start: 'start', - IconAlignment.end: 'end', +const _$StacMaterialTapTargetSizeEnumMap = { + StacMaterialTapTargetSize.padded: 'padded', + StacMaterialTapTargetSize.shrinkWrap: 'shrinkWrap', }; const _$StacMouseCursorEnumMap = { @@ -138,8 +161,3 @@ const _$StacMouseCursorEnumMap = { StacMouseCursor.zoomIn: 'zoomIn', StacMouseCursor.zoomOut: 'zoomOut', }; - -const _$MaterialTapTargetSizeEnumMap = { - MaterialTapTargetSize.padded: 'padded', - MaterialTapTargetSize.shrinkWrap: 'shrinkWrap', -}; diff --git a/packages/stac_models/lib/theme/theme.dart b/packages/stac_models/lib/theme/theme.dart new file mode 100644 index 00000000..59490b94 --- /dev/null +++ b/packages/stac_models/lib/theme/theme.dart @@ -0,0 +1,3 @@ +library; + +export 'stac_button_style/stac_button_style.dart'; diff --git a/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart b/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart new file mode 100644 index 00000000..535e0abb --- /dev/null +++ b/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart @@ -0,0 +1,41 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; + +part 'stac_beveled_rectangle_border.g.dart'; + +/// A Stac model representing Flutter's [BeveledRectangleBorder]. +/// +/// A rectangular border with beveled corners, typically used with +/// [ShapeDecoration] to draw a box with a beveled rectangle shape. +/// +/// ```dart +/// StacBeveledRectangleBorder( +/// side: StacBorderSide(width: 1.0, color: StacColors.grey), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "beveledRectangleBorder", +/// "side": {"width": 1.0, "color": "#808080"} +/// } +/// ``` +@JsonSerializable() +class StacBeveledRectangleBorder extends StacShapeBorder { + /// Creates a [StacBeveledRectangleBorder] with the given properties. + const StacBeveledRectangleBorder({super.side, this.borderRadius}) + : super(type: StacShapeBorderType.beveledRectangleBorder); + + /// The radius for each corner. + final StacBorderRadius? borderRadius; + + /// Creates a [StacBeveledRectangleBorder] from JSON. + factory StacBeveledRectangleBorder.fromJson(Map json) => + _$StacBeveledRectangleBorderFromJson(json); + + /// Converts this beveled rectangle border to JSON. + @override + Map toJson() => _$StacBeveledRectangleBorderToJson(this); +} diff --git a/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart b/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart new file mode 100644 index 00000000..682b827e --- /dev/null +++ b/packages/stac_models/lib/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_beveled_rectangle_border.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacBeveledRectangleBorder _$StacBeveledRectangleBorderFromJson( + Map json, +) => StacBeveledRectangleBorder( + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), + borderRadius: json['borderRadius'] == null + ? null + : StacBorderRadius.fromJson(json['borderRadius']), +); + +Map _$StacBeveledRectangleBorderToJson( + StacBeveledRectangleBorder instance, +) => { + 'side': instance.side?.toJson(), + 'type': _$StacShapeBorderTypeEnumMap[instance.type]!, + 'borderRadius': instance.borderRadius?.toJson(), +}; + +const _$StacShapeBorderTypeEnumMap = { + StacShapeBorderType.circleBorder: 'circleBorder', + StacShapeBorderType.roundedRectangleBorder: 'roundedRectangleBorder', + StacShapeBorderType.continuousRectangleBorder: 'continuousRectangleBorder', + StacShapeBorderType.beveledRectangleBorder: 'beveledRectangleBorder', +}; diff --git a/packages/stac_models/lib/types/stac_border_radius/stac_border_radius.dart b/packages/stac_models/lib/types/stac_border_radius/stac_border_radius.dart index 23982cf2..3f9661cf 100644 --- a/packages/stac_models/lib/types/stac_border_radius/stac_border_radius.dart +++ b/packages/stac_models/lib/types/stac_border_radius/stac_border_radius.dart @@ -12,6 +12,15 @@ class StacBorderRadius implements StacElement { 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; diff --git a/packages/stac_models/lib/types/stac_circle_border/stac_circle_border.dart b/packages/stac_models/lib/types/stac_circle_border/stac_circle_border.dart new file mode 100644 index 00000000..2b6ac6ad --- /dev/null +++ b/packages/stac_models/lib/types/stac_circle_border/stac_circle_border.dart @@ -0,0 +1,40 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; + +part 'stac_circle_border.g.dart'; + +/// A Stac model representing Flutter's [CircleBorder]. +/// +/// A circular border, typically used with [ShapeDecoration] to draw +/// a box with a circular shape. +/// +/// ```dart +/// StacCircleBorder( +/// side: StacBorderSide(width: 1.0, color: StacColors.grey), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "circleBorder", +/// "side": {"width": 1.0, "color": "#808080"} +/// } +/// ``` +@JsonSerializable() +class StacCircleBorder extends StacShapeBorder { + /// Creates a [StacCircleBorder] with the given properties. + const StacCircleBorder({super.side, this.eccentricity}) + : super(type: StacShapeBorderType.circleBorder); + + /// The eccentricity of the circle. + final double? eccentricity; + + /// Creates a [StacCircleBorder] from JSON. + factory StacCircleBorder.fromJson(Map json) => + _$StacCircleBorderFromJson(json); + + /// Converts this circle border to JSON. + @override + Map toJson() => _$StacCircleBorderToJson(this); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.g.dart b/packages/stac_models/lib/types/stac_circle_border/stac_circle_border.g.dart similarity index 52% rename from packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.g.dart rename to packages/stac_models/lib/types/stac_circle_border/stac_circle_border.g.dart index 6e1b1195..af065d79 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_shape_border/stac_shape_border.g.dart +++ b/packages/stac_models/lib/types/stac_circle_border/stac_circle_border.g.dart @@ -1,21 +1,24 @@ // GENERATED CODE - DO NOT MODIFY BY HAND -part of 'stac_shape_border.dart'; +part of 'stac_circle_border.dart'; // ************************************************************************** // JsonSerializableGenerator // ************************************************************************** -_StacShapeBorder _$StacShapeBorderFromJson(Map json) => - _StacShapeBorder( - borderType: $enumDecode(_$StacShapeBorderTypeEnumMap, json['borderType']), - data: json['data'] as Map, +StacCircleBorder _$StacCircleBorderFromJson(Map json) => + StacCircleBorder( + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), + eccentricity: (json['eccentricity'] as num?)?.toDouble(), ); -Map _$StacShapeBorderToJson(_StacShapeBorder instance) => +Map _$StacCircleBorderToJson(StacCircleBorder instance) => { - 'borderType': _$StacShapeBorderTypeEnumMap[instance.borderType]!, - 'data': instance.data, + 'side': instance.side?.toJson(), + 'type': _$StacShapeBorderTypeEnumMap[instance.type]!, + 'eccentricity': instance.eccentricity, }; const _$StacShapeBorderTypeEnumMap = { diff --git a/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart b/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart new file mode 100644 index 00000000..ee6d1678 --- /dev/null +++ b/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart @@ -0,0 +1,41 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; + +part 'stac_continuous_rectangle_border.g.dart'; + +/// A Stac model representing Flutter's [ContinuousRectangleBorder]. +/// +/// A rectangular border with continuous rounded corners, typically used with +/// [ShapeDecoration] to draw a box with a continuous rectangle shape. +/// +/// ```dart +/// StacContinuousRectangleBorder( +/// side: StacBorderSide(width: 1.0, color: StacColors.grey), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "continuousRectangleBorder", +/// "side": {"width": 1.0, "color": "#808080"} +/// } +/// ``` +@JsonSerializable() +class StacContinuousRectangleBorder extends StacShapeBorder { + /// Creates a [StacContinuousRectangleBorder] with the given properties. + const StacContinuousRectangleBorder({super.side, this.borderRadius}) + : super(type: StacShapeBorderType.continuousRectangleBorder); + + /// The radius for each corner. + final StacBorderRadius? borderRadius; + + /// Creates a [StacContinuousRectangleBorder] from JSON. + factory StacContinuousRectangleBorder.fromJson(Map json) => + _$StacContinuousRectangleBorderFromJson(json); + + /// Converts this continuous rectangle border to JSON. + @override + Map toJson() => _$StacContinuousRectangleBorderToJson(this); +} diff --git a/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart b/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart new file mode 100644 index 00000000..2e4d5ca0 --- /dev/null +++ b/packages/stac_models/lib/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_continuous_rectangle_border.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacContinuousRectangleBorder _$StacContinuousRectangleBorderFromJson( + Map json, +) => StacContinuousRectangleBorder( + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), + borderRadius: json['borderRadius'] == null + ? null + : StacBorderRadius.fromJson(json['borderRadius']), +); + +Map _$StacContinuousRectangleBorderToJson( + StacContinuousRectangleBorder instance, +) => { + 'side': instance.side?.toJson(), + 'type': _$StacShapeBorderTypeEnumMap[instance.type]!, + 'borderRadius': instance.borderRadius?.toJson(), +}; + +const _$StacShapeBorderTypeEnumMap = { + StacShapeBorderType.circleBorder: 'circleBorder', + StacShapeBorderType.roundedRectangleBorder: 'roundedRectangleBorder', + StacShapeBorderType.continuousRectangleBorder: 'continuousRectangleBorder', + StacShapeBorderType.beveledRectangleBorder: 'beveledRectangleBorder', +}; diff --git a/packages/stac_models/lib/types/stac_duration/stac_duration.dart b/packages/stac_models/lib/types/stac_duration/stac_duration.dart new file mode 100644 index 00000000..f5a60683 --- /dev/null +++ b/packages/stac_models/lib/types/stac_duration/stac_duration.dart @@ -0,0 +1,67 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/stac_model.dart'; + +part 'stac_duration.g.dart'; + +/// A Stac model representing Flutter's [Duration] class. +/// +/// Represents a span of time with various time units. +/// +/// ```dart +/// StacDuration( +/// days: 1, +/// hours: 2, +/// minutes: 30, +/// seconds: 45, +/// milliseconds: 500, +/// ) +/// ``` +/// +/// ```json +/// { +/// "days": 1, +/// "hours": 2, +/// "minutes": 30, +/// "seconds": 45, +/// "milliseconds": 500, +/// "microseconds": 0 +/// } +/// ``` +@JsonSerializable() +class StacDuration extends StacElement { + /// Creates a [StacDuration] with the given time components. + const StacDuration({ + this.days, + this.hours, + this.minutes, + this.seconds, + this.milliseconds, + this.microseconds, + }); + + /// The number of days in this duration. + final int? days; + + /// The number of hours in this duration. + final int? hours; + + /// The number of minutes in this duration. + final int? minutes; + + /// The number of seconds in this duration. + final int? seconds; + + /// The number of milliseconds in this duration. + final int? milliseconds; + + /// The number of microseconds in this duration. + final int? microseconds; + + /// Creates a [StacDuration] from JSON. + factory StacDuration.fromJson(Map json) => + _$StacDurationFromJson(json); + + /// Converts this duration to JSON. + @override + Map toJson() => _$StacDurationToJson(this); +} diff --git a/packages/stac_models/lib/types/stac_duration/stac_duration.g.dart b/packages/stac_models/lib/types/stac_duration/stac_duration.g.dart new file mode 100644 index 00000000..64e693f4 --- /dev/null +++ b/packages/stac_models/lib/types/stac_duration/stac_duration.g.dart @@ -0,0 +1,26 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_duration.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacDuration _$StacDurationFromJson(Map json) => StacDuration( + days: (json['days'] as num?)?.toInt(), + hours: (json['hours'] as num?)?.toInt(), + minutes: (json['minutes'] as num?)?.toInt(), + seconds: (json['seconds'] as num?)?.toInt(), + milliseconds: (json['milliseconds'] as num?)?.toInt(), + microseconds: (json['microseconds'] as num?)?.toInt(), +); + +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_models/lib/types/stac_floating_action_button_type.dart b/packages/stac_models/lib/types/stac_floating_action_button_type.dart new file mode 100644 index 00000000..907e341a --- /dev/null +++ b/packages/stac_models/lib/types/stac_floating_action_button_type.dart @@ -0,0 +1,14 @@ +/// Enum representing the different types of floating action buttons. +enum StacFloatingActionButtonType { + /// Extended floating action button with icon and label. + extended, + + /// Large floating action button. + large, + + /// Medium floating action button. + medium, + + /// Small floating action button. + small, +} diff --git a/packages/stac_models/lib/types/stac_mouse_cursor.dart b/packages/stac_models/lib/types/stac_mouse_cursor.dart new file mode 100644 index 00000000..98f8bdf4 --- /dev/null +++ b/packages/stac_models/lib/types/stac_mouse_cursor.dart @@ -0,0 +1,38 @@ +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_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart b/packages/stac_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart new file mode 100644 index 00000000..5b953f9a --- /dev/null +++ b/packages/stac_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart @@ -0,0 +1,43 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/types/stac_border_radius/stac_border_radius.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_shape_border/stac_shape_border.dart'; + +part 'stac_rounded_rectangle_border.g.dart'; + +/// A Stac model representing Flutter's [RoundedRectangleBorder]. +/// +/// A rectangular border with rounded corners, typically used with +/// [ShapeDecoration] to draw a box with a rounded rectangle. +/// +/// ```dart +/// StacRoundedRectangleBorder( +/// borderRadius: StacBorderRadius.all(8.0), +/// side: StacBorderSide(width: 1.0, color: StacColors.grey), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "roundedRectangle", +/// "borderRadius": {"all": 8.0}, +/// "side": {"width": 1.0, "color": "#808080"} +/// } +/// ``` +@JsonSerializable() +class StacRoundedRectangleBorder extends StacShapeBorder { + /// Creates a [StacRoundedRectangleBorder] with the given properties. + const StacRoundedRectangleBorder({super.side, this.borderRadius}) + : super(type: StacShapeBorderType.roundedRectangleBorder); + + /// The border radius for the rounded corners. + final StacBorderRadius? borderRadius; + + /// Creates a [StacRoundedRectangleBorder] from JSON. + factory StacRoundedRectangleBorder.fromJson(Map json) => + _$StacRoundedRectangleBorderFromJson(json); + + /// Converts this rounded rectangle border to JSON. + @override + Map toJson() => _$StacRoundedRectangleBorderToJson(this); +} diff --git a/packages/stac_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart b/packages/stac_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart new file mode 100644 index 00000000..fac2ee56 --- /dev/null +++ b/packages/stac_models/lib/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.g.dart @@ -0,0 +1,33 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_rounded_rectangle_border.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacRoundedRectangleBorder _$StacRoundedRectangleBorderFromJson( + Map json, +) => StacRoundedRectangleBorder( + side: json['side'] == null + ? null + : StacBorderSide.fromJson(json['side'] as Map), + borderRadius: json['borderRadius'] == null + ? null + : StacBorderRadius.fromJson(json['borderRadius']), +); + +Map _$StacRoundedRectangleBorderToJson( + StacRoundedRectangleBorder instance, +) => { + 'side': instance.side?.toJson(), + 'type': _$StacShapeBorderTypeEnumMap[instance.type]!, + 'borderRadius': instance.borderRadius?.toJson(), +}; + +const _$StacShapeBorderTypeEnumMap = { + StacShapeBorderType.circleBorder: 'circleBorder', + StacShapeBorderType.roundedRectangleBorder: 'roundedRectangleBorder', + StacShapeBorderType.continuousRectangleBorder: 'continuousRectangleBorder', + StacShapeBorderType.beveledRectangleBorder: 'beveledRectangleBorder', +}; diff --git a/packages/stac_models/lib/types/stac_shape_border/stac_shape_border.dart b/packages/stac_models/lib/types/stac_shape_border/stac_shape_border.dart new file mode 100644 index 00000000..6da55d21 --- /dev/null +++ b/packages/stac_models/lib/types/stac_shape_border/stac_shape_border.dart @@ -0,0 +1,76 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/stac_model.dart'; +import 'package:stac_models/types/stac_beveled_rectangle_border/stac_beveled_rectangle_border.dart'; +import 'package:stac_models/types/stac_border_side/stac_border_side.dart'; +import 'package:stac_models/types/stac_circle_border/stac_circle_border.dart'; +import 'package:stac_models/types/stac_continuous_rectangle_border/stac_continuous_rectangle_border.dart'; +import 'package:stac_models/types/stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; + +enum StacShapeBorderType { + circleBorder, + roundedRectangleBorder, + continuousRectangleBorder, + beveledRectangleBorder, +} + +/// Abstract base class for Stac shape borders. +/// +/// Defines the common interface for all shape border implementations. +/// Each shape border type extends this class and provides its own +/// specific properties and behavior. +/// +/// ```dart +/// // Example usage with RoundedRectangleBorder +/// StacRoundedRectangleBorder( +/// borderRadius: StacBorderRadius.all(8.0), +/// side: StacBorderSide(width: 1.0, color: StacColors.grey), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "roundedRectangle", +/// "borderRadius": {"all": 8.0}, +/// "side": {"width": 1.0, "color": "#808080"} +/// } +/// ``` +abstract class StacShapeBorder implements StacElement { + /// Creates a [StacShapeBorder] with the given properties. + const StacShapeBorder({this.side, required this.type}); + + /// The border side properties. + final StacBorderSide? side; + + /// The type identifier for this shape border. + /// Must be implemented by subclasses. + @JsonKey(includeToJson: true) + final StacShapeBorderType type; + + /// Creates a [StacShapeBorder] from JSON. + /// This factory method delegates to the appropriate subclass + /// based on the "type" field in the JSON. + factory StacShapeBorder.fromJson(Map json) { + final typeString = json['type']; + + // Convert string to enum + late StacShapeBorderType type; + for (final enumValue in StacShapeBorderType.values) { + if (enumValue.name == typeString) { + type = enumValue; + break; + } + } + + switch (type) { + case StacShapeBorderType.roundedRectangleBorder: + return StacRoundedRectangleBorder.fromJson(json); + case StacShapeBorderType.circleBorder: + return StacCircleBorder.fromJson(json); + + case StacShapeBorderType.continuousRectangleBorder: + return StacContinuousRectangleBorder.fromJson(json); + case StacShapeBorderType.beveledRectangleBorder: + return StacBeveledRectangleBorder.fromJson(json); + } + } +} diff --git a/packages/stac_models/lib/types/stac_size/stac_size.dart b/packages/stac_models/lib/types/stac_size/stac_size.dart new file mode 100644 index 00000000..1fa08637 --- /dev/null +++ b/packages/stac_models/lib/types/stac_size/stac_size.dart @@ -0,0 +1,18 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/stac_model.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_models/lib/types/stac_size/stac_size.g.dart b/packages/stac_models/lib/types/stac_size/stac_size.g.dart new file mode 100644 index 00000000..85c92e43 --- /dev/null +++ b/packages/stac_models/lib/types/stac_size/stac_size.g.dart @@ -0,0 +1,17 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_size.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacSize _$StacSizeFromJson(Map json) => StacSize( + (json['width'] as num).toDouble(), + (json['height'] as num).toDouble(), +); + +Map _$StacSizeToJson(StacSize instance) => { + 'width': instance.width, + 'height': instance.height, +}; diff --git a/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.dart b/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.dart new file mode 100644 index 00000000..41d5596e --- /dev/null +++ b/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.dart @@ -0,0 +1,47 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/double_converter.dart'; +import 'package:stac_models/core/stac_model.dart'; + +part 'stac_visual_density.g.dart'; + +/// A Stac model representing Flutter's [VisualDensity] class. +/// +/// Defines the visual density of a widget, which affects the size of +/// interactive elements like buttons and form fields. +/// +/// ```dart +/// StacVisualDensity( +/// horizontal: -1.0, +/// vertical: -1.0, +/// ) +/// ``` +/// +/// ```json +/// { +/// "horizontal": -1.0, +/// "vertical": -1.0 +/// } +/// ``` +@JsonSerializable() +class StacVisualDensity extends StacElement { + /// Creates a [StacVisualDensity] with the given density values. + const StacVisualDensity({this.horizontal, this.vertical}); + + /// The horizontal density adjustment. + /// Negative values make the widget more compact horizontally. + @DoubleConverter() + final double? horizontal; + + /// The vertical density adjustment. + /// Negative values make the widget more compact vertically. + @DoubleConverter() + final double? vertical; + + /// Creates a [StacVisualDensity] from JSON. + factory StacVisualDensity.fromJson(Map json) => + _$StacVisualDensityFromJson(json); + + /// Converts this visual density to JSON. + @override + Map toJson() => _$StacVisualDensityToJson(this); +} diff --git a/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.g.dart b/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.g.dart new file mode 100644 index 00000000..34308daf --- /dev/null +++ b/packages/stac_models/lib/types/stac_visual_density/stac_visual_density.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_visual_density.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacVisualDensity _$StacVisualDensityFromJson(Map json) => + StacVisualDensity( + horizontal: const DoubleConverter().fromJson(json['horizontal']), + vertical: const DoubleConverter().fromJson(json['vertical']), + ); + +Map _$StacVisualDensityToJson(StacVisualDensity instance) => + { + 'horizontal': const DoubleConverter().toJson(instance.horizontal), + 'vertical': const DoubleConverter().toJson(instance.vertical), + }; diff --git a/packages/stac_models/lib/types/types.dart b/packages/stac_models/lib/types/types.dart index 2ebb9e9e..dcbecc68 100644 --- a/packages/stac_models/lib/types/types.dart +++ b/packages/stac_models/lib/types/types.dart @@ -1,5 +1,12 @@ 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_mouse_cursor.dart'; +export 'stac_rounded_rectangle_border/stac_rounded_rectangle_border.dart'; +export 'stac_size/stac_size.dart'; +export 'stac_visual_density/stac_visual_density.dart'; diff --git a/packages/stac_models/lib/widgets/container/stac_container.dart b/packages/stac_models/lib/widgets/container/stac_container.dart index 208e795d..aae74f8c 100644 --- a/packages/stac_models/lib/widgets/container/stac_container.dart +++ b/packages/stac_models/lib/widgets/container/stac_container.dart @@ -11,17 +11,25 @@ import 'package:stac_models/types/stac_clip.dart'; part 'stac_container.g.dart'; -/// A STAC model representing Flutter's [Container] widget. +/// A Stac model representing Flutter's [Container] widget. /// /// Combines styling, positioning, and sizing properties for child widgets. /// Supports padding, margins, colors, decorations, sizing, and alignment. /// +/// ```dart +/// StacContainer( +/// padding: StacEdgeInsets.all(16.0), +/// color: StacColors.red, +/// child: StacText(data: 'Hello'), +/// ) +/// ``` +/// /// ```json /// { /// "type": "container", /// "padding": {"all": 16.0}, /// "color": "#FF0000", -/// "child": {"type": "text", "text": "Hello"} +/// "child": {"type": "text", "data": "Hello"} /// } /// ``` @JsonSerializable() diff --git a/packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.dart b/packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.dart new file mode 100644 index 00000000..3514df7c --- /dev/null +++ b/packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.dart @@ -0,0 +1,82 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/core/stac_model.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_clip.dart'; + +part 'stac_elevated_button.g.dart'; + +/// A Stac model representing Flutter's [ElevatedButton] widget. +/// +/// Represents a Material Design elevated button that responds to touches +/// by elevating and filling with color. +/// +/// ```dart +/// StacElevatedButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// child: StacText(data: 'Press me'), +/// style: StacButtonStyle(elevation: 4.0), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "elevatedButton", +/// "child": {"type": "text", "data": "Press me"}, +/// "onPressed": {"action": "navigate", "route": "/next"} +/// } +/// ``` +@JsonSerializable() +class StacElevatedButton extends StacWidget { + /// Creates a [StacElevatedButton] with the given properties. + const StacElevatedButton({ + this.onPressed, + this.onLongPress, + this.onHover, + this.onFocusChange, + this.style, + this.autofocus, + this.clipBehavior, + this.child, + }); + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// Called when the button is long-pressed. + final Map? onLongPress; + + /// Called when a pointer enters or exits the button response area. + final Map? onHover; + + /// Called when the focus changes. + final Map? onFocusChange; + + /// Customizes this button's appearance. + final StacButtonStyle? style; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// How to clip the button's content. + final StacClip? clipBehavior; + + /// The widget below this widget in the tree. + /// Typically a [Text] widget. + @StacWidgetConverter() + final StacWidget? child; + + /// Widget type identifier. + @override + String get type => 'elevatedButton'; + + /// Creates a [StacElevatedButton] from JSON. + factory StacElevatedButton.fromJson(Map json) => + _$StacElevatedButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacElevatedButtonToJson(this); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.g.dart b/packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.g.dart similarity index 51% rename from packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.g.dart rename to packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.g.dart index 13a773be..c13b52e8 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_elevated_button/stac_elevated_button.g.dart +++ b/packages/stac_models/lib/widgets/elevated_button/stac_elevated_button.g.dart @@ -6,8 +6,8 @@ part of 'stac_elevated_button.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacElevatedButton _$StacElevatedButtonFromJson(Map json) => - _StacElevatedButton( +StacElevatedButton _$StacElevatedButtonFromJson(Map json) => + StacElevatedButton( onPressed: json['onPressed'] as Map?, onLongPress: json['onLongPress'] as Map?, onHover: json['onHover'] as Map?, @@ -15,27 +15,32 @@ _StacElevatedButton _$StacElevatedButtonFromJson(Map json) => style: json['style'] == null ? null : StacButtonStyle.fromJson(json['style'] as Map), - autofocus: json['autofocus'] as bool? ?? false, - clipBehavior: - $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, - child: json['child'] as Map, + autofocus: json['autofocus'] as bool?, + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), + child: const StacWidgetConverter().fromJson( + json['child'] as Map?, + ), ); -Map _$StacElevatedButtonToJson(_StacElevatedButton instance) => +Map _$StacElevatedButtonToJson(StacElevatedButton instance) => { 'onPressed': instance.onPressed, 'onLongPress': instance.onLongPress, 'onHover': instance.onHover, 'onFocusChange': instance.onFocusChange, - 'style': instance.style, + 'style': instance.style?.toJson(), 'autofocus': instance.autofocus, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, - 'child': instance.child, + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], + 'child': const StacWidgetConverter().toJson(instance.child), + 'type': instance.type, }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_models/lib/widgets/filled_button/stac_filled_button.dart b/packages/stac_models/lib/widgets/filled_button/stac_filled_button.dart new file mode 100644 index 00000000..9d537261 --- /dev/null +++ b/packages/stac_models/lib/widgets/filled_button/stac_filled_button.dart @@ -0,0 +1,82 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/core/stac_model.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_clip.dart'; + +part 'stac_filled_button.g.dart'; + +/// A Stac model representing Flutter's [FilledButton] widget. +/// +/// Represents a Material Design filled button that responds to touches +/// by filling with color. +/// +/// ```dart +/// StacFilledButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// child: StacText(data: 'Press me'), +/// style: StacButtonStyle(elevation: 4.0), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "filledButton", +/// "child": {"type": "text", "data": "Press me"}, +/// "onPressed": {"action": "navigate", "route": "/next"} +/// } +/// ``` +@JsonSerializable() +class StacFilledButton extends StacWidget { + /// Creates a [StacFilledButton] with the given properties. + const StacFilledButton({ + this.onPressed, + this.onLongPress, + this.onHover, + this.onFocusChange, + this.style, + this.autofocus, + this.clipBehavior, + this.child, + }); + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// Called when the button is long-pressed. + final Map? onLongPress; + + /// Called when a pointer enters or exits the button response area. + final Map? onHover; + + /// Called when the focus changes. + final Map? onFocusChange; + + /// Customizes this button's appearance. + final StacButtonStyle? style; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// How to clip the button's content. + final StacClip? clipBehavior; + + /// The widget below this widget in the tree. + /// Typically a [Text] widget. + @StacWidgetConverter() + final StacWidget? child; + + /// Widget type identifier. + @override + String get type => 'filledButton'; + + /// Creates a [StacFilledButton] from JSON. + factory StacFilledButton.fromJson(Map json) => + _$StacFilledButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacFilledButtonToJson(this); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.g.dart b/packages/stac_models/lib/widgets/filled_button/stac_filled_button.g.dart similarity index 52% rename from packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.g.dart rename to packages/stac_models/lib/widgets/filled_button/stac_filled_button.g.dart index d32a66c8..46bdf737 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_filled_button/stac_filled_button.g.dart +++ b/packages/stac_models/lib/widgets/filled_button/stac_filled_button.g.dart @@ -6,8 +6,8 @@ part of 'stac_filled_button.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacFilledButton _$StacFilledButtonFromJson(Map json) => - _StacFilledButton( +StacFilledButton _$StacFilledButtonFromJson(Map json) => + StacFilledButton( onPressed: json['onPressed'] as Map?, onLongPress: json['onLongPress'] as Map?, onHover: json['onHover'] as Map?, @@ -15,27 +15,32 @@ _StacFilledButton _$StacFilledButtonFromJson(Map json) => style: json['style'] == null ? null : StacButtonStyle.fromJson(json['style'] as Map), - autofocus: json['autofocus'] as bool? ?? false, - clipBehavior: - $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, - child: json['child'] as Map?, + autofocus: json['autofocus'] as bool?, + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), + child: const StacWidgetConverter().fromJson( + json['child'] as Map?, + ), ); -Map _$StacFilledButtonToJson(_StacFilledButton instance) => +Map _$StacFilledButtonToJson(StacFilledButton instance) => { 'onPressed': instance.onPressed, 'onLongPress': instance.onLongPress, 'onHover': instance.onHover, 'onFocusChange': instance.onFocusChange, - 'style': instance.style, + 'style': instance.style?.toJson(), 'autofocus': instance.autofocus, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, - 'child': instance.child, + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], + 'child': const StacWidgetConverter().toJson(instance.child), + 'type': instance.type, }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.dart b/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.dart new file mode 100644 index 00000000..6da28c95 --- /dev/null +++ b/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.dart @@ -0,0 +1,135 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/core/stac_model.dart'; +import 'package:stac_models/painting/stac_text_style/stac_text_style.dart'; +import 'package:stac_models/types/stac_floating_action_button_type.dart'; + +part 'stac_floating_action_button.g.dart'; + +/// A Stac model representing Flutter's [FloatingActionButton] widget. +/// +/// Represents a Material Design floating action button that floats above +/// the content and responds to touches. +/// +/// ```dart +/// StacFloatingActionButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// child: StacIcon(icon: Icons.add), +/// backgroundColor: '#FF5722', +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "floatingActionButton", +/// "child": {"type": "icon", "icon": "add"}, +/// "onPressed": {"action": "navigate", "route": "/next"}, +/// "backgroundColor": "#FF5722" +/// } +/// ``` +@JsonSerializable() +class StacFloatingActionButton extends StacWidget { + /// Creates a [StacFloatingActionButton] with the given properties. + const StacFloatingActionButton({ + this.onPressed, + this.textStyle, + this.buttonType = StacFloatingActionButtonType.small, + this.autofocus, + this.icon, + this.backgroundColor, + this.foregroundColor, + this.focusColor, + this.hoverColor, + this.splashColor, + this.extendedTextStyle, + this.elevation, + this.focusElevation, + this.hoverElevation, + this.disabledElevation, + this.highlightElevation, + this.extendedIconLabelSpacing, + this.enableFeedback, + this.tooltip, + this.heroTag, + this.child, + }); + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// The text style for the button's text. + final StacTextStyle? textStyle; + + /// The type of floating action button. + final StacFloatingActionButtonType buttonType; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// The icon to display in the button. + final Map? icon; + + /// The background color of the button. + final String? backgroundColor; + + /// The foreground color of the button. + final String? foregroundColor; + + /// The focus color of the button. + final String? focusColor; + + /// The hover color of the button. + final String? hoverColor; + + /// The splash color of the button. + final String? splashColor; + + /// The text style for extended floating action button text. + final StacTextStyle? extendedTextStyle; + + /// The elevation of the button. + final double? elevation; + + /// The elevation when the button is focused. + final double? focusElevation; + + /// The elevation when the button is hovered. + final double? hoverElevation; + + /// The elevation when the button is disabled. + final double? disabledElevation; + + /// The elevation when the button is highlighted. + final double? highlightElevation; + + /// The spacing between icon and label in extended floating action button. + final double? extendedIconLabelSpacing; + + /// Whether to enable haptic feedback. + final bool? enableFeedback; + + /// The tooltip text for the button. + final String? tooltip; + + /// The hero tag for the button. + final Object? heroTag; + + /// The widget below this widget in the tree. + /// Typically an [Icon] widget. + @StacWidgetConverter() + final StacWidget? child; + + /// Widget type identifier. + @override + String get type => 'floatingActionButton'; + + /// Creates a [StacFloatingActionButton] from JSON. + factory StacFloatingActionButton.fromJson(Map json) => + _$StacFloatingActionButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacFloatingActionButtonToJson(this); +} diff --git a/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.g.dart b/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.g.dart new file mode 100644 index 00000000..ed94b1e0 --- /dev/null +++ b/packages/stac_models/lib/widgets/floating_action_button/stac_floating_action_button.g.dart @@ -0,0 +1,81 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_floating_action_button.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacFloatingActionButton _$StacFloatingActionButtonFromJson( + Map json, +) => StacFloatingActionButton( + onPressed: json['onPressed'] as Map?, + textStyle: json['textStyle'] == null + ? null + : StacTextStyle.fromJson(json['textStyle'] as Map), + buttonType: + $enumDecodeNullable( + _$StacFloatingActionButtonTypeEnumMap, + json['buttonType'], + ) ?? + StacFloatingActionButtonType.small, + autofocus: json['autofocus'] as bool?, + icon: json['icon'] as Map?, + backgroundColor: json['backgroundColor'] as String?, + foregroundColor: json['foregroundColor'] as String?, + focusColor: json['focusColor'] as String?, + hoverColor: json['hoverColor'] as String?, + splashColor: json['splashColor'] as String?, + extendedTextStyle: json['extendedTextStyle'] == null + ? null + : StacTextStyle.fromJson( + json['extendedTextStyle'] as Map, + ), + elevation: (json['elevation'] as num?)?.toDouble(), + focusElevation: (json['focusElevation'] as num?)?.toDouble(), + hoverElevation: (json['hoverElevation'] as num?)?.toDouble(), + disabledElevation: (json['disabledElevation'] as num?)?.toDouble(), + highlightElevation: (json['highlightElevation'] as num?)?.toDouble(), + extendedIconLabelSpacing: (json['extendedIconLabelSpacing'] as num?) + ?.toDouble(), + enableFeedback: json['enableFeedback'] as bool?, + tooltip: json['tooltip'] as String?, + heroTag: json['heroTag'], + child: const StacWidgetConverter().fromJson( + json['child'] as Map?, + ), +); + +Map _$StacFloatingActionButtonToJson( + StacFloatingActionButton instance, +) => { + 'onPressed': instance.onPressed, + 'textStyle': instance.textStyle?.toJson(), + 'buttonType': _$StacFloatingActionButtonTypeEnumMap[instance.buttonType]!, + 'autofocus': instance.autofocus, + 'icon': instance.icon, + 'backgroundColor': instance.backgroundColor, + 'foregroundColor': instance.foregroundColor, + 'focusColor': instance.focusColor, + 'hoverColor': instance.hoverColor, + 'splashColor': instance.splashColor, + 'extendedTextStyle': instance.extendedTextStyle?.toJson(), + 'elevation': instance.elevation, + 'focusElevation': instance.focusElevation, + 'hoverElevation': instance.hoverElevation, + 'disabledElevation': instance.disabledElevation, + 'highlightElevation': instance.highlightElevation, + 'extendedIconLabelSpacing': instance.extendedIconLabelSpacing, + 'enableFeedback': instance.enableFeedback, + 'tooltip': instance.tooltip, + 'heroTag': instance.heroTag, + 'child': const StacWidgetConverter().toJson(instance.child), + 'type': instance.type, +}; + +const _$StacFloatingActionButtonTypeEnumMap = { + StacFloatingActionButtonType.extended: 'extended', + StacFloatingActionButtonType.large: 'large', + StacFloatingActionButtonType.medium: 'medium', + StacFloatingActionButtonType.small: 'small', +}; diff --git a/packages/stac_models/lib/widgets/icon_button/stac_icon_button.dart b/packages/stac_models/lib/widgets/icon_button/stac_icon_button.dart new file mode 100644 index 00000000..81a454bc --- /dev/null +++ b/packages/stac_models/lib/widgets/icon_button/stac_icon_button.dart @@ -0,0 +1,144 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_alignment.dart'; +import 'package:stac_models/types/stac_box_constraints/stac_box_constraints.dart'; + +part 'stac_icon_button.g.dart'; + +/// A Stac model representing Flutter's [IconButton] widget. +/// +/// Represents a Material Design icon button that responds to touches +/// by filling with color. +/// +/// ```dart +/// StacIconButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// icon: StacIcon(icon: Icons.add), +/// color: '#FF5722', +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "iconButton", +/// "icon": {"type": "icon", "icon": "add"}, +/// "onPressed": {"action": "navigate", "route": "/next"}, +/// "color": "#FF5722" +/// } +/// ``` +@JsonSerializable() +class StacIconButton extends StacWidget { + /// Creates a [StacIconButton] with the given properties. + const StacIconButton({ + this.iconSize, + this.visualDensity, + this.padding, + this.alignment, + this.splashRadius, + this.color, + this.focusColor, + this.hoverColor, + this.highlightColor, + this.splashColor, + this.disabledColor, + this.onPressed, + this.onHover, + this.onLongPress, + this.mouseCursor, + this.autofocus, + this.tooltip, + this.enableFeedback, + this.constraints, + this.style, + this.isSelected, + this.selectedIcon, + this.icon, + }); + + /// The size of the icon inside the button. + final double? iconSize; + + /// The visual density of the button. + final StacVisualDensity? visualDensity; + + /// The padding around the button. + final StacEdgeInsets? padding; + + /// The alignment of the icon within the button. + final StacAlignment? alignment; + + /// The radius of the splash effect. + final double? splashRadius; + + /// The color of the icon. + final String? color; + + /// The color when the button is focused. + final String? focusColor; + + /// The color when the button is hovered. + final String? hoverColor; + + /// The color when the button is highlighted. + final String? highlightColor; + + /// The color of the splash effect. + final String? splashColor; + + /// The color when the button is disabled. + final String? disabledColor; + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// Called when the button is hovered. + final Map? onHover; + + /// Called when the button is long pressed. + final Map? onLongPress; + + /// The mouse cursor for the button. + final StacMouseCursor? mouseCursor; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// The tooltip text for the button. + final String? tooltip; + + /// Whether to enable haptic feedback. + final bool? enableFeedback; + + /// The constraints for the button. + final StacBoxConstraints? constraints; + + /// Customizes this button's appearance. + final StacButtonStyle? style; + + /// Whether the button is selected. + final bool? isSelected; + + /// The icon to display when the button is selected. + @StacWidgetConverter() + final StacWidget? selectedIcon; + + /// The icon to display in the button. + @StacWidgetConverter() + final StacWidget? icon; + + /// Widget type identifier. + @override + String get type => 'iconButton'; + + /// Creates a [StacIconButton] from JSON. + factory StacIconButton.fromJson(Map json) => + _$StacIconButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacIconButtonToJson(this); +} diff --git a/packages/stac_models/lib/widgets/icon_button/stac_icon_button.g.dart b/packages/stac_models/lib/widgets/icon_button/stac_icon_button.g.dart new file mode 100644 index 00000000..f034b0d3 --- /dev/null +++ b/packages/stac_models/lib/widgets/icon_button/stac_icon_button.g.dart @@ -0,0 +1,132 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'stac_icon_button.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +StacIconButton _$StacIconButtonFromJson(Map json) => + StacIconButton( + iconSize: (json['iconSize'] as num?)?.toDouble(), + visualDensity: json['visualDensity'] == null + ? null + : StacVisualDensity.fromJson( + json['visualDensity'] as Map, + ), + padding: json['padding'] == null + ? null + : StacEdgeInsets.fromJson(json['padding']), + alignment: $enumDecodeNullable(_$StacAlignmentEnumMap, json['alignment']), + splashRadius: (json['splashRadius'] as num?)?.toDouble(), + color: json['color'] as String?, + focusColor: json['focusColor'] as String?, + hoverColor: json['hoverColor'] as String?, + highlightColor: json['highlightColor'] as String?, + splashColor: json['splashColor'] as String?, + disabledColor: json['disabledColor'] as String?, + onPressed: json['onPressed'] as Map?, + onHover: json['onHover'] as Map?, + onLongPress: json['onLongPress'] as Map?, + mouseCursor: $enumDecodeNullable( + _$StacMouseCursorEnumMap, + json['mouseCursor'], + ), + autofocus: json['autofocus'] as bool?, + tooltip: json['tooltip'] as String?, + enableFeedback: json['enableFeedback'] as bool?, + constraints: json['constraints'] == null + ? null + : StacBoxConstraints.fromJson( + json['constraints'] as Map, + ), + style: json['style'] == null + ? null + : StacButtonStyle.fromJson(json['style'] as Map), + isSelected: json['isSelected'] as bool?, + selectedIcon: const StacWidgetConverter().fromJson( + json['selectedIcon'] as Map?, + ), + icon: const StacWidgetConverter().fromJson( + json['icon'] as Map?, + ), + ); + +Map _$StacIconButtonToJson(StacIconButton instance) => + { + 'iconSize': instance.iconSize, + 'visualDensity': instance.visualDensity?.toJson(), + 'padding': instance.padding?.toJson(), + 'alignment': _$StacAlignmentEnumMap[instance.alignment], + 'splashRadius': instance.splashRadius, + 'color': instance.color, + 'focusColor': instance.focusColor, + 'hoverColor': instance.hoverColor, + 'highlightColor': instance.highlightColor, + 'splashColor': instance.splashColor, + 'disabledColor': instance.disabledColor, + 'onPressed': instance.onPressed, + 'onHover': instance.onHover, + 'onLongPress': instance.onLongPress, + 'mouseCursor': _$StacMouseCursorEnumMap[instance.mouseCursor], + 'autofocus': instance.autofocus, + 'tooltip': instance.tooltip, + 'enableFeedback': instance.enableFeedback, + 'constraints': instance.constraints?.toJson(), + 'style': instance.style?.toJson(), + 'isSelected': instance.isSelected, + 'selectedIcon': const StacWidgetConverter().toJson(instance.selectedIcon), + 'icon': const StacWidgetConverter().toJson(instance.icon), + 'type': instance.type, + }; + +const _$StacAlignmentEnumMap = { + StacAlignment.topLeft: 'topLeft', + StacAlignment.topCenter: 'topCenter', + StacAlignment.topRight: 'topRight', + StacAlignment.centerLeft: 'centerLeft', + StacAlignment.center: 'center', + StacAlignment.centerRight: 'centerRight', + StacAlignment.bottomLeft: 'bottomLeft', + StacAlignment.bottomCenter: 'bottomCenter', + StacAlignment.bottomRight: 'bottomRight', +}; + +const _$StacMouseCursorEnumMap = { + StacMouseCursor.none: 'none', + StacMouseCursor.basic: 'basic', + StacMouseCursor.click: 'click', + StacMouseCursor.forbidden: 'forbidden', + StacMouseCursor.wait: 'wait', + StacMouseCursor.progress: 'progress', + StacMouseCursor.contextMenu: 'contextMenu', + StacMouseCursor.help: 'help', + StacMouseCursor.text: 'text', + StacMouseCursor.verticalText: 'verticalText', + StacMouseCursor.cell: 'cell', + StacMouseCursor.precise: 'precise', + StacMouseCursor.move: 'move', + StacMouseCursor.grab: 'grab', + StacMouseCursor.grabbing: 'grabbing', + StacMouseCursor.noDrop: 'noDrop', + StacMouseCursor.alias: 'alias', + StacMouseCursor.copy: 'copy', + StacMouseCursor.disappearing: 'disappearing', + StacMouseCursor.allScroll: 'allScroll', + StacMouseCursor.resizeLeftRight: 'resizeLeftRight', + StacMouseCursor.resizeUpDown: 'resizeUpDown', + StacMouseCursor.resizeUpLeftDownRight: 'resizeUpLeftDownRight', + StacMouseCursor.resizeUpRightDownLeft: 'resizeUpRightDownLeft', + StacMouseCursor.resizeUp: 'resizeUp', + StacMouseCursor.resizeDown: 'resizeDown', + StacMouseCursor.resizeLeft: 'resizeLeft', + StacMouseCursor.resizeRight: 'resizeRight', + StacMouseCursor.resizeUpLeft: 'resizeUpLeft', + StacMouseCursor.resizeUpRight: 'resizeUpRight', + StacMouseCursor.resizeDownLeft: 'resizeDownLeft', + StacMouseCursor.resizeDownRight: 'resizeDownRight', + StacMouseCursor.resizeColumn: 'resizeColumn', + StacMouseCursor.resizeRow: 'resizeRow', + StacMouseCursor.zoomIn: 'zoomIn', + StacMouseCursor.zoomOut: 'zoomOut', +}; diff --git a/packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.dart b/packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.dart new file mode 100644 index 00000000..04db1407 --- /dev/null +++ b/packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.dart @@ -0,0 +1,82 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_clip.dart'; + +part 'stac_outlined_button.g.dart'; + +/// A Stac model representing Flutter's [OutlinedButton] widget. +/// +/// Represents a Material Design outlined button that responds to touches +/// by filling with color. +/// +/// ```dart +/// StacOutlinedButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// child: StacText(data: 'Press me'), +/// style: StacButtonStyle(elevation: 4.0), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "outlinedButton", +/// "child": {"type": "text", "data": "Press me"}, +/// "onPressed": {"action": "navigate", "route": "/next"} +/// } +/// ``` +@JsonSerializable() +class StacOutlinedButton extends StacWidget { + /// Creates a [StacOutlinedButton] with the given properties. + const StacOutlinedButton({ + this.onPressed, + this.onLongPress, + this.onHover, + this.onFocusChange, + this.style, + this.autofocus, + this.clipBehavior, + this.child, + }); + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// Called when the button is long-pressed. + final Map? onLongPress; + + /// Called when a pointer enters or exits the button response area. + final Map? onHover; + + /// Called when the focus changes. + final Map? onFocusChange; + + /// Customizes this button's appearance. + final StacButtonStyle? style; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// How to clip the button's content. + final StacClip? clipBehavior; + + /// The widget below this widget in the tree. + /// Typically a [Text] widget. + @StacWidgetConverter() + final StacWidget? child; + + /// Widget type identifier. + @override + String get type => 'outlinedButton'; + + /// Creates a [StacOutlinedButton] from JSON. + factory StacOutlinedButton.fromJson(Map json) => + _$StacOutlinedButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacOutlinedButtonToJson(this); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.g.dart b/packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.g.dart similarity index 51% rename from packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.g.dart rename to packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.g.dart index daa3b02a..193e8c2f 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_outlined_button/stac_outlined_button.g.dart +++ b/packages/stac_models/lib/widgets/outlined_button/stac_outlined_button.g.dart @@ -6,8 +6,8 @@ part of 'stac_outlined_button.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacOutlinedButton _$StacOutlinedButtonFromJson(Map json) => - _StacOutlinedButton( +StacOutlinedButton _$StacOutlinedButtonFromJson(Map json) => + StacOutlinedButton( onPressed: json['onPressed'] as Map?, onLongPress: json['onLongPress'] as Map?, onHover: json['onHover'] as Map?, @@ -15,27 +15,32 @@ _StacOutlinedButton _$StacOutlinedButtonFromJson(Map json) => style: json['style'] == null ? null : StacButtonStyle.fromJson(json['style'] as Map), - autofocus: json['autofocus'] ?? false, - clipBehavior: - $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, - child: json['child'] as Map, + autofocus: json['autofocus'] as bool?, + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), + child: const StacWidgetConverter().fromJson( + json['child'] as Map?, + ), ); -Map _$StacOutlinedButtonToJson(_StacOutlinedButton instance) => +Map _$StacOutlinedButtonToJson(StacOutlinedButton instance) => { 'onPressed': instance.onPressed, 'onLongPress': instance.onLongPress, 'onHover': instance.onHover, 'onFocusChange': instance.onFocusChange, - 'style': instance.style, + 'style': instance.style?.toJson(), 'autofocus': instance.autofocus, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, - 'child': instance.child, + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], + 'child': const StacWidgetConverter().toJson(instance.child), + 'type': instance.type, }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_models/lib/widgets/text_button/stac_text_button.dart b/packages/stac_models/lib/widgets/text_button/stac_text_button.dart new file mode 100644 index 00000000..c9df5d7a --- /dev/null +++ b/packages/stac_models/lib/widgets/text_button/stac_text_button.dart @@ -0,0 +1,86 @@ +import 'package:json_annotation/json_annotation.dart'; +import 'package:stac_models/core/converters/widget_converter.dart'; +import 'package:stac_models/stac_models.dart'; +import 'package:stac_models/theme/stac_button_style/stac_button_style.dart'; +import 'package:stac_models/types/stac_clip.dart'; + +part 'stac_text_button.g.dart'; + +/// A Stac model representing Flutter's [TextButton] widget. +/// +/// Represents a Material Design text button that responds to touches +/// by filling with color. +/// +/// ```dart +/// StacTextButton( +/// onPressed: {'action': 'navigate', 'route': '/next'}, +/// child: StacText(data: 'Press me'), +/// style: StacButtonStyle(elevation: 4.0), +/// ) +/// ``` +/// +/// ```json +/// { +/// "type": "textButton", +/// "child": {"type": "text", "data": "Press me"}, +/// "onPressed": {"action": "navigate", "route": "/next"} +/// } +/// ``` +@JsonSerializable() +class StacTextButton extends StacWidget { + /// Creates a [StacTextButton] with the given properties. + const StacTextButton({ + this.onPressed, + this.onLongPress, + this.onHover, + this.onFocusChange, + this.style, + this.autofocus, + this.clipBehavior, + this.isSemanticButton, + this.child, + }); + + /// Called when the button is tapped or otherwise activated. + /// If null, the button will be disabled. + final Map? onPressed; + + /// Called when the button is long-pressed. + final Map? onLongPress; + + /// Called when a pointer enters or exits the button response area. + final Map? onHover; + + /// Called when the focus changes. + final Map? onFocusChange; + + /// Customizes this button's appearance. + final StacButtonStyle? style; + + /// True if this widget will be selected as the initial focus when no other + /// node in its scope is currently focused. + final bool? autofocus; + + /// How to clip the button's content. + final StacClip? clipBehavior; + + /// Whether this button is a semantic button. + final bool? isSemanticButton; + + /// The widget below this widget in the tree. + /// Typically a [Text] widget. + @StacWidgetConverter() + final StacWidget? child; + + /// Widget type identifier. + @override + String get type => 'textButton'; + + /// Creates a [StacTextButton] from JSON. + factory StacTextButton.fromJson(Map json) => + _$StacTextButtonFromJson(json); + + /// Converts this button to JSON. + @override + Map toJson() => _$StacTextButtonToJson(this); +} diff --git a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.g.dart b/packages/stac_models/lib/widgets/text_button/stac_text_button.g.dart similarity index 52% rename from packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.g.dart rename to packages/stac_models/lib/widgets/text_button/stac_text_button.g.dart index 8faaa5ed..62948314 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_text_button/stac_text_button.g.dart +++ b/packages/stac_models/lib/widgets/text_button/stac_text_button.g.dart @@ -6,8 +6,8 @@ part of 'stac_text_button.dart'; // JsonSerializableGenerator // ************************************************************************** -_StacTextButton _$StacTextButtonFromJson(Map json) => - _StacTextButton( +StacTextButton _$StacTextButtonFromJson(Map json) => + StacTextButton( onPressed: json['onPressed'] as Map?, onLongPress: json['onLongPress'] as Map?, onHover: json['onHover'] as Map?, @@ -15,29 +15,34 @@ _StacTextButton _$StacTextButtonFromJson(Map json) => style: json['style'] == null ? null : StacButtonStyle.fromJson(json['style'] as Map), - autofocus: json['autofocus'] ?? false, - clipBehavior: - $enumDecodeNullable(_$ClipEnumMap, json['clipBehavior']) ?? Clip.none, - isSemanticButton: json['isSemanticButton'] as bool? ?? true, - child: json['child'] as Map, + autofocus: json['autofocus'] as bool?, + clipBehavior: $enumDecodeNullable( + _$StacClipEnumMap, + json['clipBehavior'], + ), + isSemanticButton: json['isSemanticButton'] as bool?, + child: const StacWidgetConverter().fromJson( + json['child'] as Map?, + ), ); -Map _$StacTextButtonToJson(_StacTextButton instance) => +Map _$StacTextButtonToJson(StacTextButton instance) => { 'onPressed': instance.onPressed, 'onLongPress': instance.onLongPress, 'onHover': instance.onHover, 'onFocusChange': instance.onFocusChange, - 'style': instance.style, + 'style': instance.style?.toJson(), 'autofocus': instance.autofocus, - 'clipBehavior': _$ClipEnumMap[instance.clipBehavior]!, + 'clipBehavior': _$StacClipEnumMap[instance.clipBehavior], 'isSemanticButton': instance.isSemanticButton, - 'child': instance.child, + 'child': const StacWidgetConverter().toJson(instance.child), + 'type': instance.type, }; -const _$ClipEnumMap = { - Clip.none: 'none', - Clip.hardEdge: 'hardEdge', - Clip.antiAlias: 'antiAlias', - Clip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', +const _$StacClipEnumMap = { + StacClip.none: 'none', + StacClip.hardEdge: 'hardEdge', + StacClip.antiAlias: 'antiAlias', + StacClip.antiAliasWithSaveLayer: 'antiAliasWithSaveLayer', }; diff --git a/packages/stac_models/lib/widgets/widgets.dart b/packages/stac_models/lib/widgets/widgets.dart index c7f90de8..de6b4210 100644 --- a/packages/stac_models/lib/widgets/widgets.dart +++ b/packages/stac_models/lib/widgets/widgets.dart @@ -2,18 +2,24 @@ library; export 'app_bar/stac_app_bar.dart'; export 'center/stac_center.dart'; +export 'column/stac_column.dart'; export 'container/stac_container.dart'; +export 'elevated_button/stac_elevated_button.dart'; +export 'expanded/stac_expanded.dart'; +export 'filled_button/stac_filled_button.dart'; +export 'floating_action_button/stac_floating_action_button.dart'; +export 'icon_button/stac_icon_button.dart'; export 'image/stac_image.dart'; -export 'scaffold/stac_scaffold.dart'; -export 'text/stac_text.dart'; -export 'row/stac_row.dart'; -export 'column/stac_column.dart'; -export 'sized_box/stac_sized_box.dart'; +export 'outlined_button/stac_outlined_button.dart'; export 'padding/stac_padding.dart'; -export 'stack/stac_stack.dart'; export 'positioned/stac_positioned.dart'; -export 'expanded/stac_expanded.dart'; +export 'row/stac_row.dart'; +export 'scaffold/stac_scaffold.dart'; +export 'sized_box/stac_sized_box.dart'; export 'spacer/stac_spacer.dart'; +export 'stack/stac_stack.dart'; +export 'text/stac_text.dart'; +export 'text_button/stac_text_button.dart'; export 'aspect_ratio/stac_aspect_ratio.dart'; export 'flexible/stac_flexible.dart'; export 'fractionally_sized_box/stac_fractionally_sized_box.dart';