Skip to content

Commit 7f4f52b

Browse files
committed
Merge branch 'main' into sync-develop-main-1.0.0
# Conflicts: # NOTICE.txt # app/CHANGELOG.md # app/assets/orange/functional/social-and-engagement/heart-empty.svg # app/assets/sosh/functional/social-and-engagement/heart-empty.svg # app/lib/l10n/gen/ouds_flutter_app_localizations.dart # app/lib/l10n/gen/ouds_flutter_app_localizations_ar.dart # app/lib/l10n/gen/ouds_flutter_app_localizations_en.dart # app/lib/l10n/ouds_flutter_ar.arb # app/lib/l10n/ouds_flutter_en.arb # app/lib/ui/about/about_screen.dart # app/lib/ui/components/badge/badge_customization_utils.dart # app/lib/ui/components/badge/badge_demo_screen.dart # app/lib/ui/components/button/button_demo_screen.dart # app/lib/ui/components/checkbox/checkbox_item_demo_screen.dart # app/lib/ui/components/chip/chip_filter_demo_sreen.dart # app/lib/ui/components/chip/chip_suggestion_demo_screen.dart # app/lib/ui/components/components.dart # app/lib/ui/components/control_item/control_item_code_generator.dart # app/lib/ui/components/control_item/control_item_customization.dart # app/lib/ui/components/divider/divider_demo_screen.dart # app/lib/ui/components/form_input/form_fields_code_generator.dart # app/lib/ui/components/form_input/form_fields_customization.dart # app/lib/ui/components/form_input/password_input/password_input_demo_screen.dart # app/lib/ui/components/form_input/text_input/text_input_demo_screen.dart # app/lib/ui/components/link/link_demo_screen.dart # app/lib/ui/components/pin_code_input/pin_code_input_customization.dart # app/lib/ui/components/pin_code_input/pin_code_input_demo_screen.dart # app/lib/ui/components/pin_code_input/pin_code_input_enum.dart # app/lib/ui/components/radio_button/radio_button_item_demo_screen.dart # app/lib/ui/components/switch/switch_item_demo_screen.dart # app/lib/ui/components/tag/input_tag_demo_screen.dart # app/lib/ui/components/tag/tag_demo_screen.dart # app/lib/ui/components/tag/tag_enum.dart # app/lib/ui/utilities/app_assets.dart # app/lib/ui/utilities/environment.dart # app/lib/ui/utilities/reference_design_version_component.dart # app/lib/ui/utilities/theme_colored_box.dart # app/pubspec.yaml # ouds_core/CHANGELOG.md # ouds_core/README.md # ouds_core/dartdoc_options.yaml # ouds_core/lib/components/badge/internal/ouds_badge_size_modifier.dart # ouds_core/lib/components/badge/internal/ouds_badge_status_modifier.dart # ouds_core/lib/components/badge/ouds_badge.dart # ouds_core/lib/components/button/ouds_button.dart # ouds_core/lib/components/checkbox/ouds_checkbox.dart # ouds_core/lib/components/checkbox/ouds_checkbox_item.dart # ouds_core/lib/components/chip/ouds_filter_chip.dart # ouds_core/lib/components/chip/ouds_suggestion_chip.dart # ouds_core/lib/components/common/OudsBorder.dart # ouds_core/lib/components/control/ouds_control_item.dart # ouds_core/lib/components/divider/ouds_divider.dart # ouds_core/lib/components/form_input/internal/modifier/ouds_form_input_background_modifier.dart # ouds_core/lib/components/form_input/internal/modifier/ouds_form_input_border_modifier.dart # ouds_core/lib/components/form_input/internal/modifier/ouds_form_input_foreground_modifier.dart # ouds_core/lib/components/form_input/internal/modifier/ouds_form_input_text_modifier.dart # ouds_core/lib/components/form_input/internal/ouds_form_input_decoration.dart # ouds_core/lib/components/form_input/ouds_text_input.dart # ouds_core/lib/components/form_input/password_input/ouds_password_input.dart # ouds_core/lib/components/form_input/password_input/ouds_password_input_decoration.dart # ouds_core/lib/components/link/ouds_link.dart # ouds_core/lib/components/pin_code_input/digit_input/ouds_digit_input.dart # ouds_core/lib/components/pin_code_input/ouds_pin_code_input.dart # ouds_core/lib/components/radio_button/ouds_radio_button.dart # ouds_core/lib/components/radio_button/ouds_radio_button_item.dart # ouds_core/lib/components/switch/ouds_switch.dart # ouds_core/lib/components/switch/ouds_switch_item.dart # ouds_core/lib/components/tag/internal/ouds_tag_status_modifier.dart # ouds_core/lib/components/tag/ouds_input_tag.dart # ouds_core/lib/components/tag/ouds_tag.dart # ouds_core/lib/components/utilities/app_assets.dart # ouds_core/lib/l10n/gen/ouds_localizations.dart # ouds_core/lib/l10n/gen/ouds_localizations_ar.dart # ouds_core/lib/l10n/gen/ouds_localizations_en.dart # ouds_core/lib/l10n/ouds_flutter_ar.arb # ouds_core/lib/l10n/ouds_flutter_en.arb # ouds_core/pubspec.yaml # ouds_global_raw_tokens/CHANGELOG.md # ouds_global_raw_tokens/README.md # ouds_global_raw_tokens/pubspec.yaml # ouds_theme_contract/CHANGELOG.md # ouds_theme_contract/README.md # ouds_theme_contract/lib/ouds_component_version.dart # ouds_theme_contract/lib/ouds_tokens_version.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_badge_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_bar_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_buttonMono_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_button_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_checkbox_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_chip_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_components_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_controlItem_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_divider_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_linkMono_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_link_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_pinCodeInput_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_radioButton_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_skeleton_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_switch_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_tag_tokens.dart # ouds_theme_contract/lib/theme/tokens/components/ouds_textInput_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_border_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_action_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_always_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_bg_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_border_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_content_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_opacity_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_overlay_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_repository_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_color_surface_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_effect_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_font_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_grid_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_opacity_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_size_semantic_tokens.dart # ouds_theme_contract/lib/theme/tokens/semantic/ouds_space_semantic_tokens.dart # ouds_theme_contract/pubspec.yaml # ouds_theme_orange/CHANGELOG.md # ouds_theme_orange/README.md # ouds_theme_orange/assets/component/alert/warning-external-shape.svg # ouds_theme_orange/assets/component/alert/warning-internal-shape.svg # ouds_theme_orange/assets/component/alert/warning.svg # ouds_theme_orange/assets/functional/social-and-engagement/heart-empty.svg # ouds_theme_orange/lib/components/orange_badge_tokens.dart # ouds_theme_orange/lib/components/orange_bar_tokens.dart # ouds_theme_orange/lib/components/orange_buttonMono_tokens.dart # ouds_theme_orange/lib/components/orange_button_tokens.dart # ouds_theme_orange/lib/components/orange_checkbox_tokens.dart # ouds_theme_orange/lib/components/orange_chip_tokens.dart # ouds_theme_orange/lib/components/orange_controlItem_tokens.dart # ouds_theme_orange/lib/components/orange_divider_tokens.dart # ouds_theme_orange/lib/components/orange_linkMono_tokens.dart # ouds_theme_orange/lib/components/orange_link_tokens.dart # ouds_theme_orange/lib/components/orange_pinCodeInput_tokens.dart # ouds_theme_orange/lib/components/orange_radioButton_tokens.dart # ouds_theme_orange/lib/components/orange_skeleton_tokens.dart # ouds_theme_orange/lib/components/orange_switch_tokens.dart # ouds_theme_orange/lib/components/orange_tag_tokens.dart # ouds_theme_orange/lib/components/orange_textInput_tokens.dart # ouds_theme_orange/lib/orange_theme.dart # ouds_theme_orange/lib/semantic/orange_border_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_action_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_always_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_bg_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_border_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_content_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_opacity_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_overlay_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_repository_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_color_surface_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_effect_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_font_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_grid_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_opacity_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_size_semantic_tokens.dart # ouds_theme_orange/lib/semantic/orange_space_semantic_tokens.dart # ouds_theme_orange/pubspec.yaml # ouds_theme_sosh/CHANGELOG.md # ouds_theme_sosh/README.md # ouds_theme_sosh/assets/component/alert/warning-external-shape.svg # ouds_theme_sosh/assets/component/alert/warning-internal-shape.svg # ouds_theme_sosh/assets/component/alert/warning.svg # ouds_theme_sosh/assets/component/radio-button/radio-button-selected.svg # ouds_theme_sosh/assets/functional/social-and-engagement/heart-empty.svg # ouds_theme_sosh/lib/components/sosh_badge_tokens.dart # ouds_theme_sosh/lib/components/sosh_bar_tokens.dart # ouds_theme_sosh/lib/components/sosh_buttonMono_tokens.dart # ouds_theme_sosh/lib/components/sosh_button_tokens.dart # ouds_theme_sosh/lib/components/sosh_checkbox_tokens.dart # ouds_theme_sosh/lib/components/sosh_chip_tokens.dart # ouds_theme_sosh/lib/components/sosh_controlItem_tokens.dart # ouds_theme_sosh/lib/components/sosh_divider_tokens.dart # ouds_theme_sosh/lib/components/sosh_linkMono_tokens.dart # ouds_theme_sosh/lib/components/sosh_link_tokens.dart # ouds_theme_sosh/lib/components/sosh_pinCodeInput_tokens.dart # ouds_theme_sosh/lib/components/sosh_radioButton_tokens.dart # ouds_theme_sosh/lib/components/sosh_skeleton_tokens.dart # ouds_theme_sosh/lib/components/sosh_switch_tokens.dart # ouds_theme_sosh/lib/components/sosh_tag_tokens.dart # ouds_theme_sosh/lib/components/sosh_textInput_tokens.dart # ouds_theme_sosh/lib/ouds_theme_sosh.dart # ouds_theme_sosh/lib/semantic/sosh_border_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_action_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_always_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_bg_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_border_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_content_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_opacity_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_overlay_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_repository_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_color_surface_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_effect_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_font_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_grid_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_opacity_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_size_semantic_tokens.dart # ouds_theme_sosh/lib/semantic/sosh_space_semantic_tokens.dart # ouds_theme_sosh/pubspec.yaml # ouds_theme_white_label/lib/semantic/white_label_border_semantic_tokens.dart # ouds_theme_wireframe/CHANGELOG.md # ouds_theme_wireframe/README.md # ouds_theme_wireframe/assets/component/alert/warning-external-shape.svg # ouds_theme_wireframe/assets/component/alert/warning-internal-shape.svg # ouds_theme_wireframe/assets/component/alert/warning.svg # ouds_theme_wireframe/lib/components/wireframe_badge_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_bar_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_buttonMono_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_button_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_checkbox_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_chip_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_controlItem_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_divider_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_linkMono_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_link_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_pinCodeInput_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_radioButton_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_skeleton_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_switch_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_tag_tokens.dart # ouds_theme_wireframe/lib/components/wireframe_textInput_tokens.dart # ouds_theme_wireframe/lib/ouds_theme_wireframe.dart # ouds_theme_wireframe/lib/semantic/wireframe_border_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_action_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_always_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_bg_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_border_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_content_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_opacity_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_overlay_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_repository_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_color_surface_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_effect_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_font_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_grid_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_opacity_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_size_semantic_tokens.dart # ouds_theme_wireframe/lib/semantic/wireframe_space_semantic_tokens.dart # ouds_theme_wireframe/pubspec.yaml # pubspec.lock
2 parents 5c99256 + 93ddc89 commit 7f4f52b

File tree

67 files changed

+566
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+566
-1
lines changed
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// Software Name: OUDS Flutter
3+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
// SPDX-License-Identifier: MIT
5+
//
6+
// This software is distributed under the MIT license,
7+
// the text of which is available at https://opensource.org/license/MIT/
8+
// or see the "LICENSE" file for more details.
9+
//
10+
// Software description: Flutter library of reusable graphical components
11+
//
12+
13+
import 'package:flutter/material.dart';
14+
import 'package:ouds_theme_contract/ouds_theme.dart';
15+
import 'package:ouds_core/components/control/internal/ouds_chip_control_state.dart';
16+
17+
/// Used to apply the right background color associated to the state
18+
class OudsChipControlBackgroundColorModifier {
19+
20+
final BuildContext context;
21+
22+
OudsChipControlBackgroundColorModifier(this.context);
23+
24+
Color getBackgroundColor(OudsChipControlState state){
25+
26+
final chipToken = OudsTheme.of(context).componentsTokens(context).chip;
27+
28+
switch (state) {
29+
case OudsChipControlState.enabled:
30+
return chipToken.colorBgUnselectedEnabled;
31+
case OudsChipControlState.disabled:
32+
return chipToken.colorBgUnselectedDisabled;
33+
case OudsChipControlState.hovered:
34+
return chipToken.colorBgUnselectedHover;
35+
case OudsChipControlState.pressed:
36+
return chipToken.colorBgUnselectedPressed;
37+
case OudsChipControlState.focused:
38+
return chipToken.colorBgUnselectedFocus;
39+
case OudsChipControlState.selected:
40+
return chipToken.colorBgSelectedEnabled;
41+
}
42+
}
43+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//
2+
// Software Name: OUDS Flutter
3+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
4+
// SPDX-License-Identifier: MIT
5+
//
6+
// This software is distributed under the MIT license,
7+
// the text of which is available at https://opensource.org/license/MIT/
8+
// or see the "LICENSE" file for more details.
9+
//
10+
// Software description: Flutter library of reusable graphical components
11+
//
12+
13+
import 'package:flutter/material.dart';
14+
import 'package:ouds_theme_contract/ouds_theme.dart';
15+
import 'package:ouds_core/components/control/internal/ouds_chip_control_state.dart';
16+
17+
18+
/// A class that provides the border color for the OudsChip based on its state
19+
class OudsChipControlBorderModifier {
20+
final BuildContext context;
21+
22+
OudsChipControlBorderModifier(this.context);
23+
24+
/// Gets the borderSide based on the indicator state
25+
BoxBorder getBorder(OudsChipControlState state) {
26+
27+
final chipToken = OudsTheme.of(context).componentsTokens(context).chip;
28+
29+
switch (state) {
30+
case OudsChipControlState.enabled:
31+
return Border.all(
32+
color: chipToken.colorBorderUnselectedEnabled,
33+
width: chipToken.borderWidthUnselected
34+
);
35+
case OudsChipControlState.disabled:
36+
return Border.all(
37+
color: chipToken.colorBorderUnselectedDisabled,
38+
width: chipToken.borderWidthUnselected
39+
);
40+
case OudsChipControlState.hovered:
41+
return Border.all(
42+
color: chipToken.colorBorderUnselectedHover,
43+
width: chipToken.borderWidthUnselectedInteraction
44+
);
45+
case OudsChipControlState.pressed:
46+
return Border.all(
47+
color: chipToken.colorBorderUnselectedPressed,
48+
width: chipToken.borderWidthUnselectedInteraction
49+
);
50+
case OudsChipControlState.focused:
51+
return Border.all(
52+
color: chipToken.colorBorderUnselectedFocus,
53+
width: chipToken.borderWidthUnselectedInteraction
54+
);
55+
case OudsChipControlState.selected:
56+
return Border.all(
57+
color: chipToken.colorBorderSelectedEnabled,
58+
width: chipToken.borderWidthSelected
59+
);
60+
}
61+
62+
}
63+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:ouds_theme_contract/ouds_theme.dart';
3+
import 'package:ouds_core/components/control/internal/ouds_chip_control_state.dart';
4+
5+
class OudsChipControlIconColorModifier {
6+
final BuildContext context;
7+
8+
OudsChipControlIconColorModifier(this.context);
9+
10+
Color getIconColor(OudsChipControlState state){
11+
12+
final chipToken = OudsTheme.of(context).componentsTokens(context).chip;
13+
14+
switch (state) {
15+
case OudsChipControlState.enabled:
16+
return chipToken.colorContentUnselectedEnabled;
17+
case OudsChipControlState.disabled:
18+
return chipToken.colorContentUnselectedDisabled;
19+
case OudsChipControlState.hovered:
20+
return chipToken.colorContentUnselectedHover;
21+
case OudsChipControlState.pressed:
22+
return chipToken.colorContentUnselectedPressed;
23+
case OudsChipControlState.focused:
24+
return chipToken.colorContentUnselectedFocus;
25+
case OudsChipControlState.selected:
26+
return chipToken.colorContentUnselectedEnabled;
27+
}
28+
}
29+
30+
Color getTickColor(OudsChipControlState state){
31+
32+
final chipToken = OudsTheme.of(context).componentsTokens(context).chip;
33+
34+
switch (state) {
35+
case OudsChipControlState.enabled:
36+
return chipToken.colorContentSelectedTickEnabled;
37+
case OudsChipControlState.disabled:
38+
return chipToken.colorContentSelectedDisabled;
39+
case OudsChipControlState.hovered:
40+
return chipToken.colorContentSelectedHover;
41+
case OudsChipControlState.pressed:
42+
return chipToken.colorContentSelectedPressed;
43+
case OudsChipControlState.focused:
44+
return chipToken.colorContentSelectedFocus;
45+
case OudsChipControlState.selected:
46+
return chipToken.colorContentSelectedTickEnabled;
47+
}
48+
}
49+
50+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:ouds_theme_contract/ouds_theme.dart';
3+
import 'package:ouds_core/components/control/internal/ouds_chip_control_state.dart';
4+
5+
class OudsChipControlTextColorModifier {
6+
final BuildContext context;
7+
8+
OudsChipControlTextColorModifier(this.context);
9+
10+
Color getTextColor(OudsChipControlState state){
11+
12+
final chipToken = OudsTheme.of(context).componentsTokens(context).chip;
13+
14+
switch (state) {
15+
case OudsChipControlState.enabled:
16+
return chipToken.colorContentUnselectedEnabled;
17+
case OudsChipControlState.disabled:
18+
return chipToken.colorContentUnselectedDisabled;
19+
case OudsChipControlState.hovered:
20+
return chipToken.colorContentUnselectedHover;
21+
case OudsChipControlState.pressed:
22+
return chipToken.colorContentUnselectedPressed;
23+
case OudsChipControlState.focused:
24+
return chipToken.colorContentUnselectedFocus;
25+
case OudsChipControlState.selected:
26+
return chipToken.colorContentSelectedEnabled;
27+
}
28+
}
29+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Software Name: OUDS Flutter
2+
// SPDX-FileCopyrightText: Copyright (c) Orange SA
3+
// SPDX-License-Identifier: MIT
4+
//
5+
// This software is distributed under the MIT license,
6+
// the text of which is available at https://opensource.org/license/MIT/
7+
// or see the "LICENSE" file for more details.
8+
//
9+
// Software description: Flutter library of reusable graphical components
10+
//
11+
12+
/// Enum representing the state of the chip control.
13+
enum OudsChipControlState {
14+
enabled,
15+
hovered,
16+
pressed,
17+
disabled,
18+
focused,
19+
selected
20+
}
21+
22+
/// A class that determines the state of the OudsChip
23+
class OudsChipControlStateDeterminer {
24+
final bool enabled;
25+
final bool isHovered;
26+
final bool isPressed;
27+
final bool isFocused;
28+
final bool isSelected;
29+
30+
OudsChipControlStateDeterminer({
31+
required this.enabled,
32+
this.isHovered = false,
33+
this.isPressed = false,
34+
this.isFocused = false,
35+
this.isSelected = false,
36+
37+
});
38+
39+
/// Determines the current material state of the control.
40+
OudsChipControlState determineControlState() {
41+
if (!enabled) return OudsChipControlState.disabled;
42+
if (isPressed) return OudsChipControlState.pressed;
43+
if (isHovered) return OudsChipControlState.hovered;
44+
if (isFocused) return OudsChipControlState.focused;
45+
if (isSelected) return OudsChipControlState.selected;
46+
return OudsChipControlState.enabled;
47+
}
48+
}

0 commit comments

Comments
 (0)