diff --git a/packages/stac/lib/src/parsers/widgets/stac_border/stac_border.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_border/stac_border.freezed.dart index 6a5ecc5e..65586681 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_border/stac_border.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_border/stac_border.freezed.dart @@ -15,7 +15,7 @@ T _$identity(T value) => value; /// @nodoc mixin _$StacBorder { -// Legacy properties for backward compatibility (Border.all) +// Uniform border properties (applies to all sides) String? get color; BorderStyle get borderStyle; StacDouble get width; @@ -214,7 +214,7 @@ class _StacBorder implements StacBorder { factory _StacBorder.fromJson(Map json) => _$StacBorderFromJson(json); -// Legacy properties for backward compatibility (Border.all) +// Uniform border properties (applies to all sides) @override final String? color; @override diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart index 330412ed..312443b8 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart @@ -4,6 +4,7 @@ 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_edge_insets/stac_edge_insets.dart'; import 'package:stac/src/parsers/widgets/stac_text_style/stac_text_style.dart'; +import 'package:stac/src/parsers/widgets/stac_box_decoration/stac_box_decoration.dart'; import 'package:stac/src/utils/stac_scroll_physics.dart'; export 'stac_tab_bar_parser.dart'; @@ -22,6 +23,7 @@ abstract class StacTabBar with _$StacTabBar { @Default(true) bool automaticIndicatorColorAdjustment, @Default(StacDouble(2.0)) StacDouble indicatorWeight, StacEdgeInsets? indicatorPadding, + StacBoxDecoration? indicator, TabBarIndicatorSize? indicatorSize, String? labelColor, StacTextStyle? labelStyle, diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.freezed.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.freezed.dart index 6c53444f..d148495c 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.freezed.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.freezed.dart @@ -23,6 +23,7 @@ mixin _$StacTabBar { bool get automaticIndicatorColorAdjustment; StacDouble get indicatorWeight; StacEdgeInsets? get indicatorPadding; + StacBoxDecoration? get indicator; TabBarIndicatorSize? get indicatorSize; String? get labelColor; StacTextStyle? get labelStyle; @@ -67,6 +68,8 @@ mixin _$StacTabBar { other.indicatorWeight == indicatorWeight) && (identical(other.indicatorPadding, indicatorPadding) || other.indicatorPadding == indicatorPadding) && + (identical(other.indicator, indicator) || + other.indicator == indicator) && (identical(other.indicatorSize, indicatorSize) || other.indicatorSize == indicatorSize) && (identical(other.labelColor, labelColor) || @@ -104,6 +107,7 @@ mixin _$StacTabBar { automaticIndicatorColorAdjustment, indicatorWeight, indicatorPadding, + indicator, indicatorSize, labelColor, labelStyle, @@ -120,7 +124,7 @@ mixin _$StacTabBar { @override String toString() { - return 'StacTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics, tabAlignment: $tabAlignment, dividerColor: $dividerColor, dividerHeight: $dividerHeight)'; + return 'StacTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicator: $indicator, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics, tabAlignment: $tabAlignment, dividerColor: $dividerColor, dividerHeight: $dividerHeight)'; } } @@ -139,6 +143,7 @@ abstract mixin class $StacTabBarCopyWith<$Res> { bool automaticIndicatorColorAdjustment, StacDouble indicatorWeight, StacEdgeInsets? indicatorPadding, + StacBoxDecoration? indicator, TabBarIndicatorSize? indicatorSize, String? labelColor, StacTextStyle? labelStyle, @@ -154,6 +159,7 @@ abstract mixin class $StacTabBarCopyWith<$Res> { $StacEdgeInsetsCopyWith<$Res>? get padding; $StacEdgeInsetsCopyWith<$Res>? get indicatorPadding; + $StacBoxDecorationCopyWith<$Res>? get indicator; $StacTextStyleCopyWith<$Res>? get labelStyle; $StacEdgeInsetsCopyWith<$Res>? get labelPadding; $StacTextStyleCopyWith<$Res>? get unselectedLabelStyle; @@ -179,6 +185,7 @@ class _$StacTabBarCopyWithImpl<$Res> implements $StacTabBarCopyWith<$Res> { Object? automaticIndicatorColorAdjustment = null, Object? indicatorWeight = null, Object? indicatorPadding = freezed, + Object? indicator = freezed, Object? indicatorSize = freezed, Object? labelColor = freezed, Object? labelStyle = freezed, @@ -226,6 +233,10 @@ class _$StacTabBarCopyWithImpl<$Res> implements $StacTabBarCopyWith<$Res> { ? _self.indicatorPadding : indicatorPadding // ignore: cast_nullable_to_non_nullable as StacEdgeInsets?, + indicator: freezed == indicator + ? _self.indicator + : indicator // ignore: cast_nullable_to_non_nullable + as StacBoxDecoration?, indicatorSize: freezed == indicatorSize ? _self.indicatorSize : indicatorSize // ignore: cast_nullable_to_non_nullable @@ -305,6 +316,20 @@ class _$StacTabBarCopyWithImpl<$Res> implements $StacTabBarCopyWith<$Res> { }); } + /// Create a copy of StacTabBar + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBoxDecorationCopyWith<$Res>? get indicator { + if (_self.indicator == null) { + return null; + } + + return $StacBoxDecorationCopyWith<$Res>(_self.indicator!, (value) { + return _then(_self.copyWith(indicator: value)); + }); + } + /// Create a copy of StacTabBar /// with the given fields replaced by the non-null parameter values. @override @@ -360,6 +385,7 @@ class _StacTabBar implements StacTabBar { this.automaticIndicatorColorAdjustment = true, this.indicatorWeight = const StacDouble(2.0), this.indicatorPadding, + this.indicator, this.indicatorSize, this.labelColor, this.labelStyle, @@ -403,6 +429,8 @@ class _StacTabBar implements StacTabBar { @override final StacEdgeInsets? indicatorPadding; @override + final StacBoxDecoration? indicator; + @override final TabBarIndicatorSize? indicatorSize; @override final String? labelColor; @@ -464,6 +492,8 @@ class _StacTabBar implements StacTabBar { other.indicatorWeight == indicatorWeight) && (identical(other.indicatorPadding, indicatorPadding) || other.indicatorPadding == indicatorPadding) && + (identical(other.indicator, indicator) || + other.indicator == indicator) && (identical(other.indicatorSize, indicatorSize) || other.indicatorSize == indicatorSize) && (identical(other.labelColor, labelColor) || @@ -501,6 +531,7 @@ class _StacTabBar implements StacTabBar { automaticIndicatorColorAdjustment, indicatorWeight, indicatorPadding, + indicator, indicatorSize, labelColor, labelStyle, @@ -517,7 +548,7 @@ class _StacTabBar implements StacTabBar { @override String toString() { - return 'StacTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics, tabAlignment: $tabAlignment, dividerColor: $dividerColor, dividerHeight: $dividerHeight)'; + return 'StacTabBar(tabs: $tabs, initialIndex: $initialIndex, isScrollable: $isScrollable, padding: $padding, indicatorColor: $indicatorColor, automaticIndicatorColorAdjustment: $automaticIndicatorColorAdjustment, indicatorWeight: $indicatorWeight, indicatorPadding: $indicatorPadding, indicator: $indicator, indicatorSize: $indicatorSize, labelColor: $labelColor, labelStyle: $labelStyle, labelPadding: $labelPadding, unselectedLabelColor: $unselectedLabelColor, unselectedLabelStyle: $unselectedLabelStyle, dragStartBehavior: $dragStartBehavior, enableFeedback: $enableFeedback, physics: $physics, tabAlignment: $tabAlignment, dividerColor: $dividerColor, dividerHeight: $dividerHeight)'; } } @@ -538,6 +569,7 @@ abstract mixin class _$StacTabBarCopyWith<$Res> bool automaticIndicatorColorAdjustment, StacDouble indicatorWeight, StacEdgeInsets? indicatorPadding, + StacBoxDecoration? indicator, TabBarIndicatorSize? indicatorSize, String? labelColor, StacTextStyle? labelStyle, @@ -556,6 +588,8 @@ abstract mixin class _$StacTabBarCopyWith<$Res> @override $StacEdgeInsetsCopyWith<$Res>? get indicatorPadding; @override + $StacBoxDecorationCopyWith<$Res>? get indicator; + @override $StacTextStyleCopyWith<$Res>? get labelStyle; @override $StacEdgeInsetsCopyWith<$Res>? get labelPadding; @@ -583,6 +617,7 @@ class __$StacTabBarCopyWithImpl<$Res> implements _$StacTabBarCopyWith<$Res> { Object? automaticIndicatorColorAdjustment = null, Object? indicatorWeight = null, Object? indicatorPadding = freezed, + Object? indicator = freezed, Object? indicatorSize = freezed, Object? labelColor = freezed, Object? labelStyle = freezed, @@ -630,6 +665,10 @@ class __$StacTabBarCopyWithImpl<$Res> implements _$StacTabBarCopyWith<$Res> { ? _self.indicatorPadding : indicatorPadding // ignore: cast_nullable_to_non_nullable as StacEdgeInsets?, + indicator: freezed == indicator + ? _self.indicator + : indicator // ignore: cast_nullable_to_non_nullable + as StacBoxDecoration?, indicatorSize: freezed == indicatorSize ? _self.indicatorSize : indicatorSize // ignore: cast_nullable_to_non_nullable @@ -709,6 +748,20 @@ class __$StacTabBarCopyWithImpl<$Res> implements _$StacTabBarCopyWith<$Res> { }); } + /// Create a copy of StacTabBar + /// with the given fields replaced by the non-null parameter values. + @override + @pragma('vm:prefer-inline') + $StacBoxDecorationCopyWith<$Res>? get indicator { + if (_self.indicator == null) { + return null; + } + + return $StacBoxDecorationCopyWith<$Res>(_self.indicator!, (value) { + return _then(_self.copyWith(indicator: value)); + }); + } + /// Create a copy of StacTabBar /// with the given fields replaced by the non-null parameter values. @override diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.g.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.g.dart index 1f2f70c7..e65c8c03 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.g.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar.g.dart @@ -24,6 +24,10 @@ _StacTabBar _$StacTabBarFromJson(Map json) => _StacTabBar( indicatorPadding: json['indicatorPadding'] == null ? null : StacEdgeInsets.fromJson(json['indicatorPadding']), + indicator: json['indicator'] == null + ? null + : StacBoxDecoration.fromJson( + json['indicator'] as Map), indicatorSize: $enumDecodeNullable( _$TabBarIndicatorSizeEnumMap, json['indicatorSize']), labelColor: json['labelColor'] as String?, @@ -59,6 +63,7 @@ Map _$StacTabBarToJson(_StacTabBar instance) => instance.automaticIndicatorColorAdjustment, 'indicatorWeight': instance.indicatorWeight, 'indicatorPadding': instance.indicatorPadding, + 'indicator': instance.indicator, 'indicatorSize': _$TabBarIndicatorSizeEnumMap[instance.indicatorSize], 'labelColor': instance.labelColor, 'labelStyle': instance.labelStyle, diff --git a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart index f95e425b..9b6482b4 100644 --- a/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart +++ b/packages/stac/lib/src/parsers/widgets/stac_tab_bar/stac_tab_bar_parser.dart @@ -6,6 +6,7 @@ import 'package:stac/src/parsers/widgets/stac_tab_bar/stac_tab_bar.dart'; import 'package:stac/src/parsers/widgets/stac_text_style/stac_text_style.dart'; import 'package:stac/src/utils/color_utils.dart'; import 'package:stac/src/utils/widget_type.dart'; +import 'package:stac/src/parsers/widgets/stac_box_decoration/stac_box_decoration.dart'; import 'package:stac_framework/stac_framework.dart'; class StacTabBarParser extends StacParser { @@ -33,6 +34,7 @@ class StacTabBarParser extends StacParser { model.automaticIndicatorColorAdjustment, indicatorWeight: model.indicatorWeight.parse, indicatorPadding: model.indicatorPadding.parse, + indicator: model.indicator?.parse(context), indicatorSize: model.indicatorSize, labelColor: model.labelColor.toColor(context), labelStyle: model.labelStyle?.parse(context), diff --git a/website/docs/widgets/tab_bar.md b/website/docs/widgets/tab_bar.md index 62789673..67f871c2 100644 --- a/website/docs/widgets/tab_bar.md +++ b/website/docs/widgets/tab_bar.md @@ -15,6 +15,7 @@ To know more about the TabBar widget in Flutter, refer to the [official document | automaticIndicatorColorAdjustment | `bool` | Whether to automatically adjust the indicator color. Defaults to `true`. | | indicatorWeight | `double` | The thickness of the tab indicator. Defaults to `2.0`. | | indicatorPadding | `StacEdgeInsets?` | The padding for the tab indicator. | +| indicator | `StacBoxDecoration?` | The decoration for the tab indicator. | | indicatorSize | `TabBarIndicatorSize?` | The size of the tab indicator. | | labelColor | `String?` | The color of the selected tab label. | | labelStyle | `StacTextStyle?` | The text style of the selected tab label. |