diff --git a/MIGRATION.md b/MIGRATION.md index 30b00f7fa..36c3e04fe 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,11 +1,101 @@ # Migration Guide +- [v1.3.1 → v2.0.0](#v131--v200) - [v1.3.0 → v1.3.1](#v130--v131) - [v1.2.0 → v1.3.0](#v120--v130) - [v1.1.x → v1.2.0](#v11x--v120) - [v1.0.0 → v1.1.1](#v100--v111) - [Support](#support) +## v1.3.1 → v2.0.0 + +### Overview + +This is a **major release** introducing rich text support across multiple components, significant design version updates, major token updates (v2.4.0 and v2.5.0), and an updated icon library (v1.6). It also brings improvements to the `Tab Bar`, `Toolbar Top`, `Badge`, `Tag`, `Input Tag`, `Text Input`, `Password Input`, `Phone Number Input`, `Filter Chip`, and `Suggestion Chip` components. + +### Before You Begin + +#### Prerequisites + +- Use version 1.3.1 or older + +### Breaking Changes + +#### 1. Rich text (Markdown) support in multiple components + +Several components have been updated to support Markdown formatting in their label/content parameters. The `label` (or equivalent text parameter) still accepts a plain `String`, but now also renders Markdown syntax (bold, italic, links, etc.). + +**Affected components**: `OudsAlertMessage`, `OudsSwitch`, `OudsRadioButton`, `OudsCheckbox`, `OudsTextInput`, `OudsPinCodeInput`, `OudsPhoneNumberInput` + +**Impact**: Low (additive — existing plain strings continue to work as before) + +**Required Action**: +- No action required (backward compatible) +- Optionally use Markdown syntax in labels to add bold, italic, or link formatting + +**Reason for Change**: Provide richer content support across input and control components + +#### 2. Token breaking changes — v2.4.0 and v2.5.0 + +Design tokens have been updated to versions 2.4.0 and 2.5.0. These major token updates may rename or restructure token keys. + +**Impact**: Medium (only if overriding tokens directly in a custom theme) + +**Required Action**: +- If you override tokens in a custom theme, audit your overrides against the new token names +- Rebuild and check for compilation errors related to missing or renamed token properties + +**Reason for Change**: Align with latest design system token specification + +#### 3. Icon library update — v1.6 + +The OUDS icon library has been updated to version 1.6. Some icon names or asset paths may have changed. + +**Impact**: Medium (if using icon constants from the library) + +**Required Action**: +- Review any icon constants or asset paths you reference directly +- Update to the new icon names from v1.6 if you receive compilation errors or missing asset warnings + +### Component Design Version Updates + +Several components have been updated to align with new design specification versions. These changes are primarily visual and do not require code changes unless you override component tokens in a custom theme. + +**Impact**: Low–Medium (visual changes; verify rendering after upgrading) + +**Required Action**: +- Verify the visual appearance and accessibility behaviour of each updated component after upgrading +- If you override component tokens in a custom theme, check that your overrides are still valid + +| Component | New Design Version | +|-----------|--------------------| +| `OudsTextInput` | v1.4 | +| `OudsPasswordInput` | v1.3 | +| `OudsFilterChip` / `OudsSuggestionChip` | v1.4 | +| `OudsBadge` (icon variant) | v1.3.0 | +| `OudsPhoneNumberInput` | v1.3 | +| `OudsTag` | v1.5 | +| `OudsInputTag` | v1.2 | + +### Component Updates (Non-breaking) + +| Component | Change | +|-----------|--------| +| Tab Bar | Updated selected tab indicator animation | +| Toolbar Top | Badge support added in trailing actions | +| Bottom Bar | Fixed inconsistent accessible order and zoom overlap | +| Password Input | Fixed label truncation when zoom is applied | +| Filter Chip | Fixed keyboard/Switch Access focus issue | +| Phone Number Input | Added interaction hint for accessibility | +| Input Tag | Fixed button role for accessibility | + +### Compatibility + +- **Backward Compatibility**: No (breaking changes in token API, icon API, and component label parameters) +- **v1.3.1 Support**: Ended with this release + +--- + > **Note**: v1.3.1 is a maintenance release with bug fixes and improvements. No migration is required. ## v1.3.0 → v1.3.1 diff --git a/app/CHANGELOG.md b/app/CHANGELOG.md index 9d4d07f53..4356adaac 100644 --- a/app/CHANGELOG.md +++ b/app/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop) ### Added ### Changed +- [Library] Remove deprecated code and API ([#820](https://github.com/Orange-OpenSource/ouds-flutter/issues/820)) - [Library] update `Pin code input` component to v1.3 ([#691](https://github.com/Orange-OpenSource/ouds-flutter/issues/691)) - [Library] `tab bar component`, update the animation of the `selected tab indicator` ([#633](https://github.com/Orange-OpenSource/ouds-flutter/issues/633)) - [DemoApp][Library] Update `ToolBar Top`, with Badge in Trailing Actions ([#642](https://github.com/Orange-OpenSource/ouds-flutter/issues/642)) diff --git a/ouds_core/CHANGELOG.md b/ouds_core/CHANGELOG.md index 0fee98179..22768bc45 100644 --- a/ouds_core/CHANGELOG.md +++ b/ouds_core/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop) ### Added ### Changed +- [Library] Remove deprecated code and API ([#820](https://github.com/Orange-OpenSource/ouds-flutter/issues/820)) - [Library] update `Pin code input` component to v1.3 ([#691](https://github.com/Orange-OpenSource/ouds-flutter/issues/691)) - [Library] `tab bar component`, update the animation of the `selected tab indicator` ([#633](https://github.com/Orange-OpenSource/ouds-flutter/issues/633)) - [Library] Update `ToolBar Top`, with Badge in Trailing Actions ([#642](https://github.com/Orange-OpenSource/ouds-flutter/issues/642)) diff --git a/ouds_core/lib/components/badge/internal/ouds_badge_size_modifier.dart b/ouds_core/lib/components/badge/internal/ouds_badge_size_modifier.dart index b0ad5845d..561c0d26b 100644 --- a/ouds_core/lib/components/badge/internal/ouds_badge_size_modifier.dart +++ b/ouds_core/lib/components/badge/internal/ouds_badge_size_modifier.dart @@ -43,15 +43,11 @@ class OudsBadgeSizeModifier { } double getBadgeIconOffsetsPadding( - OudsBadgeStatus? state, OudsBadgeSize? size, OudsIconStatus? status, ) { final badgeToken = OudsTheme.of(context).componentsTokens(context).badge; - if ((state != null && - (state != OudsBadgeStatus.neutral && - state != OudsBadgeStatus.accent)) || - !OudsIconStatus.functionalStatuses.contains(status.runtimeType)) { + if (!OudsIconStatus.functionalStatuses.contains(status.runtimeType)) { switch (size) { case OudsBadgeSize.xsmall: return badgeToken.spaceInsetXsmall; diff --git a/ouds_core/lib/components/badge/internal/ouds_badge_status_modifier.dart b/ouds_core/lib/components/badge/internal/ouds_badge_status_modifier.dart index 90c773e69..821b07078 100644 --- a/ouds_core/lib/components/badge/internal/ouds_badge_status_modifier.dart +++ b/ouds_core/lib/components/badge/internal/ouds_badge_status_modifier.dart @@ -15,7 +15,6 @@ library; import 'package:flutter/material.dart'; -import 'package:ouds_core/components/badge/ouds_badge.dart'; import 'package:ouds_core/components/common/ouds_icon_status.dart'; import 'package:ouds_core/components/utilities/app_assets.dart'; import 'package:ouds_theme_contract/ouds_theme.dart'; @@ -27,13 +26,7 @@ class OudsBadgeStatusModifier { OudsBadgeStatusModifier(this.context); /// Returns the background color based on the badge status. - //deprecation remove: The param state will be removed after deprecation - Color? getStatusColor( - OudsBadgeStatus? state, - OudsIconStatus? status, - bool isEnabled, - bool iconType, - ) { + Color? getStatusColor(OudsIconStatus? status, bool isEnabled, bool iconType) { final colorTheme = OudsTheme.of(context).colorScheme(context); if (!isEnabled) { @@ -46,127 +39,58 @@ class OudsBadgeStatusModifier { } if (iconType && - ((state != null && - (state != OudsBadgeStatus.neutral && - state != OudsBadgeStatus.accent)) || - (status != null && - (OudsIconStatus.functionalStatuses.contains( - status.runtimeType, - ))))) { + (status != null && + (OudsIconStatus.functionalStatuses.contains(status.runtimeType)))) { return colorTheme.opacityTransparent; } - //deprecation remove: will be removed after deprecation - if (state != null) { - switch (state) { - case OudsBadgeStatus.neutral: - return colorTheme.surfaceInverseHigh; - case OudsBadgeStatus.accent: - return colorTheme.surfaceStatusAccentEmphasized; - case OudsBadgeStatus.positive: - return colorTheme.surfaceStatusPositiveEmphasized; - case OudsBadgeStatus.info: - return colorTheme.surfaceStatusInfoEmphasized; - case OudsBadgeStatus.warning: - return colorTheme.surfaceStatusWarningEmphasized; - case OudsBadgeStatus.negative: - return colorTheme.surfaceStatusNegativeEmphasized; - } - } else { - if (status != null) { - final iconTokens = OudsTheme.of(context).componentsTokens(context).icon; - - return switch (status) { - Neutral() => colorTheme.surfaceInverseHigh, - Accent() => colorTheme.surfaceStatusAccentEmphasized, - Positive() => colorTheme.surfaceStatusPositiveEmphasized, - Info() => colorTheme.surfaceStatusInfoEmphasized, - Warning() => iconTokens.colorContentStatusWarningExternalShape, - Negative() => colorTheme.surfaceStatusNegativeEmphasized, - }; - } + + if (status != null) { + final iconTokens = OudsTheme.of(context).componentsTokens(context).icon; + + return switch (status) { + Neutral() => colorTheme.surfaceInverseHigh, + Accent() => colorTheme.surfaceStatusAccentEmphasized, + Positive() => colorTheme.surfaceStatusPositiveEmphasized, + Info() => colorTheme.surfaceStatusInfoEmphasized, + Warning() => iconTokens.colorContentStatusWarningExternalShape, + Negative() => colorTheme.surfaceStatusNegativeEmphasized, + }; } return null; } /// Returns the background color based on the badge status. - //deprecation remove: The param state will be removed after deprecation - Color? getTextColor( - OudsBadgeStatus? state, - OudsIconStatus? status, - bool isEnabled, - ) { + Color? getTextColor(OudsIconStatus? status, bool isEnabled) { final colorTheme = OudsTheme.of(context).colorScheme(context); if (!isEnabled) { return colorTheme.contentOnActionDisabled; } - //deprecation remove: will be removed after deprecation - if (state != null) { - switch (state) { - case OudsBadgeStatus.neutral: - return colorTheme.contentInverse; - case OudsBadgeStatus.accent: - return colorTheme.contentOnStatusAccentEmphasized; - case OudsBadgeStatus.positive: - return colorTheme.contentOnStatusPositiveEmphasized; - case OudsBadgeStatus.info: - return colorTheme.contentOnStatusInfoEmphasized; - case OudsBadgeStatus.warning: - return colorTheme.contentOnStatusWarningEmphasized; - case OudsBadgeStatus.negative: - return colorTheme.contentOnStatusNegativeEmphasized; - } - } else { - if (status != null) { - return switch (status) { - Neutral() => colorTheme.contentInverse, - Accent() => colorTheme.contentOnStatusAccentEmphasized, - Positive() => colorTheme.contentOnStatusPositiveEmphasized, - Info() => colorTheme.contentOnStatusInfoEmphasized, - Warning() => colorTheme.contentOnStatusWarningEmphasized, - Negative() => colorTheme.contentOnStatusNegativeEmphasized, - }; - } + if (status != null) { + return switch (status) { + Neutral() => colorTheme.contentInverse, + Accent() => colorTheme.contentOnStatusAccentEmphasized, + Positive() => colorTheme.contentOnStatusPositiveEmphasized, + Info() => colorTheme.contentOnStatusInfoEmphasized, + Warning() => colorTheme.contentOnStatusWarningEmphasized, + Negative() => colorTheme.contentOnStatusNegativeEmphasized, + }; } return null; } /// Returns the icon color based on the badge status. - //deprecation remove: The param state will be removed after deprecation - Color getIconColor( - OudsBadgeStatus? state, - OudsIconStatus? status, - bool isEnabled, - ) { + Color getIconColor(OudsIconStatus? status, bool isEnabled) { final colorTheme = OudsTheme.of(context).colorScheme(context); if (!isEnabled) { - if ((state == OudsBadgeStatus.accent || - state == OudsBadgeStatus.neutral) || - (!OudsIconStatus.functionalStatuses.contains(status.runtimeType))) { + if (!OudsIconStatus.functionalStatuses.contains(status.runtimeType)) { return colorTheme.contentOnActionDisabled; } else { return colorTheme.actionDisabled; } } - - //deprecation remove: will be removed after deprecation - if (state != null) { - switch (state) { - case OudsBadgeStatus.neutral: - return colorTheme.contentInverse; - case OudsBadgeStatus.accent: - return colorTheme.contentOnStatusAccentEmphasized; - case OudsBadgeStatus.positive: - return colorTheme.contentStatusPositive; - case OudsBadgeStatus.info: - return colorTheme.contentStatusInfo; - case OudsBadgeStatus.warning: - return colorTheme.contentOnStatusWarningEmphasized; - case OudsBadgeStatus.negative: - return colorTheme.contentStatusNegative; - } - } else if (status != null) { + if (status != null) { final iconTokens = OudsTheme.of(context).componentsTokens(context).icon; return switch (status) { @@ -182,37 +106,18 @@ class OudsBadgeStatusModifier { } /// Return the icon based on badge status - //deprecation remove: The param state will be removed after deprecation - String? getIcon(OudsBadgeStatus? state, OudsIconStatus? status) { - //deprecation remove: will be removed after deprecation - if (state != null) { - switch (state) { - case OudsBadgeStatus.positive: - return AppAssets.icons.badgeIconTickConfirmationFill; - case OudsBadgeStatus.info: - return AppAssets.icons.badgeIconInfoFill; - case OudsBadgeStatus.warning: - return AppAssets.icons.componentAlertWarningExternalShape; - case OudsBadgeStatus.negative: - return AppAssets.icons.badgeIconErrorFill; - case OudsBadgeStatus.neutral: - case OudsBadgeStatus.accent: - return null; - } - } else { - // Handle the new 'iconStatus' API - if (status != null) { - return switch (status) { - // For those statuses, the icon is fixed and defined here. - Positive() => AppAssets.icons.badgeIconTickConfirmationFill, - Info() => AppAssets.icons.badgeIconInfoFill, - Warning() => null, - Negative() => AppAssets.icons.badgeIconErrorFill, - - // For the other Accent and Neutral the icon should be defined by user - _ => null, - }; - } + String? getIcon(OudsIconStatus? status) { + if (status != null) { + return switch (status) { + // For those statuses, the icon is fixed and defined here. + Positive() => AppAssets.icons.badgeIconTickConfirmationFill, + Info() => AppAssets.icons.badgeIconInfoFill, + Warning() => null, + Negative() => AppAssets.icons.badgeIconErrorFill, + + // For the other Accent and Neutral the icon should be defined by user + _ => null, + }; } return null; } diff --git a/ouds_core/lib/components/badge/ouds_badge.dart b/ouds_core/lib/components/badge/ouds_badge.dart index b6a8c7f35..53249e372 100644 --- a/ouds_core/lib/components/badge/ouds_badge.dart +++ b/ouds_core/lib/components/badge/ouds_badge.dart @@ -26,31 +26,6 @@ import 'package:ouds_theme_contract/ouds_theme.dart'; /// this is an internal enum should not be exposed to the user enum _OudsBadgeType { icon, count, standard } -/// The [OudsBadgeStatus] enum defines the visual importance of the badge within the UI. -@Deprecated( - 'use OudsIconStatus subclasses (Neutral, Accent, Positive, Info, Warning, Negative). This type will be removed in the next major release.', -) -enum OudsBadgeStatus { negative, accent, positive, info, warning, neutral } - -/// @nodoc -// deprecation remove : this enum is added only to support the deprecated enum and will be removed after deprecation -extension OudsBadgeStatusConverter on OudsBadgeStatus { - /// Converts this simple status enum to the corresponding [OudsIconStatus] class instance. - /// - /// Note: For `Neutral` and `Accent`, this conversion does not carry over any - /// custom icon information, as the base enum does not store it. - OudsIconStatus toIconStatus() { - return switch (this) { - OudsBadgeStatus.neutral => Neutral(), - OudsBadgeStatus.accent => Accent(), - OudsBadgeStatus.positive => Positive(), - OudsBadgeStatus.warning => Warning(), - OudsBadgeStatus.negative => Negative(), - OudsBadgeStatus.info => Info(), - }; - } -} - /// The [OudsBadgeSize] enum defines the size of the badge within the UI. enum OudsBadgeSize { xsmall, small, medium, large } @@ -78,33 +53,8 @@ enum OudsBadgeSize { xsmall, small, medium, large } /// * `OudsBadge.icon`: Displays an icon within the badge. The icon is only /// visible for `medium` and `large` sizes. /// -/// This API replaces the previous generic constructor and deprecated status model. -/// -/// --- -/// ## Migration overview -/// -/// ### 1) Use named constructors -/// Replace the deprecated default constructor: -/// - `OudsBadge(...)` -/// with one of: -/// - `OudsBadge.standard(...)` -/// - `OudsBadge.count(...)` -/// - `OudsBadge.icon(...)` -/// -/// ### 2) Replace `OudsBadgeStatus` with `OudsIconStatus` -/// `OudsBadgeStatus` is deprecated and will be removed. -/// Use `OudsIconStatus` subclasses to define badge visual semantics. -/// -/// ### 3) Remove `icon` parameter -/// The `icon` parameter is deprecated and will be removed. -/// Icon selection must now be driven by `status` (`OudsIconStatus`): -/// - Functional statuses (`Positive`, `Info`, `Warning`, `Negative`) provide fixed icons. -/// - Contextual statuses (`Neutral`, `Accent`) can carry a custom icon asset. -/// -/// --- /// ## Status model /// -/// New `status` type: /// - [Neutral] (optional custom icon) /// - [Accent] (optional custom icon) /// - [Positive] (fixed functional icon) @@ -131,7 +81,6 @@ enum OudsBadgeSize { xsmall, small, medium, large } /// - [status] : The badge's status, influencing its color and style (e.g., negative, positive, warning). **Used by `OudsBadge.standard` and `OudsBadge.count`**. /// - [size] : The size of the badge, such as medium, large, etc., to fit various visual needs. /// - [label] : An optional text to display inside the badge, often used for numbers or status texts. **Used by `OudsBadge.count`** -/// - [icon] : An optional SVG asset name to display an icon within the badge, complementing or replacing the label. /// - [status] : The status of the badge. The background color of the badge and the icon color are based on this status. **Used by `OudsBadge.icon`** /// There are two types of status: /// - Non-functional statuses: [Neutral] or [Accent] @@ -194,43 +143,14 @@ enum OudsBadgeSize { xsmall, small, medium, large } /// ``` class OudsBadge extends StatefulWidget { - @Deprecated( - 'Use status of type OudsIconStatus instead. This parameter will be removed in a future version.', - ) - final OudsBadgeStatus? _deprecatedStatus; final OudsIconStatus? status; final OudsBadgeSize? size; final String? label; - @Deprecated( - 'icon is now defined by status (OudsIconStatus). Use Accent(icon: ...) or Neutral(icon: ...) for custom icons.', - ) - final String? icon; final Widget? child; final bool enabled; final String? semanticsLabel; final bool? _withIcon; - /// ⚠️ **DEPRECATED:** Use [OudsBadge.standard], [OudsBadge.icon], or [OudsBadge.count] constructors instead. - @Deprecated( - 'Use named constructors for clarity: OudsBadge.standard() for standard type, OudsBadge.icon() for icon type, or OudsBadge.count() for count type.' - ' This constructor will be removed in a future version.', - ) - const OudsBadge({ - super.key, - OudsBadgeStatus? status, - this.size = OudsBadgeSize.medium, - this.label, - @Deprecated( - 'icon is now defined by status (OudsIconStatus). Use Accent(icon: ...) or Neutral(icon: ...) for custom icons.', - ) - this.icon, - this.child, - this.enabled = true, - this.semanticsLabel, - }) : _deprecatedStatus = status, - status = null, - _withIcon = icon != null; - const OudsBadge.icon({ super.key, this.size = OudsBadgeSize.medium, @@ -240,8 +160,6 @@ class OudsBadge extends StatefulWidget { this.status, bool withIcon = true, }) : label = null, - icon = null, - _deprecatedStatus = null, _withIcon = withIcon; const OudsBadge.standard({ @@ -252,8 +170,6 @@ class OudsBadge extends StatefulWidget { this.semanticsLabel, this.status, }) : label = null, - icon = null, - _deprecatedStatus = null, _withIcon = false; const OudsBadge.count({ @@ -264,18 +180,13 @@ class OudsBadge extends StatefulWidget { this.enabled = true, this.semanticsLabel, this.status, - }) : icon = null, - _deprecatedStatus = null, - _withIcon = false; + }) : _withIcon = false; @override State createState() => _OudsBadgeState(); } class _OudsBadgeState extends State { - OudsIconStatus? get _effectiveStatus => - widget.status ?? widget._deprecatedStatus?.toIconStatus(); - @override Widget build(BuildContext context) { Widget? badgeLabel; @@ -283,7 +194,7 @@ class _OudsBadgeState extends State { final badgeSizeModifier = OudsBadgeSizeModifier(context); final badge = OudsTheme.of(context).componentsTokens(context).badge; // Check for the icon property - final hasIcon = switch (_effectiveStatus) { + final hasIcon = switch (widget.status) { // If it's a Neutral or Accent type, check if its icon property is not null Neutral(icon: final assets) => assets != null, Accent(icon: final assets) => assets != null, @@ -298,8 +209,7 @@ class _OudsBadgeState extends State { badgeLabel = const SizedBox.shrink(); break; case _OudsBadgeType.icon: - //the param icon will be removed after deprecation - badgeLabel = _buildBadgeWithIcon(context, widget.icon); + badgeLabel = _buildBadgeWithIcon(context); break; case _OudsBadgeType.count: badgeLabel = _buildBadgeWithNumber(context); @@ -340,22 +250,18 @@ class _OudsBadgeState extends State { : null, backgroundColor: badgeStatusModifier.getStatusColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.enabled, false, ), child: widget.child, ) : Badge( - padding: - _OudsBadgeType.icon == type && - (widget.icon != null || hasIcon) + padding: _OudsBadgeType.icon == type && hasIcon ? EdgeInsetsDirectional.all( badgeSizeModifier.getBadgeIconOffsetsPadding( - widget._deprecatedStatus, widget.size, - _effectiveStatus, + widget.status, ), ) : widget.size == OudsBadgeSize.large @@ -368,8 +274,7 @@ class _OudsBadgeState extends State { end: badge.spacePaddingInlineMedium, ), backgroundColor: badgeStatusModifier.getStatusColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.enabled, _OudsBadgeType.icon == type, ), @@ -395,8 +300,7 @@ class _OudsBadgeState extends State { .typeLabelDefaultMedium(context) .copyWith( color: badgeStatusModifier.getTextColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.enabled, ), ) @@ -404,8 +308,7 @@ class _OudsBadgeState extends State { .typeLabelDefaultSmall(context) .copyWith( color: badgeStatusModifier.getTextColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.enabled, ), ), @@ -416,25 +319,19 @@ class _OudsBadgeState extends State { } /// Static method to build icon from asset name - //deprecation remove: The param assetName will be removed after deprecation - Widget _buildBadgeWithIcon(BuildContext context, String? assetName) { + Widget _buildBadgeWithIcon(BuildContext context) { final badgeStatusModifier = OudsBadgeStatusModifier(context); // This gets the fixed icon for Positive, Negative, etc. - final fixedIcon = badgeStatusModifier.getIcon( - widget._deprecatedStatus, - _effectiveStatus, - ); + final fixedIcon = badgeStatusModifier.getIcon(widget.status); // This correctly gets the user-defined icon for Neutral and Accent - final userDefinedIcon = badgeStatusModifier.getAssetsName(_effectiveStatus); + final userDefinedIcon = badgeStatusModifier.getAssetsName(widget.status); // The logic correctly prioritizes which icon to use. - // The deprecated `assetName` is also included for backward compatibility. - final iconPath = fixedIcon ?? assetName ?? userDefinedIcon ?? ""; + final iconPath = fixedIcon ?? userDefinedIcon ?? ""; - if (_effectiveStatus is Warning || - widget._deprecatedStatus == OudsBadgeStatus.warning) { + if (widget.status is Warning) { final iconTokens = OudsTheme.of(context).componentsTokens(context).icon; return widget.enabled @@ -492,11 +389,7 @@ class _OudsBadgeState extends State { fit: BoxFit.contain, package: fixedIcon != null ? OudsTheme.of(context).packageName : null, colorFilter: ColorFilter.mode( - badgeStatusModifier.getIconColor( - widget._deprecatedStatus, - _effectiveStatus, - widget.enabled, - ), + badgeStatusModifier.getIconColor(widget.status, widget.enabled), BlendMode.srcIn, ), ), @@ -534,7 +427,7 @@ class _OudsBadgeState extends State { widget.size == OudsBadgeSize.large; // Check for the icon property - final hasIcon = switch (_effectiveStatus) { + final hasIcon = switch (widget.status) { // If it's a Neutral or Accent type, check if its icon property is not null Neutral(icon: final assets) => assets != null, Accent(icon: final assets) => assets != null, @@ -544,8 +437,7 @@ class _OudsBadgeState extends State { null => false, }; - if (widget.icon != null || - (widget.icon == null && hasIcon && widget._withIcon == true)) { + if (hasIcon && widget._withIcon == true) { return _OudsBadgeType.icon; } else if (widget.label != null && isMediumOrLarge) { return _OudsBadgeType.count; diff --git a/ouds_core/lib/components/navigation/internal/ouds_navigation_bar_a11y.dart b/ouds_core/lib/components/navigation/internal/ouds_navigation_bar_a11y.dart index d4dafbb2c..826eb1981 100644 --- a/ouds_core/lib/components/navigation/internal/ouds_navigation_bar_a11y.dart +++ b/ouds_core/lib/components/navigation/internal/ouds_navigation_bar_a11y.dart @@ -80,17 +80,3 @@ abstract final class OudsNavigationBarA11y { return '$label, ${badge.contentDescription}'; } } - -/// Builds the accessible label for a navigation bar item. -/// -/// Combines [label] with [badge]'s description: `"Label, badge description"`. -/// -/// **Deprecated** — prefer [OudsNavigationBarA11y.buildTabSemanticLabel]. -@Deprecated('Use OudsNavigationBarA11y.buildTabSemanticLabel instead.') -String buildNavItemAccessibleLabel( - String label, - OudsNavigationBarItemBadge? badge, -) { - if (badge == null) return label; - return '$label, ${badge.contentDescription}'; -} diff --git a/ouds_core/lib/components/tag/internal/ouds_tag_status_modifier.dart b/ouds_core/lib/components/tag/internal/ouds_tag_status_modifier.dart index 1750cf650..2b38f63ee 100644 --- a/ouds_core/lib/components/tag/internal/ouds_tag_status_modifier.dart +++ b/ouds_core/lib/components/tag/internal/ouds_tag_status_modifier.dart @@ -27,8 +27,11 @@ class OudsTagStatusModifier { OudsTagStatusModifier(this.context); /// Returns the background color based on the tag status. - //deprecation remove: The param state will be removed after deprecation - Color? getStatusColor(OudsTagStatus? state, OudsIconStatus? iconStatus, OudsTagAppearance? appearance, bool isEnabled) { + Color? getStatusColor( + OudsIconStatus? iconStatus, + OudsTagAppearance? appearance, + bool isEnabled, + ) { final isEmphasized = appearance == OudsTagAppearance.emphasized; final colorTheme = OudsTheme.of(context).colorScheme(context); @@ -36,31 +39,14 @@ class OudsTagStatusModifier { return colorTheme.actionDisabled; } - //deprecation remove: will be removed after deprecation - if(state != null){ - switch (state) { - case OudsTagStatus.neutral: - return _getNeutralStatusColor(isEmphasized,colorTheme); - case OudsTagStatus.accent: - return _getAccentStatusColor(isEmphasized,colorTheme); - case OudsTagStatus.positive: - return _getPositiveStatusColor(isEmphasized,colorTheme); - case OudsTagStatus.info: - return _getInfoStatusColor(isEmphasized,colorTheme); - case OudsTagStatus.warning: - return _getWarningStatusColor(isEmphasized,colorTheme); - case OudsTagStatus.negative: - return _getNegativeStatusColor(isEmphasized,colorTheme); - } - } - else if(iconStatus != null){ + if (iconStatus != null) { return switch (iconStatus) { - Neutral() => _getNeutralStatusColor(isEmphasized,colorTheme), - Accent() => _getAccentStatusColor(isEmphasized,colorTheme), - Positive() => _getPositiveStatusColor(isEmphasized,colorTheme), - Info() => _getInfoStatusColor(isEmphasized,colorTheme), - Warning() => _getWarningStatusColor(isEmphasized,colorTheme), - Negative() => _getNegativeStatusColor(isEmphasized,colorTheme), + Neutral() => _getNeutralStatusColor(isEmphasized, colorTheme), + Accent() => _getAccentStatusColor(isEmphasized, colorTheme), + Positive() => _getPositiveStatusColor(isEmphasized, colorTheme), + Info() => _getInfoStatusColor(isEmphasized, colorTheme), + Warning() => _getWarningStatusColor(isEmphasized, colorTheme), + Negative() => _getNegativeStatusColor(isEmphasized, colorTheme), }; } @@ -68,51 +54,54 @@ class OudsTagStatusModifier { } /// Returns the background color for the **neutral** status. - Color _getNeutralStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getNeutralStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceInverseHigh : colorTheme.surfaceSecondary; } /// Returns the background color for the **accent** status. - Color _getAccentStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getAccentStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceStatusAccentEmphasized : colorTheme.surfaceStatusAccentMuted; } /// Returns the background color for the **positive** status. - Color _getPositiveStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getPositiveStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceStatusPositiveEmphasized : colorTheme.surfaceStatusPositiveMuted; } /// Returns the background color for the **info** status. - Color _getInfoStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getInfoStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceStatusInfoEmphasized : colorTheme.surfaceStatusInfoMuted; } /// Returns the background color for the **warning** status. - Color _getWarningStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getWarningStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceStatusWarningEmphasized : colorTheme.surfaceStatusWarningMuted; } /// Returns the background color for the **negative** status. - Color _getNegativeStatusColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getNegativeStatusColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.surfaceStatusNegativeEmphasized : colorTheme.surfaceStatusNegativeMuted; } - /// Returns the text color based on the tag status. - //deprecation remove: The param state will be removed after deprecation - Color? getStatusTextColor(OudsTagStatus? state, OudsIconStatus? status, OudsTagAppearance appearance, bool isLoading, bool isEnabled) { + Color? getStatusTextColor( + OudsIconStatus? status, + OudsTagAppearance appearance, + bool isLoading, + bool isEnabled, + ) { final isEmphasized = appearance == OudsTagAppearance.emphasized; final colorTheme = OudsTheme.of(context).colorScheme(context); @@ -123,30 +112,14 @@ class OudsTagStatusModifier { return colorTheme.contentOnActionDisabled; } - //deprecation remove: will be removed after deprecation - if(state != null) { - switch (state) { - case OudsTagStatus.neutral: - return _getNeutralTextColor(isEmphasized,colorTheme); - case OudsTagStatus.accent: - return _getAccentTextColor(isEmphasized,colorTheme); - case OudsTagStatus.positive: - return _getPositiveTextColor(isEmphasized,colorTheme); - case OudsTagStatus.info: - return _getInfoTextColor(isEmphasized,colorTheme); - case OudsTagStatus.warning: - return _getWarningTextColor(isEmphasized,colorTheme); - case OudsTagStatus.negative: - return _getNegativeTextColor(isEmphasized,colorTheme); - } - } else if(status != null){ + if (status != null) { return switch (status) { - Neutral() => _getNeutralTextColor(isEmphasized,colorTheme), - Accent() => _getAccentTextColor(isEmphasized,colorTheme), - Positive() => _getPositiveTextColor(isEmphasized,colorTheme), - Info() => _getInfoTextColor(isEmphasized,colorTheme), - Warning() => _getWarningTextColor(isEmphasized,colorTheme), - Negative() => _getNegativeTextColor(isEmphasized,colorTheme), + Neutral() => _getNeutralTextColor(isEmphasized, colorTheme), + Accent() => _getAccentTextColor(isEmphasized, colorTheme), + Positive() => _getPositiveTextColor(isEmphasized, colorTheme), + Info() => _getInfoTextColor(isEmphasized, colorTheme), + Warning() => _getWarningTextColor(isEmphasized, colorTheme), + Negative() => _getNegativeTextColor(isEmphasized, colorTheme), }; } @@ -154,81 +127,65 @@ class OudsTagStatusModifier { } /// Returns the text color for the **neutral** status. - Color _getNeutralTextColor(bool isEmphasized, OudsColorScheme colorTheme){ - return isEmphasized - ? colorTheme.contentInverse - : colorTheme.contentDefault; + Color _getNeutralTextColor(bool isEmphasized, OudsColorScheme colorTheme) { + return isEmphasized ? colorTheme.contentInverse : colorTheme.contentDefault; } /// Returns the text color for the **accent** status. - Color _getAccentTextColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getAccentTextColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusAccentEmphasized : colorTheme.contentOnStatusAccentMuted; } /// Returns the text color for the **positive** status. - Color _getPositiveTextColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getPositiveTextColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusPositiveEmphasized : colorTheme.contentOnStatusPositiveMuted; } /// Returns the text color for the **info** status. - Color _getInfoTextColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getInfoTextColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusInfoEmphasized : colorTheme.contentOnStatusInfoMuted; } /// Returns the text color for the **warning** status. - Color _getWarningTextColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getWarningTextColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusWarningEmphasized : colorTheme.contentOnStatusWarningMuted; } /// Returns the text color for the **negative** status. - Color _getNegativeTextColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getNegativeTextColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusNegativeEmphasized : colorTheme.contentOnStatusNegativeMuted; } /// Return the icon color based on tag status - //deprecation remove: The param state will be removed after deprecation - Color getStatusIconColor(OudsTagStatus? state, OudsIconStatus? iconStatus, OudsTagAppearance appearance, bool isEnabled) { + Color getStatusIconColor( + OudsIconStatus? iconStatus, + OudsTagAppearance appearance, + bool isEnabled, + ) { final isEmphasized = appearance == OudsTagAppearance.emphasized; final colorTheme = OudsTheme.of(context).colorScheme(context); if (!isEnabled) { return colorTheme.contentOnActionDisabled; } - - //deprecation remove: will be removed after deprecation - if(state != null) { - switch (state) { - case OudsTagStatus.neutral: - return _getNeutralIconColor(isEmphasized,colorTheme); - case OudsTagStatus.accent: - return _getAccentIconColor(isEmphasized,colorTheme); - case OudsTagStatus.positive: - return _getPositiveIconColor(isEmphasized,colorTheme); - case OudsTagStatus.info: - return _getInfoIconColor(isEmphasized,colorTheme); - case OudsTagStatus.warning: - return _getWarningIconColor(isEmphasized,colorTheme); - case OudsTagStatus.negative: - return _getNegativeIconColor(isEmphasized,colorTheme); - } - }else if(iconStatus != null){ + if (iconStatus != null) { return switch (iconStatus) { - Neutral() => _getNeutralIconColor(isEmphasized,colorTheme), - Accent() => _getAccentIconColor(isEmphasized,colorTheme), - Positive() => _getPositiveIconColor(isEmphasized,colorTheme), - Info() => _getInfoIconColor(isEmphasized,colorTheme), - Warning() => _getWarningIconColor(isEmphasized,colorTheme), - Negative() => _getNegativeIconColor(isEmphasized,colorTheme), + Neutral() => _getNeutralIconColor(isEmphasized, colorTheme), + Accent() => _getAccentIconColor(isEmphasized, colorTheme), + Positive() => _getPositiveIconColor(isEmphasized, colorTheme), + Info() => _getInfoIconColor(isEmphasized, colorTheme), + Warning() => _getWarningIconColor(isEmphasized, colorTheme), + Negative() => _getNegativeIconColor(isEmphasized, colorTheme), }; } @@ -236,79 +193,57 @@ class OudsTagStatusModifier { } /// Returns the icon color for the **neutral** status. - Color _getNeutralIconColor(bool isEmphasized, OudsColorScheme colorTheme){ - return isEmphasized - ? colorTheme.contentInverse - : colorTheme.contentDefault; + Color _getNeutralIconColor(bool isEmphasized, OudsColorScheme colorTheme) { + return isEmphasized ? colorTheme.contentInverse : colorTheme.contentDefault; } /// Returns the icon color for the **accent** status. - Color _getAccentIconColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getAccentIconColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusAccentEmphasized : colorTheme.contentStatusAccent; } /// Returns the icon color for the **positive** status. - Color _getPositiveIconColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getPositiveIconColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusPositiveEmphasized : colorTheme.contentStatusPositive; } /// Returns the icon color for the **info** status. - Color _getInfoIconColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getInfoIconColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusInfoEmphasized : colorTheme.contentStatusInfo; } /// Returns the icon color for the **warning** status. - Color _getWarningIconColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getWarningIconColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusWarningEmphasized : colorTheme.contentStatusWarning; } /// Returns the icon color for the **negative** status. - Color _getNegativeIconColor(bool isEmphasized, OudsColorScheme colorTheme){ + Color _getNegativeIconColor(bool isEmphasized, OudsColorScheme colorTheme) { return isEmphasized ? colorTheme.contentOnStatusNegativeEmphasized : colorTheme.contentStatusNegative; } /// Return the icon based on tag status - //deprecation remove: The param state will be removed after deprecation - String? getStatusIcon(OudsTagStatus? state, OudsIconStatus? iconStatus) { - - //deprecation remove: will be removed after deprecation - if(state != null){ - switch (state) { - case OudsTagStatus.positive: - return AppAssets.icons.componentAlertTickConfirmationFill; - case OudsTagStatus.info: - return AppAssets.icons.componentAlertInformationFill; - case OudsTagStatus.warning: - return AppAssets.icons.componentAlertWarningExternalShape; - case OudsTagStatus.negative: - return AppAssets.icons.componentAlertImportantFill; - case OudsTagStatus.neutral: - case OudsTagStatus.accent: - return null; - } - }else - // Handle the new 'iconStatus' API + String? getStatusIcon(OudsIconStatus? iconStatus) { if (iconStatus != null) { return switch (iconStatus) { - - // For those statuses, the icon is fixed and defined here. + // For those statuses, the icon is fixed and defined here. Positive() => AppAssets.icons.componentAlertTickConfirmationFill, Info() => AppAssets.icons.componentAlertInformationFill, Warning() => AppAssets.icons.componentAlertWarningExternalShape, Negative() => AppAssets.icons.componentAlertImportantFill, - // For the other Accent and Neutral the icon should be defined by user - _ => null + // For the other Accent and Neutral the icon should be defined by user + _ => null, }; } return null; @@ -322,11 +257,11 @@ class OudsTagStatusModifier { // Extract the 'icon' property only from Neutral and Accent types. return switch (iconStatus) { - // If the type is Neutral or Accent, extract the 'icon' value into the 'assets' variable and return it. + // If the type is Neutral or Accent, extract the 'icon' value into the 'assets' variable and return it. Neutral(icon: final assets) => assets, Accent(icon: final assets) => assets, - // For all other status types (Positive, Info, etc.), return null - // as their icons are fixed and not user-defined. + // For all other status types (Positive, Info, etc.), return null + // as their icons are fixed and not user-defined. _ => null, }; } diff --git a/ouds_core/lib/components/tag/internal/ouds_tag_text_style_modifier.dart b/ouds_core/lib/components/tag/internal/ouds_tag_text_style_modifier.dart index c779a81a6..25ca39c1d 100644 --- a/ouds_core/lib/components/tag/internal/ouds_tag_text_style_modifier.dart +++ b/ouds_core/lib/components/tag/internal/ouds_tag_text_style_modifier.dart @@ -26,22 +26,28 @@ class OudsTagStyleModifier { OudsTagStyleModifier(this.context); /// Returns the text style based on tag state for tag text - //deprecation remove: The param state will be removed after deprecation TextStyle buildTagTextStyle({ required OudsTagAppearance appearance, - OudsTagStatus? state, - OudsIconStatus? status, - OudsTagSize? size, - bool isLoading = false, - bool isEnabled = false + OudsIconStatus? status, + OudsTagSize? size, + bool isLoading = false, + bool isEnabled = false, }) { return size == OudsTagSize.defaultSize - ? OudsTheme.of(context).typographyTokens.typeLabelStrongMedium(context).copyWith( - color: OudsTagStatusModifier(context).getStatusTextColor(state, status, appearance,isLoading, isEnabled), - ) - : OudsTheme.of(context).typographyTokens.typeLabelModerateSmall(context).copyWith( - color: OudsTagStatusModifier(context).getStatusTextColor(state, status, appearance,isLoading, isEnabled), - ); + ? OudsTheme.of(context).typographyTokens + .typeLabelStrongMedium(context) + .copyWith( + color: OudsTagStatusModifier( + context, + ).getStatusTextColor(status, appearance, isLoading, isEnabled), + ) + : OudsTheme.of(context).typographyTokens + .typeLabelModerateSmall(context) + .copyWith( + color: OudsTagStatusModifier( + context, + ).getStatusTextColor(status, appearance, isLoading, isEnabled), + ); } /// Returns the text color based on tag state for tag input diff --git a/ouds_core/lib/components/tag/ouds_tag.dart b/ouds_core/lib/components/tag/ouds_tag.dart index f3164ab19..a0104019b 100644 --- a/ouds_core/lib/components/tag/ouds_tag.dart +++ b/ouds_core/lib/components/tag/ouds_tag.dart @@ -28,31 +28,6 @@ import 'package:ouds_theme_contract/ouds_theme.dart'; /// This enum controls whether the tag displays text, an icon, a bullet or loader enum OudsTagLayout { textOnly, textAndBullet, textAndIcon } -/// Enum representing the state of the tag control. -@Deprecated( - 'Use OudsIconStatus instead. This enum will be removed in a future version.', -) -enum OudsTagStatus { neutral, accent, positive, info, warning, negative } - -/// @nodoc -// deprecation remove : this enum is added only to support the deprecated enum and will be removed after deprecation -extension OudsTagStatusConverter on OudsTagStatus { - /// Converts this simple status enum to the corresponding [OudsIconStatus] class instance. - /// - /// Note: For `Neutral` and `Accent`, this conversion does not carry over any - /// custom icon information, as the base enum does not store it. - OudsIconStatus toIconStatus() { - return switch (this) { - OudsTagStatus.neutral => Neutral(), - OudsTagStatus.accent => Accent(), - OudsTagStatus.positive => Positive(), - OudsTagStatus.warning => Warning(), - OudsTagStatus.negative => Negative(), - OudsTagStatus.info => Info(), - }; - } -} - /// The [OudsTagSize] defines the tag's visual size. enum OudsTagSize { defaultSize, small } @@ -77,39 +52,13 @@ enum OudsTagAppearance { emphasized, muted } /// * `OudsTag.bullet`: A tag that includes a bullet point next to the text. /// * `OudsTag.icon`: A tag that displays an icon next to the text. /// -/// This API replaces the previous generic constructor and deprecated status model. -/// -/// --- -/// ### Migrating from the Deprecated API -/// -/// The generic `OudsTag()` constructor, the [status] parameter of type [OudsTagStatus], -/// and the [icon] parameter are now deprecated and will be removed in a future -/// version. Please migrate to the new named constructors and the [status] -/// parameter of type [OudsIconStatus] for a more robust and consolidated API. -/// -/// --- -/// ## Migration overview -/// -/// ### 1) Use named constructors -/// Replace the generic `OudsTag()` -/// constructor with `OudsTag.text()`, `OudsTag.icon()`, or `OudsTag.bullet()` -/// based on your needs. -/// -/// ### 2) Replace `OudsTagStatus` with `OudsIconStatus` -/// Replace the old `OudsTagStatus` enum -/// with the new `OudsIconStatus` classes (e.g., `OudsTagStatus.positive` -/// becomes `Positive()`). -/// -/// ### 3) Remove `icon` parameter -/// The `icon` parameter is deprecated and will be removed. -/// Icon selection must now be driven by `status` (`OudsIconStatus`): +/// Icon selection is driven by `status` (`OudsIconStatus`): /// - Functional statuses (`Positive`, `Info`, `Warning`, `Negative`) provide fixed icons. /// - Contextual statuses (`Neutral`, `Accent`) can carry a custom icon asset. /// /// --- /// ## Status model /// -/// New `status` type: /// - [Neutral] (optional custom icon) /// - [Accent] (optional custom icon) /// - [Positive] (fixed functional icon) @@ -140,27 +89,6 @@ enum OudsTagAppearance { emphasized, muted } /// /// ### Usage Example /// -/// **Migration Example:** -/// -/// **Before (Deprecated API):** -/// ```dart -/// // Simple tag -/// OudsTag( -/// label: 'Old Tag', -/// status: OudsTagStatus.accent, -/// size: OudsTagSize.small, -/// ); -/// -/// // Tag with a custom icon -/// OudsTag( -/// label: 'Custom', -/// layout: OudsTagLayout.textAndIcon, -/// status: OudsTagStatus.neutral, -/// icon: 'assets/custom_icon.svg', -/// ); -/// ``` -/// -/// **After (Modern API):** /// ```dart /// // Simple tag /// OudsTag.text( @@ -184,46 +112,13 @@ enum OudsTagAppearance { emphasized, muted } class OudsTag extends StatefulWidget { final String label; final bool enabled; - @Deprecated( - 'Use status of type OudsIconStatus instead. This parameter will be removed in a future version.', - ) - final OudsTagStatus? _deprecatedStatus; final OudsTagSize? size; final OudsTagAppearance appearance; - @Deprecated( - 'icon is now defined by status (OudsIconStatus). Use Accent(icon: ...) or Neutral(icon: ...) for custom icons.', - ) - final String? icon; final OudsTagLayout layout; final bool loading; final OudsIconStatus? status; final bool roundedCorners; - /// ⚠️ **DEPRECATED:** Use [OudsTag.text], [OudsTag.icon], or [OudsTag.bullet] constructors instead. - @Deprecated( - 'Use named constructors for clarity: OudsTag.text() for text only type, OudsTag.icon() for text and icon type, or OudsTag.bullet() for text and bullet type.' - ' This constructor will be removed in a future version.', - ) - const OudsTag({ - super.key, - required this.label, - this.enabled = true, - @Deprecated( - 'Use iconStatus instead. This parameter will be removed in a future version.', - ) - final OudsTagStatus? status, - this.appearance = OudsTagAppearance.emphasized, - this.size = OudsTagSize.defaultSize, - @Deprecated( - 'icon is now defined by status (OudsIconStatus). Use Accent(icon: ...) or Neutral(icon: ...) for custom icons.', - ) - this.icon, - this.layout = OudsTagLayout.textOnly, - this.loading = false, - this.roundedCorners = true, - }) : _deprecatedStatus = status, - status = null; - const OudsTag.text({ super.key, required this.label, @@ -234,8 +129,7 @@ class OudsTag extends StatefulWidget { this.layout = OudsTagLayout.textOnly, this.loading = false, this.roundedCorners = true, - }) : icon = null, - _deprecatedStatus = null; + }); const OudsTag.bullet({ super.key, @@ -247,8 +141,7 @@ class OudsTag extends StatefulWidget { this.layout = OudsTagLayout.textAndBullet, this.loading = false, this.roundedCorners = true, - }) : icon = null, - _deprecatedStatus = null; + }); const OudsTag.icon({ super.key, @@ -260,17 +153,13 @@ class OudsTag extends StatefulWidget { this.layout = OudsTagLayout.textAndIcon, this.loading = false, this.roundedCorners = true, - }) : icon = null, - _deprecatedStatus = null; + }); @override State createState() => _OudsTagState(); } class _OudsTagState extends State { - OudsIconStatus? get _effectiveStatus => - widget.status ?? widget._deprecatedStatus?.toIconStatus(); - @override void initState() { super.initState(); @@ -339,11 +228,8 @@ class _OudsTagState extends State { }; } - //deprecation remove: The param state will be removed after deprecation Widget _buildIcon( BuildContext context, - String? assetName, - OudsTagStatus? state, OudsIconStatus? status, OudsTagAppearance hierarchy, bool isEnabled, @@ -352,10 +238,9 @@ class _OudsTagState extends State { //get the asset name from status for neutral and accent status (icon defined by user) final assetIconName = statusModifier.getAssetsName(status); - final icon = statusModifier.getStatusIcon(state, status); + final icon = statusModifier.getStatusIcon(status); - if (hierarchy == OudsTagAppearance.muted && - (status is Warning || state == OudsTagStatus.warning)) { + if (hierarchy == OudsTagAppearance.muted && status is Warning) { final iconTokens = OudsTheme.of(context).componentsTokens(context).icon; return Stack( @@ -392,11 +277,11 @@ class _OudsTagState extends State { } return SvgPicture.asset( excludeFromSemantics: true, - icon ?? assetName ?? assetIconName ?? "", + icon ?? assetIconName ?? "", package: icon != null ? OudsTheme.of(context).packageName : null, fit: BoxFit.contain, colorFilter: ColorFilter.mode( - statusModifier.getStatusIconColor(state, status, hierarchy, isEnabled), + statusModifier.getStatusIconColor(status, hierarchy, isEnabled), BlendMode.srcIn, ), ); @@ -459,8 +344,7 @@ class _OudsTagState extends State { textAlign: TextAlign.center, style: tagStyleModifier.buildTagTextStyle( appearance: widget.appearance, - state: widget._deprecatedStatus, - status: _effectiveStatus, + status: widget.status, size: widget.size ?? OudsTagSize.defaultSize, isLoading: widget.loading, isEnabled: widget.enabled, @@ -490,8 +374,7 @@ class _OudsTagState extends State { widget.roundedCorners, ), color: tagStatusModifier.getStatusColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.appearance, widget.enabled, ), @@ -519,9 +402,7 @@ class _OudsTagState extends State { ), child: _buildIcon( context, - widget.icon, - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.appearance, widget.enabled, ), @@ -533,8 +414,7 @@ class _OudsTagState extends State { textAlign: TextAlign.center, style: tagStyleModifier.buildTagTextStyle( appearance: widget.appearance, - state: widget._deprecatedStatus, - status: _effectiveStatus, + status: widget.status, size: widget.size, isEnabled: widget.enabled, ), @@ -564,8 +444,7 @@ class _OudsTagState extends State { widget.roundedCorners, ), color: tagStatusModifier.getStatusColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.appearance, widget.enabled, ), @@ -595,8 +474,7 @@ class _OudsTagState extends State { height: 10, decoration: BoxDecoration( color: tagStatusModifier.getStatusIconColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.appearance, widget.enabled, ), @@ -615,8 +493,7 @@ class _OudsTagState extends State { textAlign: TextAlign.center, style: tagStyleModifier.buildTagTextStyle( appearance: widget.appearance, - state: widget._deprecatedStatus, - status: _effectiveStatus, + status: widget.status, size: widget.size, isEnabled: widget.enabled, ), @@ -650,8 +527,7 @@ class _OudsTagState extends State { minWidthAndHeight[OudsTagDimensions.width.name] ?? 0.0, ), color: tagStatusModifier.getStatusColor( - widget._deprecatedStatus, - _effectiveStatus, + widget.status, widget.appearance, widget.enabled, ), @@ -666,8 +542,7 @@ class _OudsTagState extends State { textAlign: TextAlign.center, style: tagStyleModifier.buildTagTextStyle( appearance: widget.appearance, - state: widget._deprecatedStatus, - status: _effectiveStatus, + status: widget.status, size: widget.size, isEnabled: widget.enabled, ), diff --git a/ouds_core/test/components/navigation/ouds_navigation_bar_a11y_test.dart b/ouds_core/test/components/navigation/ouds_navigation_bar_a11y_test.dart index fc0030ee4..56bfd3134 100644 --- a/ouds_core/test/components/navigation/ouds_navigation_bar_a11y_test.dart +++ b/ouds_core/test/components/navigation/ouds_navigation_bar_a11y_test.dart @@ -95,17 +95,19 @@ void main() { }); }); - // ─── 2. buildNavItemAccessibleLabel (deprecated top-level helper) ───────── + // ─── 2. buildNavItemAccessibleLabel ───────── group('buildNavItemAccessibleLabel', () { test('returns label when no badge', () { // ignore: deprecated_member_use - expect(buildNavItemAccessibleLabel('Profile', null), 'Profile'); + expect( + OudsNavigationBarA11y.buildTabSemanticLabel('Profile', null), + 'Profile', + ); }); test('returns "label, badge" string when badge present', () { expect( - // ignore: deprecated_member_use - buildNavItemAccessibleLabel( + OudsNavigationBarA11y.buildTabSemanticLabel( 'Profile', _badge(contentDescription: '5 alerts'), ), diff --git a/ouds_theme_contract/CHANGELOG.md b/ouds_theme_contract/CHANGELOG.md index c1bf8577d..06826811b 100644 --- a/ouds_theme_contract/CHANGELOG.md +++ b/ouds_theme_contract/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop) ### Added ### Changed +- [Library] Remove deprecated code and API ([#820](https://github.com/Orange-OpenSource/ouds-flutter/issues/820)) - [Library] update tokens 2.5.0 ([#778](https://github.com/Orange-OpenSource/ouds-flutter/issues/778)) - [Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726)) diff --git a/ouds_theme_contract/lib/config/component/ouds_tag_config.dart b/ouds_theme_contract/lib/config/component/ouds_tag_config.dart deleted file mode 100644 index a2cf2cc60..000000000 --- a/ouds_theme_contract/lib/config/component/ouds_tag_config.dart +++ /dev/null @@ -1,20 +0,0 @@ -/* - * // Software Name: OUDS Flutter - * // SPDX-FileCopyrightText: Copyright (c) Orange SA - * // SPDX-License-Identifier: MIT - * // - * // This software is distributed under the MIT license, - * // the text of which is available at https://opensource.org/license/MIT/ - * // or see the "LICENSE" file for more details. - * // - * // Software description: Flutter library of reusable graphical components - * // - */ -@Deprecated('OudsTagConfig is deprecated and will be removed in a future version. Please migrate off of its usage.') -class OudsTagConfig { - final bool? rounded; - - const OudsTagConfig({ - this.rounded = true, - }); -} diff --git a/ouds_theme_contract/lib/config/ouds_theme_config_model.dart b/ouds_theme_contract/lib/config/ouds_theme_config_model.dart index 0600bdfe3..34c23ed15 100644 --- a/ouds_theme_contract/lib/config/ouds_theme_config_model.dart +++ b/ouds_theme_contract/lib/config/ouds_theme_config_model.dart @@ -13,24 +13,15 @@ import 'package:flutter/material.dart'; import 'package:ouds_theme_contract/config/component/ouds_alert_message_config_border.dart'; import 'package:ouds_theme_contract/config/component/ouds_button_config.dart'; -import 'package:ouds_theme_contract/config/component/ouds_tag_config.dart'; import 'package:ouds_theme_contract/config/component/ouds_text_input_config.dart'; class OudsThemeConfigModel extends InheritedWidget { final OudsButtonConfig? button; - @Deprecated( - 'OudsTagConfig is deprecated and will be removed in a future version. Please migrate off of its usage.', - ) - final OudsTagConfig? tag; final OudsTextInputConfig? textInput; final OudsAlertMessageConfig? alertMessage; const OudsThemeConfigModel({ this.button, - @Deprecated( - 'OudsTagConfig is deprecated and will be removed in a future version. Please migrate off of its usage.', - ) - this.tag, this.textInput, this.alertMessage, required super.child, @@ -44,7 +35,6 @@ class OudsThemeConfigModel extends InheritedWidget { @override bool updateShouldNotify(covariant OudsThemeConfigModel oldWidget) { return button != oldWidget.button || - tag != oldWidget.tag || textInput != oldWidget.textInput || alertMessage != oldWidget.alertMessage; } diff --git a/ouds_theme_orange/CHANGELOG.md b/ouds_theme_orange/CHANGELOG.md index ab77f1f22..e89557f54 100644 --- a/ouds_theme_orange/CHANGELOG.md +++ b/ouds_theme_orange/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop) ### Added ### Changed +- [Library] Remove deprecated code and API ([#820](https://github.com/Orange-OpenSource/ouds-flutter/issues/820)) - [Library] update tokens 2.5.0 ([#778](https://github.com/Orange-OpenSource/ouds-flutter/issues/778)) - [Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726)) diff --git a/ouds_theme_orange/lib/orange_theme.dart b/ouds_theme_orange/lib/orange_theme.dart index 3e8f31705..1363731fe 100644 --- a/ouds_theme_orange/lib/orange_theme.dart +++ b/ouds_theme_orange/lib/orange_theme.dart @@ -219,18 +219,7 @@ class OrangeTheme implements OudsThemeContract { /// /// The [orangeFontFamily] parameter specifies the font family to be used throughout /// the theme. - /// - /// **Note:** Omitting the [orangeFontFamily] is deprecated and this parameter will - /// become required in a future version. It is strongly recommended to explicitly - /// provide the font family name obtained from `OrangeFontProvider` to ensure - /// correct font rendering. See the [OrangeTheme] class documentation for - /// detailed instructions on loading the font. - @Deprecated( - 'Creating OrangeTheme() without orangeFontFamily is deprecated. ' - 'This parameter will be required in future versions. ' - 'Use OrangeTheme(fontFamily) instead.', - ) OrangeTheme([this.orangeFontFamily]); @override diff --git a/ouds_theme_orange_compact/CHANGELOG.md b/ouds_theme_orange_compact/CHANGELOG.md index 5daea2173..64a576d13 100644 --- a/ouds_theme_orange_compact/CHANGELOG.md +++ b/ouds_theme_orange_compact/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop) ### Added ### Changed +- [Library] Remove deprecated code and API ([#820](https://github.com/Orange-OpenSource/ouds-flutter/issues/820)) - [Library] update tokens 2.5.0 ([#778](https://github.com/Orange-OpenSource/ouds-flutter/issues/778)) - [Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726)) diff --git a/ouds_theme_orange_compact/lib/orange_compact_theme.dart b/ouds_theme_orange_compact/lib/orange_compact_theme.dart index 7031fa0dc..611780e58 100644 --- a/ouds_theme_orange_compact/lib/orange_compact_theme.dart +++ b/ouds_theme_orange_compact/lib/orange_compact_theme.dart @@ -154,18 +154,6 @@ class OrangeCompactTheme implements OudsThemeContract { /// /// The [orangeFontFamily] parameter specifies the font family to be used throughout /// the theme. - /// - /// **Note:** Omitting the [orangeFontFamily] is deprecated and this parameter will - /// become required in a future version. It is strongly recommended to explicitly - /// provide the font family name obtained from `OrangeFontProvider` to ensure - /// correct font rendering. See the [OrangeCompactTheme] class documentation for - /// detailed instructions on loading the font. - - @Deprecated( - 'Creating OrangeCompactTheme() without orangeFontFamily is deprecated. ' - 'This parameter will be required in future versions. ' - 'Use OrangeCompactTheme(fontFamily) instead.', - ) OrangeCompactTheme([this.orangeFontFamily]); @override