Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] Update text input component to v1.4 ([#692](https://github.com/Orange-OpenSource/ouds-flutter/issues/692))
- [Library] update `Phone number input` component to v1.3 ([#690](https://github.com/Orange-OpenSource/ouds-flutter/issues/690))
- [Library] update `tag` component to v1.5 ([#694](https://github.com/Orange-OpenSource/ouds-flutter/issues/694))
- [Library] update `input tag` component to v1.2 ([#695](https://github.com/Orange-OpenSource/ouds-flutter/issues/695))
Expand Down
1 change: 1 addition & 0 deletions ouds_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] Update text input component to v1.4 ([#692](https://github.com/Orange-OpenSource/ouds-flutter/issues/692))
- [Library] update `Phone number input` component to v1.3 ([#690](https://github.com/Orange-OpenSource/ouds-flutter/issues/690))
- [Library] update `tag` component to v1.5 ([#694](https://github.com/Orange-OpenSource/ouds-flutter/issues/694))
- [Library] update `input tag` component to v1.2 ([#695](https://github.com/Orange-OpenSource/ouds-flutter/issues/695))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// 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
//

/// @nodoc
library;

import 'package:flutter/material.dart';
import 'package:ouds_theme_contract/ouds_theme.dart';

/// A temporary circular progress indicator component
/// used internally by several public components like text input.
class OudsCircularProgressIndicator extends StatelessWidget {
const OudsCircularProgressIndicator({
super.key,
required this.color,
this.progress,
});

final Color color;

/// If null => indeterminate loader
/// If not null => determinate loader
final double? progress;

@override
Widget build(BuildContext context) {
final baseSize = OudsTheme.of(
context,
).componentsTokens(context).button.sizeLoader;

const double baseStrokeWidth = 3;

return ExcludeSemantics(
child: SizedBox(
width: baseSize,
height: baseSize,
child: CircularProgressIndicator(
value: progress,
strokeWidth: baseStrokeWidth,
strokeCap: StrokeCap.square,
backgroundColor: Colors.transparent,
valueColor: AlwaysStoppedAnimation<Color>(color),
),
),
);
}
}
33 changes: 20 additions & 13 deletions ouds_core/lib/components/form_input/ouds_text_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ library;
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:ouds_core/components/button/ouds_button.dart';
import 'package:ouds_core/components/circular_progress_indicator/ouds_circular_progress_indicator.dart';
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_background_modifier.dart';
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_border_modifier.dart';
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_foreground_modifier.dart';
Expand Down Expand Up @@ -258,6 +259,9 @@ class _OudsTextInputState extends State<OudsTextField> {
final hintLabel = contentText.isEmpty
? widget.decoration.hintText ?? ""
: "";
final loadingLabel = widget.decoration.loader == true
? l10n?.core_common_loading_a11y
: '';

// Build Semantics value
final semanticsValue = [
Expand All @@ -269,11 +273,12 @@ class _OudsTextInputState extends State<OudsTextField> {
helperText,
statusLabel,
hintLabel,
loadingLabel,
].where((s) => s != null && s.isNotEmpty).join(", ");

return Semantics(
label: semanticsValue,
hint: l10n?.core_common_hint_a11y,
hint: widget.decoration.loader == true ? '' : l10n?.core_common_hint_a11y,
value: isError ? l10n?.core_common_error_a11y : null,
focused: effectiveFocusNode != null,
focusable: true,
Expand Down Expand Up @@ -493,7 +498,7 @@ class _OudsTextInputState extends State<OudsTextField> {
controller: widget.controller,
keyboardType: widget.keyboardType,
style: theme.typographyTokens
.typeLabelDefaultLarge(context)
.typeLabelModerateLarge(context)
.copyWith(color: inputTextTextModifier.getTextColor(state, isError)),
enabled: widget.enabled,
readOnly: widget.readOnly ?? false,
Expand Down Expand Up @@ -524,7 +529,7 @@ class _OudsTextInputState extends State<OudsTextField> {
border: InputBorder.none,
// Label text widget, shown if labelText is provided
label: widget.decoration.labelText != null
? ConstrainedBox(
? Container(
constraints: BoxConstraints(
maxHeight: textInput.sizeLabelMaxHeight,
),
Expand Down Expand Up @@ -680,8 +685,7 @@ class _OudsTextInputState extends State<OudsTextField> {
/// Cases handled:
///
/// 1. **Loader active** (`loader == true`):
/// - Displays a minimal hierarchy [OudsButton] in loading style.
/// - Uses `suffixIcon` if provided; otherwise, reserves space with an empty 24×24 box.
/// - Displays a circular loading indicator.
///
/// 2. **Suffix icon provided** (`suffixIcon != null`):
/// - Displays the suffix icon inside a minimal hierarchy [OudsButton].
Expand All @@ -703,6 +707,7 @@ class _OudsTextInputState extends State<OudsTextField> {
) {
final theme = OudsTheme.of(context);
final textInput = theme.componentsTokens(context).textInput;
final buttonTokens = theme.componentsTokens(context).button;
final inputTextForegroundModifier = OudsFormFieldsForegroundColorModifier(
context,
);
Expand All @@ -715,15 +720,17 @@ class _OudsTextInputState extends State<OudsTextField> {
SizedBox(width: textInput.spaceColumnGapDefault),
ConstrainedBox(
constraints: BoxConstraints(
minHeight: 0,
maxHeight: double.infinity,
minWidth: buttonTokens.sizeMinWidth,
minHeight: buttonTokens.sizeMinHeight,
maxHeight: buttonTokens.sizeMaxHeightIconOnly,
),
child: OudsButton(
icon: AppAssets.icons.functionalSocialAndEngagementHeartEmpty,
package: OudsTheme.of(context).packageName,
appearance: OudsButtonAppearance.minimal,
loader: Loader(progress: null),
onPressed: () {},
child: Padding(
padding: EdgeInsetsGeometry.all(buttonTokens.spaceInsetIconOnly),
child: Center(
child: OudsCircularProgressIndicator(
color: theme.colorScheme(context).contentDefault,
),
),
),
),
],
Expand Down
Loading