Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d7cefdc
chore : add radius-item-only token : radio/checkbo
Tayebsed93 Nov 17, 2025
8c78194
chore : checkbox
Tayebsed93 Nov 17, 2025
f02fa81
chore : radio button
Tayebsed93 Nov 17, 2025
2a7a475
chore : switch
Tayebsed93 Nov 17, 2025
d27b2fd
chore : l10n description
Tayebsed93 Nov 17, 2025
08aceeb
update : helper text to description control item
Tayebsed93 Nov 17, 2025
ce84df8
chore : new token read only
Tayebsed93 Nov 17, 2025
0bb386c
chore : add CHANGELOG
Tayebsed93 Nov 17, 2025
4b31015
chore : doc readOnly code
Tayebsed93 Nov 17, 2025
81b2fe1
Merge branch 'develop' into 437-component-update-standalone-checkbox-…
Tayebsed93 Nov 18, 2025
97fee74
add errror message and update additional text
Tayebsed93 Nov 18, 2025
f497375
fix : conditional error text message in demo app
Tayebsed93 Nov 18, 2025
3378fdf
fix : add getErrorMessageTextColor function token
Tayebsed93 Nov 18, 2025
dd03453
add icon error
Tayebsed93 Nov 18, 2025
4842793
chore : add changelog
Tayebsed93 Nov 18, 2025
60f31ef
chore : delete readOnly inherited interaction
Tayebsed93 Nov 19, 2025
1d1c191
Merge branch 'develop' into 437-component-update-standalone-checkbox-…
Tayebsed93 Nov 19, 2025
b5dbe35
chore : add error message and fix icon when error
Tayebsed93 Nov 20, 2025
549bdf2
fix : read only on tap
Tayebsed93 Nov 20, 2025
98b3884
review : fix padding inline horizontal
Tayebsed93 Nov 21, 2025
7a55f22
fix : delete padding horizontal behind component
Tayebsed93 Nov 24, 2025
632d675
chore : add grid margin token
Tayebsed93 Nov 24, 2025
30f9645
fix : accessibility ghost doc app demo
Tayebsed93 Nov 26, 2025
5d191c7
fix : delete security margin app demo
Tayebsed93 Nov 26, 2025
25cfa91
fix : token grid margin
Tayebsed93 Nov 26, 2025
e20a091
review : design 25/11 padding indicator and error
Tayebsed93 Nov 26, 2025
fa822ad
Merge branch 'develop' into 437-component-update-standalone-checkbox-…
Tayebsed93 Nov 26, 2025
4519f13
fix : change additionnal label to extra label
Tayebsed93 Nov 26, 2025
bee29bd
review : add helvetica neue font family ios orange
Tayebsed93 Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [DemoApp][Library] Tokens: `link` and `linkMono` ([#390](https://github.com/Orange-OpenSource/ouds-flutter/issues/#390))

### Changed
- [DemoApp][Library] Component Update - Standalone checkbox and radio button rounded corners ([#466](https://github.com/Orange-OpenSource/ouds-flutter/issues/437))
- [DemoApp][Library] Component Update - Radio button v1.4.0 ([#466](https://github.com/Orange-OpenSource/ouds-flutter/issues/467))
- [DemoApp][Library] Component Update - Switch v1.5.0 ([#466](https://github.com/Orange-OpenSource/ouds-flutter/issues/466))
- [DemoApp][Library] Component Update - Checkbox v2.4.0 ([#465](https://github.com/Orange-OpenSource/ouds-flutter/issues/465))
- [DemoApp][Library] Component Update - Update of radio item v1.3.0 ([#433](https://github.com/Orange-OpenSource/ouds-flutter/issues/433))
- [DemoApp][Library] Component Update - Update switch item to v1.4.0 ([#434](https://github.com/Orange-OpenSource/ouds-flutter/issues/434))
- [DemoApp][Library] Component Update - Update checkbox item to v2.3.0 ([#431](https://github.com/Orange-OpenSource/ouds-flutter/issues/431))
- [DemoApp][Library] Update `badge` component (badge, badge count, badge icon (v1.2) ([#423](https://github.com/Orange-OpenSource/ouds-flutter/issues/#423))
- [DemoApp][Library] Update of `button` version v3.1 ([#396](https://github.com/Orange-OpenSource/ouds-flutter/issues/396))
- [DemoApp][Library] Use Solaris icons ([#245](https://github.com/Orange-OpenSource/ouds-flutter/issues/245))
Expand Down
18 changes: 12 additions & 6 deletions app/lib/l10n/gen/ouds_flutter_app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ abstract class AppLocalizations {
/// **'Error'**
String get app_components_common_error_label;

/// No description provided for @app_components_common_error_message.
///
/// In en, this message translates to:
/// **'Error message'**
String get app_components_common_error_message;

/// No description provided for @app_components_common_layout_label.
///
/// In en, this message translates to:
Expand Down Expand Up @@ -563,11 +569,11 @@ abstract class AppLocalizations {
/// **'Indeterminate checkbox item'**
String get app_components_checkbox_indeterminateCheckboxItem_label;

/// No description provided for @app_components_controlItem_helperText_label.
/// No description provided for @app_components_controlItem_description_label.
///
/// In en, this message translates to:
/// **'Helper text'**
String get app_components_controlItem_helperText_label;
/// **'Description'**
String get app_components_controlItem_description_label;

/// No description provided for @app_components_controlItem_icon_label.
///
Expand Down Expand Up @@ -653,11 +659,11 @@ abstract class AppLocalizations {
/// **'Outlined'**
String get app_components_radioButton_radioButtonItem_outlined_label;

/// No description provided for @app_components_radioButton_radioButtonItem_additionalLabel_label.
/// No description provided for @app_components_radioButton_radioButtonItem_extraLabel_label.
///
/// In en, this message translates to:
/// **'Additional text'**
String get app_components_radioButton_radioButtonItem_additionalLabel_label;
/// **'Extra label'**
String get app_components_radioButton_radioButtonItem_extraLabel_label;

/// No description provided for @app_components_switch_label.
///
Expand Down
9 changes: 6 additions & 3 deletions app/lib/l10n/gen/ouds_flutter_app_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get app_components_common_error_label => 'خطأ';

@override
String get app_components_common_error_message => 'رسالة خطأ';

@override
String get app_components_common_layout_label => 'التخطيط';

Expand Down Expand Up @@ -255,7 +258,7 @@ class AppLocalizationsAr extends AppLocalizations {
'عنصر خانة اختيار ثلاثية الحالات';

@override
String get app_components_controlItem_helperText_label => 'نص مساعد';
String get app_components_controlItem_description_label => 'الوصف';

@override
String get app_components_controlItem_icon_label => 'أيقونة';
Expand Down Expand Up @@ -304,8 +307,8 @@ class AppLocalizationsAr extends AppLocalizations {
'مُحَدَّد بخط';

@override
String get app_components_radioButton_radioButtonItem_additionalLabel_label =>
'نص إضافي';
String get app_components_radioButton_radioButtonItem_extraLabel_label =>
'تسمية اضافية';

@override
String get app_components_switch_label => 'مفتاح التبديل';
Expand Down
9 changes: 6 additions & 3 deletions app/lib/l10n/gen/ouds_flutter_app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get app_components_common_error_label => 'Error';

@override
String get app_components_common_error_message => 'Error message';

@override
String get app_components_common_layout_label => 'Layout';

Expand Down Expand Up @@ -254,7 +257,7 @@ class AppLocalizationsEn extends AppLocalizations {
'Indeterminate checkbox item';

@override
String get app_components_controlItem_helperText_label => 'Helper text';
String get app_components_controlItem_description_label => 'Description';

@override
String get app_components_controlItem_icon_label => 'Icon';
Expand Down Expand Up @@ -304,8 +307,8 @@ class AppLocalizationsEn extends AppLocalizations {
'Outlined';

@override
String get app_components_radioButton_radioButtonItem_additionalLabel_label =>
'Additional text';
String get app_components_radioButton_radioButtonItem_extraLabel_label =>
'Extra label';

@override
String get app_components_switch_label => 'Switch';
Expand Down
5 changes: 3 additions & 2 deletions app/lib/l10n/ouds_flutter_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@_components": {},
"app_components_common_color_label": "اللون",
"app_components_common_error_label": "خطأ",
"app_components_common_error_message": "رسالة خطأ",
"app_components_common_layout_label": "التخطيط",
"app_components_common_textOnlyLayout_label": "نص فقط",
"app_components_common_iconAndTextLayout_label": "نص + أيقونة",
Expand Down Expand Up @@ -93,7 +94,7 @@
"app_components_checkbox_indeterminateCheckboxItem_label": "عنصر خانة اختيار ثلاثية الحالات",

"@_components_control_item (common strings for checkbox/radio/switch items)": {},
"app_components_controlItem_helperText_label": "نص مساعد",
"app_components_controlItem_description_label": "الوصف",
"app_components_controlItem_icon_label": "أيقونة",
"app_components_controlItem_readOnly_label": "للقراءة فقط",
"app_components_controlItem_divider_label": "فاصل",
Expand All @@ -112,7 +113,7 @@
"app_components_radioButton_radioButton_label": "زر الاختيار",
"app_components_radioButton_radioButtonItem_label": "عنصر زر الاختيار",
"app_components_radioButton_radioButtonItem_outlined_label": "مُحَدَّد بخط",
"app_components_radioButton_radioButtonItem_additionalLabel_label": "نص إضافي",
"app_components_radioButton_radioButtonItem_extraLabel_label": "تسمية اضافية",

"@_components_switch": {},
"app_components_switch_label": "مفتاح التبديل",
Expand Down
5 changes: 3 additions & 2 deletions app/lib/l10n/ouds_flutter_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"@_components": {},
"app_components_common_color_label": "Color",
"app_components_common_error_label": "Error",
"app_components_common_error_message": "Error message",
"app_components_common_layout_label": "Layout",
"app_components_common_textOnlyLayout_label": "Text only",
"app_components_common_iconAndTextLayout_label": "Text + Icon",
Expand Down Expand Up @@ -129,7 +130,7 @@
"app_components_checkbox_indeterminateCheckboxItem_label": "Indeterminate checkbox item",

"@_components_control_item (common strings for checkbox/radio/switch items)": {},
"app_components_controlItem_helperText_label": "Helper text",
"app_components_controlItem_description_label": "Description",
"app_components_controlItem_icon_label": "Icon",
"app_components_controlItem_readOnly_label": "Read only",
"app_components_controlItem_divider_label": "Divider",
Expand All @@ -148,7 +149,7 @@
"app_components_radioButton_radioButton_label": "Radio button",
"app_components_radioButton_radioButtonItem_label": "Radio Button Item",
"app_components_radioButton_radioButtonItem_outlined_label": "Outlined",
"app_components_radioButton_radioButtonItem_additionalLabel_label": "Additional text",
"app_components_radioButton_radioButtonItem_extraLabel_label": "Extra label",

"@_components_switch": {},
"app_components_switch_label": "Switch",
Expand Down
68 changes: 36 additions & 32 deletions app/lib/ui/components/checkbox/checkbox_code_generator.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Software Name: OUDS Flutter
// SPDX-FileCopyrightText: Copyright (c) Orange SA
// SPDX-License-Identifier: MIT
Expand All @@ -16,45 +15,50 @@ import 'package:ouds_flutter_demo/ui/components/checkbox/checkbox_customization.
///
/// The CheckboxCodeGenerator class is responsible for dynamically generating Flutter
/// code for the customization of a checkbox component. It leverages the checkbox's
/// customization state, specifically the enabled and error states, and generates
/// the corresponding code in string format, which can be used for rendering or
/// previewing the checkbox with the selected properties.
/// customization state, specifically the enabled, error, read-only, and tristate states,
/// and generates the corresponding code in string format, which can be used for rendering
/// or previewing the checkbox with the selected properties.
///
class CheckboxCodeGenerator {
// Static method to generate the code based on checkbox customization state
/// Static method to generate the code based on checkbox customization state.
static String updateCode(BuildContext context, bool indeterminate) {
// Get the text value for the checkbox from customization state
String value = 'isChecked';

return """OudsCheckbox(\nvalue: $value,\n${disableCode(context)}\n${errorCode(context)}${tristateCode(context, indeterminate)}""";
}

// Method to generate the disable code for the checkbox onChanged callback
static String disableCode(BuildContext context) {
final CheckboxCustomizationState? customizationState = CheckboxCustomization.of(context);

// Return the onChanged callback code with its enabled or disabled state
return "onChanged: ${customizationState?.hasEnabled == true ? "(bool? value) { \n"
"setState(() {\n "
"isChecked = value;\n "
"});\n}" : 'null'},";
}
// Base list for building the checkbox code dynamically.
final List<String> code = [];
code.add('OudsCheckbox(');
code.add(' value: isChecked,');

// Method to generate the error code for the checkbox
static String errorCode(BuildContext context) {
final CheckboxCustomizationState? customizationState = CheckboxCustomization.of(context);
// Add the onChanged callback only when enabled.
if (customizationState?.hasEnabled == true) {
code.add(' onChanged: (bool? value) {');
code.add(' setState(() {');
code.add(' isChecked = value;');
code.add(' });');
code.add(' },');
} else {
code.add(' onChanged: null,');
}

// Return the isError property based on the customization state
return 'isError: ${customizationState?.hasError == true ? 'true' : 'false'},';
}
// Add the isError property only when true.
if (customizationState?.hasError == true) {
code.add(' isError: true,');
}

// Add the readOnly property only when true.
if (customizationState?.hasReadOnly == true) {
code.add(' readOnly: true,');
}

// Method to generate the tristate code for the checkbox
static String tristateCode(BuildContext context, bool indeterminate) {
String end = """\n);""";
if (indeterminate == false) {
return end;
// Add tristate only when indeterminate is true.
if (indeterminate) {
code.add(' tristate: true,');
}
// Return the tristate property based on the indeterminate state
return "\ntristate: $indeterminate, $end";

// End of the widget declaration.
code.add(');');

// Return the formatted code as a single string.
return code.join('\n');
}
}
68 changes: 68 additions & 0 deletions app/lib/ui/components/checkbox/checkbox_customization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,25 @@ class CheckboxCustomization extends StatefulWidget {
/// Button customization state management
class CheckboxCustomizationState extends CustomizationWidgetState<CheckboxCustomization> {
late final ErrorState errorState;
late final ReadOnlyState readOnly;

@override
void initState() {
super.initState();
errorState = ErrorState(setState, enabledState);
readOnly = ReadOnlyState(setState);
}

// Proxy getters and setters to expose state values directly
bool get hasError => errorState.value;
set hasError(bool value) => errorState.value = value;

// Proxy getters and setters to expose state values directly
@override
bool get hasReadOnly => readOnly.value;
@override
set hasReadOnly(bool value) => readOnly.value = value;

// Getter to determine if the 'Enabled' state should be disabled based on the 'Error' state.
bool get isEnabledWhenError {
return CheckboxErrorCases.isEnabledWhenError(errorState.value);
Expand All @@ -55,6 +63,21 @@ class CheckboxCustomizationState extends CustomizationWidgetState<CheckboxCustom
return CheckboxErrorCases.isErrorWhenEnabled(hasEnabled);
}

// Getter to determine if the 'Enabled' state should be disabled based on the current 'Error' state.
bool get isReadOnlyWhenError {
return CheckboxErrorCases.isReadOnlyWhenError(errorState.value);
}

// Getter to determine if the 'ReadOnly' state should be disabled based on the current 'Enabled' state.
bool get isReadOnlyWhenEnabled {
return CheckboxErrorCases.isReadOnlyWhenEnabled(hasEnabled);
}

// Getter to determine if the 'Error' state should be disabled based on the 'Enabled' state.
bool get isErrorWhenReadOnly {
return CheckboxErrorCases.isErrorWhenReadOnly(hasReadOnly);
}

@override
Widget build(BuildContext context) {
return _CheckboxCustomization(
Expand All @@ -80,6 +103,21 @@ class ErrorState {
}
}

/// ReadOnly State Management
class ReadOnlyState {
ReadOnlyState(this._setState);

final void Function(void Function()) _setState;
bool _hasReadOnly = false;

bool get value => _hasReadOnly;
set value(bool newValue) {
_setState(() {
_hasReadOnly = newValue;
});
}
}

/// Error handling for specific button behavior
class CheckboxErrorCases {
/// Checks if the 'Enabled' button should be enabled based on the 'error' parameter.
Expand All @@ -101,4 +139,34 @@ class CheckboxErrorCases {
static bool isErrorWhenEnabled(bool hasEnabled) {
return !hasEnabled;
}

/// Determines if the control item should be read-only based on the 'hasError' parameter.
///
/// Behavior: The control item is read-only if 'hasError' is true.
///
/// @param [hasError] Indicates whether an error is present (true) or not (false).
/// @return true if the control item should be read-only, otherwise false.
static bool isReadOnlyWhenError(bool hasError) {
return hasError;
}

/// Checks if the 'ReadOnly' control item should be disabled when the 'Enabled' control item is activated.
///
/// Behavior: The 'ReadOnly' control item is disabled if 'hasEnabled' is false.
///
/// @param [hasEnabled] Indicates whether the 'Enabled' control item is activated (true) or not (false).
/// @return true if the 'ReadOnly' control item should be disabled, otherwise false.
static bool isReadOnlyWhenEnabled(bool hasEnabled) {
return !hasEnabled;
}

/// Checks if the 'Error' control item should be activated based on the 'hasReadOnly' parameter.
///
/// Behavior: The 'Error' control item is activated if 'hasReadOnly' is true.
///
/// @param [hasReadOnly] Indicates whether the control item is read-only (true) or not (false).
/// @return true if the 'Error' control item should be activated, otherwise false.
static bool isErrorWhenReadOnly(bool hasReadOnly) {
return hasReadOnly;
}
}
Loading
Loading