diff --git a/packages/mix/lib/src/attributes/enum/enum_util.dart b/packages/mix/lib/src/attributes/enum/enum_util.dart index 42c794cf2..8e2343124 100644 --- a/packages/mix/lib/src/attributes/enum/enum_util.dart +++ b/packages/mix/lib/src/attributes/enum/enum_util.dart @@ -66,6 +66,14 @@ final class TextDirectionUtility const TextDirectionUtility(super.builder); } +/// {@macro text_direction_utility} +@MixableEnumUtility() +final class TextLeadingDistributionUtility + extends MixUtility + with _$TextLeadingDistributionUtility { + const TextLeadingDistributionUtility(super.builder); +} + /// {@macro tile_mode_utility} @MixableEnumUtility() final class TileModeUtility extends MixUtility diff --git a/packages/mix/lib/src/attributes/enum/enum_util.g.dart b/packages/mix/lib/src/attributes/enum/enum_util.g.dart index 75947af7e..a68d868ce 100644 --- a/packages/mix/lib/src/attributes/enum/enum_util.g.dart +++ b/packages/mix/lib/src/attributes/enum/enum_util.g.dart @@ -156,6 +156,24 @@ mixin _$TextDirectionUtility T call(TextDirection value) => builder(value); } +/// {@template text_leading_distribution_utility} +/// A utility class for creating [Attribute] instances from [TextLeadingDistribution] values. +/// +/// This class extends [MixUtility] and provides methods to create [Attribute] instances +/// from predefined [TextLeadingDistribution] values. +/// {@endtemplate} +mixin _$TextLeadingDistributionUtility + on MixUtility { + /// Creates an [Attribute] instance with [TextLeadingDistribution.proportional] value. + T proportional() => builder(TextLeadingDistribution.proportional); + + /// Creates an [Attribute] instance with [TextLeadingDistribution.even] value. + T even() => builder(TextLeadingDistribution.even); + + /// Creates an [Attribute] instance with the specified TextLeadingDistribution value. + T call(TextLeadingDistribution value) => builder(value); +} + /// {@template tile_mode_utility} /// A utility class for creating [Attribute] instances from [TileMode] values. /// diff --git a/packages/mix/lib/src/attributes/text_height_behavior/text_height_behavior_dto.dart b/packages/mix/lib/src/attributes/text_height_behavior/text_height_behavior_dto.dart index a5dd2173f..1d868d53d 100644 --- a/packages/mix/lib/src/attributes/text_height_behavior/text_height_behavior_dto.dart +++ b/packages/mix/lib/src/attributes/text_height_behavior/text_height_behavior_dto.dart @@ -32,13 +32,13 @@ final class TextHeightBehaviorUtility (v) => only(applyHeightToLastDescent: v), ); + late final leadingDistribution = TextLeadingDistributionUtility( + (v) => only(leadingDistribution: v), + ); + TextHeightBehaviorUtility(super.builder) : super(valueToDto: (v) => v.toDto()); - T leadingDistribution(TextLeadingDistribution distribution) => builder( - TextHeightBehaviorDto(leadingDistribution: distribution), - ); - @Deprecated("Use the utilities instead") T call(TextHeightBehavior value) => builder(value.toDto());