Skip to content

Commit a92d025

Browse files
committed
feat(text-input): update loader component
1 parent ae14501 commit a92d025

4 files changed

Lines changed: 66 additions & 10 deletions

File tree

app/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop)
88
### Added
99
### Changed
10+
- [Library] Update text input component to v1.4 ([#692](https://github.com/Orange-OpenSource/ouds-flutter/issues/692))
1011
- [DemoApp][Library] update tokens 2.5.0 ([#778](https://github.com/Orange-OpenSource/ouds-flutter/issues/778))
1112
- [DemoApp][Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726))
1213

@@ -15,8 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1516
## [1.3.1](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.0...1.3.1) - 2026-05-14
1617
### Added
1718
### Changed
18-
- [DemoApp][Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726))
19-
2019
### Fixed
2120
- [Library] Null check operator used on a null value in all components has isHighContrastEnabled ([#756](https://github.com/Orange-OpenSource/ouds-flutter/issues/756))
2221
- [DemoApp] Layout Overflow on Demo Screen for component version when system font size is increased for accessibility. ([#748](https://github.com/Orange-OpenSource/ouds-flutter/issues/748))

ouds_core/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.1...develop)
88
### Added
99
### Changed
10+
- [Library] Update text input component to v1.4 ([#692](https://github.com/Orange-OpenSource/ouds-flutter/issues/692))
1011
- [Library] update tokens 2.5.0 ([#778](https://github.com/Orange-OpenSource/ouds-flutter/issues/778))
1112
- [Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726))
1213

@@ -15,8 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1516
## [1.3.1](https://github.com/Orange-OpenSource/ouds-flutter/compare/1.3.0...1.3.1) - 2026-05-14
1617
### Added
1718
### Changed
18-
- [Library] update tokens 2.4.0 ([#726](https://github.com/Orange-OpenSource/ouds-flutter/issues/726))
19-
2019
### Fixed
2120
- [Library] Null check operator used on a null value in all components has isHighContrastEnabled ([#756](https://github.com/Orange-OpenSource/ouds-flutter/issues/756))
2221
- [Library] `Pin code input` Paste of less than 4 characters drops or merges characters ([#749](https://github.com/Orange-OpenSource/ouds-flutter/issues/749))
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
/// @nodoc
13+
library;
14+
15+
import 'package:flutter/material.dart';
16+
import 'package:ouds_theme_contract/ouds_theme.dart';
17+
18+
/// A temporary circular progress indicator component
19+
/// used internally by several public components like text input.
20+
class OudsCircularProgressIndicator extends StatelessWidget {
21+
const OudsCircularProgressIndicator({
22+
super.key,
23+
required this.color,
24+
this.progress,
25+
});
26+
27+
final Color color;
28+
29+
/// If null => indeterminate loader
30+
/// If not null => determinate loader
31+
final double? progress;
32+
33+
@override
34+
Widget build(BuildContext context) {
35+
final baseSize = OudsTheme.of(
36+
context,
37+
).componentsTokens(context).button.sizeLoader;
38+
39+
const double baseStrokeWidth = 3;
40+
41+
return ExcludeSemantics(
42+
child: SizedBox(
43+
width: baseSize,
44+
height: baseSize,
45+
child: CircularProgressIndicator(
46+
value: progress,
47+
strokeWidth: baseStrokeWidth,
48+
strokeCap: StrokeCap.square,
49+
backgroundColor: Colors.transparent,
50+
valueColor: AlwaysStoppedAnimation<Color>(color),
51+
),
52+
),
53+
);
54+
}
55+
}

ouds_core/lib/components/form_input/ouds_text_input.dart

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ library;
1515
import 'package:flutter/material.dart';
1616
import 'package:flutter_svg/flutter_svg.dart';
1717
import 'package:ouds_core/components/button/ouds_button.dart';
18+
import 'package:ouds_core/components/circular_progress_indicator/ouds_circular_progress_indicator.dart';
1819
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_background_modifier.dart';
1920
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_border_modifier.dart';
2021
import 'package:ouds_core/components/form_input/internal/modifier/ouds_form_input_foreground_modifier.dart';
@@ -258,6 +259,9 @@ class _OudsTextInputState extends State<OudsTextField> {
258259
final hintLabel = contentText.isEmpty
259260
? widget.decoration.hintText ?? ""
260261
: "";
262+
final loadingLabel = widget.decoration.loader == true
263+
? l10n?.core_common_loading_a11y
264+
: '';
261265

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

274279
return Semantics(
275280
label: semanticsValue,
276-
hint: l10n?.core_common_hint_a11y,
281+
hint: widget.decoration.loader == true ? '' : l10n?.core_common_hint_a11y,
277282
value: isError ? l10n?.core_common_error_a11y : null,
278283
focused: effectiveFocusNode != null,
279284
focusable: true,
@@ -713,12 +718,10 @@ class _OudsTextInputState extends State<OudsTextField> {
713718
mainAxisSize: MainAxisSize.min,
714719
children: [
715720
SizedBox(width: textInput.spaceColumnGapDefault),
716-
SizedBox(
717-
width: buttonTokens.sizeLoader,
718-
height: buttonTokens.sizeLoader,
719-
child: CircularProgressIndicator(
721+
Container(
722+
padding: EdgeInsetsGeometry.all(buttonTokens.spaceInsetIconOnly),
723+
child: OudsCircularProgressIndicator(
720724
color: theme.colorScheme(context).contentDefault,
721-
strokeWidth: 3,
722725
),
723726
),
724727
SizedBox(width: textInput.spacePaddingInlineTrailingAction),

0 commit comments

Comments
 (0)