Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 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
### Added

### Changed
- [DemoApp][Library] update tokens 1.9.0 - Component Alert ([#672](https://github.com/Orange-OpenSource/ouds-flutter/issues/672))

### Fixed

Expand All @@ -21,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [Library] Manage Helvetica Neue Arabic font ([#404](https://github.com/Orange-OpenSource/ouds-flutter/issues/404))

### Changed
- [Tool] improve dartDoc permissions ([#664](https://github.com/Orange-OpenSource/ouds-flutter/issues/664))
- [Tool] Improve OSSF score ([#659](https://github.com/Orange-OpenSource/ouds-flutter/issues/659))
- [DemoApp][Library] Downgrade to Flutter SDK 3.35 and update documentation ([#656](https://github.com/Orange-OpenSource/ouds-flutter/issues/656))
- [DemoApp] Unused dependency detected in Flutter demo app ([#646](https://github.com/Orange-OpenSource/ouds-flutter/issues/646))
- [DemoApp][Library] Remove OudsTagConfig and add rounded corner into `Tag` ([#598](https://github.com/Orange-OpenSource/ouds-flutter/issues/598))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ import 'package:provider/provider.dart';

class PasswordInputDemoScreen extends StatefulWidget {
final String? previousPageTitle;
const PasswordInputDemoScreen({super.key,this.previousPageTitle});
const PasswordInputDemoScreen({super.key, this.previousPageTitle});

@override
State<PasswordInputDemoScreen> createState() => _PasswordInputDemoScreenState();
State<PasswordInputDemoScreen> createState() =>
_PasswordInputDemoScreenState();
}

class _PasswordInputDemoScreenState extends State<PasswordInputDemoScreen> {
Expand All @@ -60,13 +61,18 @@ class _PasswordInputDemoScreenState extends State<PasswordInputDemoScreen> {
key: _scaffoldKey,
inputType: FormFieldsTypeEnum.passwordInput,
child: Padding(
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
padding: EdgeInsets.only(
bottom: defaultTargetPlatform == TargetPlatform.android
? MediaQuery.of(context).viewPadding.bottom
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
),
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: MainAppBar(
showBackButton: true,
title: context.l10n.app_components_passwordInput_label,
previousPageTitle: widget.previousPageTitle),
showBackButton: true,
title: context.l10n.app_components_passwordInput_label,
previousPageTitle: widget.previousPageTitle,
),
bottomSheet: OudsSheetsBottom(
onExpansionChanged: _onExpansionChanged,
sheetContent: const _CustomizationContent(),
Expand All @@ -93,20 +99,29 @@ class _Body extends StatefulWidget {
class _BodyState extends State<_Body> {
@override
Widget build(BuildContext context) {
final themeController = Provider.of<ThemeController>(context, listen: false);
final themeController = Provider.of<ThemeController>(
context,
listen: false,
);
return DetailScreenDescription(
description: context.l10n.app_components_passwordInput_description_text,
widget: Column(
children: [
const _TextInputDemo(),
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
SizedBox(
height: themeController.currentTheme
.spaceScheme(context)
.fixedMedium,
),
Code(
code: FormFieldsCodeGenerator.updateCode(
context,
FormFieldsTypeEnum.passwordInput,
),
),
ReferenceDesignVersionComponent(version: OudsComponentVersion.textInput),
ReferenceDesignVersionComponent(
version: OudsComponentVersion.passwordInput,
),
],
),
);
Expand Down Expand Up @@ -163,7 +178,9 @@ class _TextInputDemoState extends State<_TextInputDemo> {

@override
Widget build(BuildContext context) {
final customizationState = FormFieldsCustomization.of(context)!; // safe to use !
final customizationState = FormFieldsCustomization.of(
context,
)!; // safe to use !

return LightDarkBox(
hasConstrainedMaxWidthOption: true,
Expand All @@ -180,15 +197,35 @@ class _TextInputDemoState extends State<_TextInputDemo> {
///
},
decoration: OudsPasswordInputDecoration(
labelText: customizationState.labelText.isNotEmpty ? FormFieldsCustomizationUtils.getLabelText(customizationState) : null,
helperText: customizationState.helperText.isNotEmpty ? FormFieldsCustomizationUtils.getHelperText(customizationState) : null,
hintText: customizationState.placeholderText.isNotEmpty ? FormFieldsCustomizationUtils.getPlaceholderText(customizationState) : null,
labelText: customizationState.labelText.isNotEmpty
? FormFieldsCustomizationUtils.getLabelText(
customizationState,
)
: null,
helperText: customizationState.helperText.isNotEmpty
? FormFieldsCustomizationUtils.getHelperText(
customizationState,
)
: null,
hintText: customizationState.placeholderText.isNotEmpty
? FormFieldsCustomizationUtils.getPlaceholderText(
customizationState,
)
: null,
prefixIcon: customizationState.hasLeadingIcon,
prefix: customizationState.prefixText.isNotEmpty ? FormFieldsCustomizationUtils.getPrefixText(customizationState) : null,
errorText: customizationState.hasError ? context.l10n.app_components_passwordInput_error_label : null,
prefix: customizationState.prefixText.isNotEmpty
? FormFieldsCustomizationUtils.getPrefixText(
customizationState,
)
: null,
errorText: customizationState.hasError
? context.l10n.app_components_passwordInput_error_label
: null,
loader: customizationState.hasLoader,
outlined: customizationState.hasOutlined,
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth ? true : false,
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth
? true
: false,
),
),
],
Expand Down Expand Up @@ -250,13 +287,12 @@ class _CustomizationContentState extends State<_CustomizationContent> {
title: context.l10n.app_common_enabled_label,
value: customizationState.hasEnabled,
onChanged:

/// Specific case: The switch is disabled if there is an error (hasError is true).
customizationState.isEnabledWhenError == true
? null // Disable the switch if there is an error
: (value) {
customizationState.hasEnabled = value;
},
? null // Disable the switch if there is an error
: (value) {
customizationState.hasEnabled = value;
},
),
CustomizableSwitch(
title: context.l10n.app_components_common_readOnly_label,
Expand All @@ -270,7 +306,10 @@ class _CustomizationContentState extends State<_CustomizationContent> {
CustomizableSwitch(
title: context.l10n.app_components_common_error_label,
value: customizationState.hasError,
onChanged: customizationState.isErrorWhenEnabled || customizationState.isErrorWhenLoader || customizationState.isErrorWhenReadOnly
onChanged:
customizationState.isErrorWhenEnabled ||
customizationState.isErrorWhenLoader ||
customizationState.isErrorWhenReadOnly
? null
: (value) {
customizationState.hasError = value;
Expand All @@ -287,7 +326,9 @@ class _CustomizationContentState extends State<_CustomizationContent> {
title: context.l10n.app_components_common_loader_label,
value: customizationState.hasLoader,
// The switch is disabled when the user is not typing
onChanged: (!customizationState.isTyping || customizationState.isLoaderWhenError)
onChanged:
(!customizationState.isTyping ||
customizationState.isLoaderWhenError)
? null
: (value) {
customizationState.hasLoader = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ import 'package:provider/provider.dart';

class PhoneNumberInputDemoScreen extends StatefulWidget {
final String? previousPageTitle;
const PhoneNumberInputDemoScreen({super.key,this.previousPageTitle});
const PhoneNumberInputDemoScreen({super.key, this.previousPageTitle});

@override
State<PhoneNumberInputDemoScreen> createState() => _PhoneNumberInputDemoScreenState();
State<PhoneNumberInputDemoScreen> createState() =>
_PhoneNumberInputDemoScreenState();
}

class _PhoneNumberInputDemoScreenState extends State<PhoneNumberInputDemoScreen> {
class _PhoneNumberInputDemoScreenState
extends State<PhoneNumberInputDemoScreen> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
bool _isBottomSheetExpanded = true;

Expand All @@ -63,7 +65,11 @@ class _PhoneNumberInputDemoScreenState extends State<PhoneNumberInputDemoScreen>
key: _scaffoldKey,
inputType: FormFieldsTypeEnum.phoneNumberInput,
child: Padding(
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
padding: EdgeInsets.only(
bottom: defaultTargetPlatform == TargetPlatform.android
? MediaQuery.of(context).viewPadding.bottom
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
),
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: MainAppBar(
Expand Down Expand Up @@ -97,20 +103,30 @@ class _Body extends StatefulWidget {
class _BodyState extends State<_Body> {
@override
Widget build(BuildContext context) {
final themeController = Provider.of<ThemeController>(context, listen: false);
final themeController = Provider.of<ThemeController>(
context,
listen: false,
);
return DetailScreenDescription(
description: context.l10n.app_components_phoneNumberInput_description_text,
description:
context.l10n.app_components_phoneNumberInput_description_text,
widget: Column(
children: [
const _PhoneNumberInputDemo(),
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
SizedBox(
height: themeController.currentTheme
.spaceScheme(context)
.fixedMedium,
),
Code(
code: FormFieldsCodeGenerator.updateCode(
context,
FormFieldsTypeEnum.phoneNumberInput,
),
),
ReferenceDesignVersionComponent(version: OudsComponentVersion.textInput),
ReferenceDesignVersionComponent(
version: OudsComponentVersion.phoneNumberInput,
),
],
),
);
Expand Down Expand Up @@ -183,7 +199,9 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {

@override
Widget build(BuildContext context) {
final customizationState = FormFieldsCustomization.of(context)!; // safe to use !
final customizationState = FormFieldsCustomization.of(
context,
)!; // safe to use !
final themeController = Provider.of<ThemeController>(context, listen: true);

return LightDarkBox(
Expand All @@ -195,7 +213,8 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {
readOnly: customizationState.hasReadOnly,
countrySelector: customizationState.hasCountrySelector
? CountrySelector(
readOnly: customizationState.isCountrySelectorWhenReadOnlyAndEnable,
readOnly:
customizationState.isCountrySelectorWhenReadOnlyAndEnable,
countryFilter: CountryFilter.all,
//codes: ["fr", "tn", "us"],
selectedCountry: selectedCountry,
Expand All @@ -209,16 +228,32 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {
///
},
decoration: OudsInputDecoration(
labelText: customizationState.labelText.isNotEmpty ? FormFieldsCustomizationUtils.getLabelText(customizationState) : null,
helperText: customizationState.helperText.isNotEmpty ? FormFieldsCustomizationUtils.getHelperText(customizationState) : null,
hintText: customizationState.placeholderText.isNotEmpty ? FormFieldsCustomizationUtils.getPlaceholderText(customizationState) : null,
prefix: customizationState.prefixText.isNotEmpty ? FormFieldsCustomizationUtils.getPrefixText(customizationState) : null,
labelText: customizationState.labelText.isNotEmpty
? FormFieldsCustomizationUtils.getLabelText(customizationState)
: null,
helperText: customizationState.helperText.isNotEmpty
? FormFieldsCustomizationUtils.getHelperText(customizationState)
: null,
hintText: customizationState.placeholderText.isNotEmpty
? FormFieldsCustomizationUtils.getPlaceholderText(
customizationState,
)
: null,
prefix: customizationState.prefixText.isNotEmpty
? FormFieldsCustomizationUtils.getPrefixText(customizationState)
: null,
hasPrefix: customizationState.hasPrefix,
prefixIcon: customizationState.hasLeadingIcon ? AppAssets.icons.deviceSmartphone(themeController) : null,
errorText: customizationState.hasError ? context.l10n.app_components_phoneNumberInput_error_label : null,
prefixIcon: customizationState.hasLeadingIcon
? AppAssets.icons.deviceSmartphone(themeController)
: null,
errorText: customizationState.hasError
? context.l10n.app_components_phoneNumberInput_error_label
: null,
loader: customizationState.hasLoader,
outlined: customizationState.hasOutlined,
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth ? true : false,
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth
? true
: false,
),
),
);
Expand Down Expand Up @@ -278,13 +313,12 @@ class _CustomizationContentState extends State<_CustomizationContent> {
title: context.l10n.app_common_enabled_label,
value: customizationState.hasEnabled,
onChanged:

/// Specific case: The switch is disabled if there is an error (hasError is true).
customizationState.isEnabledWhenError == true
? null // Disable the switch if there is an error
: (value) {
customizationState.hasEnabled = value;
},
? null // Disable the switch if there is an error
: (value) {
customizationState.hasEnabled = value;
},
),
CustomizableSwitch(
title: context.l10n.app_components_common_readOnly_label,
Expand All @@ -298,21 +332,27 @@ class _CustomizationContentState extends State<_CustomizationContent> {
CustomizableSwitch(
title: context.l10n.app_components_common_error_label,
value: customizationState.hasError,
onChanged: customizationState.isErrorWhenEnabled || customizationState.isErrorWhenLoader || customizationState.isErrorWhenReadOnly
onChanged:
customizationState.isErrorWhenEnabled ||
customizationState.isErrorWhenLoader ||
customizationState.isErrorWhenReadOnly
? null
: (value) {
customizationState.hasError = value;
},
),
CustomizableSwitch(
title: context.l10n.app_components_textInput_leadingIcon_label,
value: !customizationState.hasCountrySelector,
onChanged: (value) {
customizationState.hasLeadingIcon = value;
customizationState.hasCountrySelector = !value;
}),
title: context.l10n.app_components_textInput_leadingIcon_label,
value: !customizationState.hasCountrySelector,
onChanged: (value) {
customizationState.hasLeadingIcon = value;
customizationState.hasCountrySelector = !value;
},
),
CustomizableSwitch(
title: context.l10n.app_components_phoneNumberInput_country_selector_label,
title: context
.l10n
.app_components_phoneNumberInput_country_selector_label,
value: !customizationState.hasLeadingIcon,
onChanged: (value) {
customizationState.hasCountrySelector = value;
Expand All @@ -329,7 +369,11 @@ class _CustomizationContentState extends State<_CustomizationContent> {
CustomizableSwitch(
title: context.l10n.app_components_common_loader_label,
value: customizationState.hasLoader,
onChanged: customizationState.isLoaderWhenError || !customizationState.isTyping || customizationState.isLoaderWhenEnabled || customizationState.isEnabledWhenPlaceHolderIsNotEmpty
onChanged:
customizationState.isLoaderWhenError ||
!customizationState.isTyping ||
customizationState.isLoaderWhenEnabled ||
customizationState.isEnabledWhenPlaceHolderIsNotEmpty
? null
: (value) {
customizationState.hasLoader = value;
Expand Down
1 change: 1 addition & 0 deletions ouds_core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

### Changed
- [DemoApp][Library] update tokens 1.9.0 - Component Alert ([#672](https://github.com/Orange-OpenSource/ouds-flutter/issues/672))

### Fixed

Expand Down
Loading
Loading