Skip to content

Commit 3bebb6a

Browse files
committed
chore: update component input with their version
1 parent f979b2c commit 3bebb6a

4 files changed

Lines changed: 166 additions & 80 deletions

File tree

app/lib/ui/components/form_input/password_input/password_input_demo_screen.dart

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ import 'package:provider/provider.dart';
3737

3838
class PasswordInputDemoScreen extends StatefulWidget {
3939
final String? previousPageTitle;
40-
const PasswordInputDemoScreen({super.key,this.previousPageTitle});
40+
const PasswordInputDemoScreen({super.key, this.previousPageTitle});
4141

4242
@override
43-
State<PasswordInputDemoScreen> createState() => _PasswordInputDemoScreenState();
43+
State<PasswordInputDemoScreen> createState() =>
44+
_PasswordInputDemoScreenState();
4445
}
4546

4647
class _PasswordInputDemoScreenState extends State<PasswordInputDemoScreen> {
@@ -60,13 +61,18 @@ class _PasswordInputDemoScreenState extends State<PasswordInputDemoScreen> {
6061
key: _scaffoldKey,
6162
inputType: FormFieldsTypeEnum.passwordInput,
6263
child: Padding(
63-
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
64+
padding: EdgeInsets.only(
65+
bottom: defaultTargetPlatform == TargetPlatform.android
66+
? MediaQuery.of(context).viewPadding.bottom
67+
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
68+
),
6469
child: Scaffold(
6570
extendBodyBehindAppBar: true,
6671
appBar: MainAppBar(
67-
showBackButton: true,
68-
title: context.l10n.app_components_passwordInput_label,
69-
previousPageTitle: widget.previousPageTitle),
72+
showBackButton: true,
73+
title: context.l10n.app_components_passwordInput_label,
74+
previousPageTitle: widget.previousPageTitle,
75+
),
7076
bottomSheet: OudsSheetsBottom(
7177
onExpansionChanged: _onExpansionChanged,
7278
sheetContent: const _CustomizationContent(),
@@ -93,20 +99,29 @@ class _Body extends StatefulWidget {
9399
class _BodyState extends State<_Body> {
94100
@override
95101
Widget build(BuildContext context) {
96-
final themeController = Provider.of<ThemeController>(context, listen: false);
102+
final themeController = Provider.of<ThemeController>(
103+
context,
104+
listen: false,
105+
);
97106
return DetailScreenDescription(
98107
description: context.l10n.app_components_passwordInput_description_text,
99108
widget: Column(
100109
children: [
101110
const _TextInputDemo(),
102-
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
111+
SizedBox(
112+
height: themeController.currentTheme
113+
.spaceScheme(context)
114+
.fixedMedium,
115+
),
103116
Code(
104117
code: FormFieldsCodeGenerator.updateCode(
105118
context,
106119
FormFieldsTypeEnum.passwordInput,
107120
),
108121
),
109-
ReferenceDesignVersionComponent(version: OudsComponentVersion.textInput),
122+
ReferenceDesignVersionComponent(
123+
version: OudsComponentVersion.passwordInput,
124+
),
110125
],
111126
),
112127
);
@@ -163,7 +178,9 @@ class _TextInputDemoState extends State<_TextInputDemo> {
163178

164179
@override
165180
Widget build(BuildContext context) {
166-
final customizationState = FormFieldsCustomization.of(context)!; // safe to use !
181+
final customizationState = FormFieldsCustomization.of(
182+
context,
183+
)!; // safe to use !
167184

168185
return LightDarkBox(
169186
hasConstrainedMaxWidthOption: true,
@@ -180,15 +197,35 @@ class _TextInputDemoState extends State<_TextInputDemo> {
180197
///
181198
},
182199
decoration: OudsPasswordInputDecoration(
183-
labelText: customizationState.labelText.isNotEmpty ? FormFieldsCustomizationUtils.getLabelText(customizationState) : null,
184-
helperText: customizationState.helperText.isNotEmpty ? FormFieldsCustomizationUtils.getHelperText(customizationState) : null,
185-
hintText: customizationState.placeholderText.isNotEmpty ? FormFieldsCustomizationUtils.getPlaceholderText(customizationState) : null,
200+
labelText: customizationState.labelText.isNotEmpty
201+
? FormFieldsCustomizationUtils.getLabelText(
202+
customizationState,
203+
)
204+
: null,
205+
helperText: customizationState.helperText.isNotEmpty
206+
? FormFieldsCustomizationUtils.getHelperText(
207+
customizationState,
208+
)
209+
: null,
210+
hintText: customizationState.placeholderText.isNotEmpty
211+
? FormFieldsCustomizationUtils.getPlaceholderText(
212+
customizationState,
213+
)
214+
: null,
186215
prefixIcon: customizationState.hasLeadingIcon,
187-
prefix: customizationState.prefixText.isNotEmpty ? FormFieldsCustomizationUtils.getPrefixText(customizationState) : null,
188-
errorText: customizationState.hasError ? context.l10n.app_components_passwordInput_error_label : null,
216+
prefix: customizationState.prefixText.isNotEmpty
217+
? FormFieldsCustomizationUtils.getPrefixText(
218+
customizationState,
219+
)
220+
: null,
221+
errorText: customizationState.hasError
222+
? context.l10n.app_components_passwordInput_error_label
223+
: null,
189224
loader: customizationState.hasLoader,
190225
outlined: customizationState.hasOutlined,
191-
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth ? true : false,
226+
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth
227+
? true
228+
: false,
192229
),
193230
),
194231
],
@@ -250,13 +287,12 @@ class _CustomizationContentState extends State<_CustomizationContent> {
250287
title: context.l10n.app_common_enabled_label,
251288
value: customizationState.hasEnabled,
252289
onChanged:
253-
254290
/// Specific case: The switch is disabled if there is an error (hasError is true).
255291
customizationState.isEnabledWhenError == true
256-
? null // Disable the switch if there is an error
257-
: (value) {
258-
customizationState.hasEnabled = value;
259-
},
292+
? null // Disable the switch if there is an error
293+
: (value) {
294+
customizationState.hasEnabled = value;
295+
},
260296
),
261297
CustomizableSwitch(
262298
title: context.l10n.app_components_common_readOnly_label,
@@ -270,7 +306,10 @@ class _CustomizationContentState extends State<_CustomizationContent> {
270306
CustomizableSwitch(
271307
title: context.l10n.app_components_common_error_label,
272308
value: customizationState.hasError,
273-
onChanged: customizationState.isErrorWhenEnabled || customizationState.isErrorWhenLoader || customizationState.isErrorWhenReadOnly
309+
onChanged:
310+
customizationState.isErrorWhenEnabled ||
311+
customizationState.isErrorWhenLoader ||
312+
customizationState.isErrorWhenReadOnly
274313
? null
275314
: (value) {
276315
customizationState.hasError = value;
@@ -287,7 +326,9 @@ class _CustomizationContentState extends State<_CustomizationContent> {
287326
title: context.l10n.app_components_common_loader_label,
288327
value: customizationState.hasLoader,
289328
// The switch is disabled when the user is not typing
290-
onChanged: (!customizationState.isTyping || customizationState.isLoaderWhenError)
329+
onChanged:
330+
(!customizationState.isTyping ||
331+
customizationState.isLoaderWhenError)
291332
? null
292333
: (value) {
293334
customizationState.hasLoader = value;

app/lib/ui/components/form_input/phone_number/phone_number_input_demo_screen.dart

Lines changed: 75 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ import 'package:provider/provider.dart';
4040

4141
class PhoneNumberInputDemoScreen extends StatefulWidget {
4242
final String? previousPageTitle;
43-
const PhoneNumberInputDemoScreen({super.key,this.previousPageTitle});
43+
const PhoneNumberInputDemoScreen({super.key, this.previousPageTitle});
4444

4545
@override
46-
State<PhoneNumberInputDemoScreen> createState() => _PhoneNumberInputDemoScreenState();
46+
State<PhoneNumberInputDemoScreen> createState() =>
47+
_PhoneNumberInputDemoScreenState();
4748
}
4849

49-
class _PhoneNumberInputDemoScreenState extends State<PhoneNumberInputDemoScreen> {
50+
class _PhoneNumberInputDemoScreenState
51+
extends State<PhoneNumberInputDemoScreen> {
5052
final _scaffoldKey = GlobalKey<ScaffoldState>();
5153
bool _isBottomSheetExpanded = true;
5254

@@ -63,7 +65,11 @@ class _PhoneNumberInputDemoScreenState extends State<PhoneNumberInputDemoScreen>
6365
key: _scaffoldKey,
6466
inputType: FormFieldsTypeEnum.phoneNumberInput,
6567
child: Padding(
66-
padding: EdgeInsets.only(bottom: defaultTargetPlatform == TargetPlatform.android ? MediaQuery.of(context).viewPadding.bottom : OudsTheme.of(context).spaceScheme(context).paddingBlockNone),
68+
padding: EdgeInsets.only(
69+
bottom: defaultTargetPlatform == TargetPlatform.android
70+
? MediaQuery.of(context).viewPadding.bottom
71+
: OudsTheme.of(context).spaceScheme(context).paddingBlockNone,
72+
),
6773
child: Scaffold(
6874
extendBodyBehindAppBar: true,
6975
appBar: MainAppBar(
@@ -97,20 +103,30 @@ class _Body extends StatefulWidget {
97103
class _BodyState extends State<_Body> {
98104
@override
99105
Widget build(BuildContext context) {
100-
final themeController = Provider.of<ThemeController>(context, listen: false);
106+
final themeController = Provider.of<ThemeController>(
107+
context,
108+
listen: false,
109+
);
101110
return DetailScreenDescription(
102-
description: context.l10n.app_components_phoneNumberInput_description_text,
111+
description:
112+
context.l10n.app_components_phoneNumberInput_description_text,
103113
widget: Column(
104114
children: [
105115
const _PhoneNumberInputDemo(),
106-
SizedBox(height: themeController.currentTheme.spaceScheme(context).fixedMedium),
116+
SizedBox(
117+
height: themeController.currentTheme
118+
.spaceScheme(context)
119+
.fixedMedium,
120+
),
107121
Code(
108122
code: FormFieldsCodeGenerator.updateCode(
109123
context,
110124
FormFieldsTypeEnum.phoneNumberInput,
111125
),
112126
),
113-
ReferenceDesignVersionComponent(version: OudsComponentVersion.textInput),
127+
ReferenceDesignVersionComponent(
128+
version: OudsComponentVersion.phoneNumberInput,
129+
),
114130
],
115131
),
116132
);
@@ -183,7 +199,9 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {
183199

184200
@override
185201
Widget build(BuildContext context) {
186-
final customizationState = FormFieldsCustomization.of(context)!; // safe to use !
202+
final customizationState = FormFieldsCustomization.of(
203+
context,
204+
)!; // safe to use !
187205
final themeController = Provider.of<ThemeController>(context, listen: true);
188206

189207
return LightDarkBox(
@@ -195,7 +213,8 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {
195213
readOnly: customizationState.hasReadOnly,
196214
countrySelector: customizationState.hasCountrySelector
197215
? CountrySelector(
198-
readOnly: customizationState.isCountrySelectorWhenReadOnlyAndEnable,
216+
readOnly:
217+
customizationState.isCountrySelectorWhenReadOnlyAndEnable,
199218
countryFilter: CountryFilter.all,
200219
//codes: ["fr", "tn", "us"],
201220
selectedCountry: selectedCountry,
@@ -209,16 +228,32 @@ class _PhoneNumberInputDemoState extends State<_PhoneNumberInputDemo> {
209228
///
210229
},
211230
decoration: OudsInputDecoration(
212-
labelText: customizationState.labelText.isNotEmpty ? FormFieldsCustomizationUtils.getLabelText(customizationState) : null,
213-
helperText: customizationState.helperText.isNotEmpty ? FormFieldsCustomizationUtils.getHelperText(customizationState) : null,
214-
hintText: customizationState.placeholderText.isNotEmpty ? FormFieldsCustomizationUtils.getPlaceholderText(customizationState) : null,
215-
prefix: customizationState.prefixText.isNotEmpty ? FormFieldsCustomizationUtils.getPrefixText(customizationState) : null,
231+
labelText: customizationState.labelText.isNotEmpty
232+
? FormFieldsCustomizationUtils.getLabelText(customizationState)
233+
: null,
234+
helperText: customizationState.helperText.isNotEmpty
235+
? FormFieldsCustomizationUtils.getHelperText(customizationState)
236+
: null,
237+
hintText: customizationState.placeholderText.isNotEmpty
238+
? FormFieldsCustomizationUtils.getPlaceholderText(
239+
customizationState,
240+
)
241+
: null,
242+
prefix: customizationState.prefixText.isNotEmpty
243+
? FormFieldsCustomizationUtils.getPrefixText(customizationState)
244+
: null,
216245
hasPrefix: customizationState.hasPrefix,
217-
prefixIcon: customizationState.hasLeadingIcon ? AppAssets.icons.deviceSmartphone(themeController) : null,
218-
errorText: customizationState.hasError ? context.l10n.app_components_phoneNumberInput_error_label : null,
246+
prefixIcon: customizationState.hasLeadingIcon
247+
? AppAssets.icons.deviceSmartphone(themeController)
248+
: null,
249+
errorText: customizationState.hasError
250+
? context.l10n.app_components_phoneNumberInput_error_label
251+
: null,
219252
loader: customizationState.hasLoader,
220253
outlined: customizationState.hasOutlined,
221-
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth ? true : false,
254+
constrainedMaxWidth: customizationState.hasConstrainedMaxWidth
255+
? true
256+
: false,
222257
),
223258
),
224259
);
@@ -278,13 +313,12 @@ class _CustomizationContentState extends State<_CustomizationContent> {
278313
title: context.l10n.app_common_enabled_label,
279314
value: customizationState.hasEnabled,
280315
onChanged:
281-
282316
/// Specific case: The switch is disabled if there is an error (hasError is true).
283317
customizationState.isEnabledWhenError == true
284-
? null // Disable the switch if there is an error
285-
: (value) {
286-
customizationState.hasEnabled = value;
287-
},
318+
? null // Disable the switch if there is an error
319+
: (value) {
320+
customizationState.hasEnabled = value;
321+
},
288322
),
289323
CustomizableSwitch(
290324
title: context.l10n.app_components_common_readOnly_label,
@@ -298,21 +332,27 @@ class _CustomizationContentState extends State<_CustomizationContent> {
298332
CustomizableSwitch(
299333
title: context.l10n.app_components_common_error_label,
300334
value: customizationState.hasError,
301-
onChanged: customizationState.isErrorWhenEnabled || customizationState.isErrorWhenLoader || customizationState.isErrorWhenReadOnly
335+
onChanged:
336+
customizationState.isErrorWhenEnabled ||
337+
customizationState.isErrorWhenLoader ||
338+
customizationState.isErrorWhenReadOnly
302339
? null
303340
: (value) {
304341
customizationState.hasError = value;
305342
},
306343
),
307344
CustomizableSwitch(
308-
title: context.l10n.app_components_textInput_leadingIcon_label,
309-
value: !customizationState.hasCountrySelector,
310-
onChanged: (value) {
311-
customizationState.hasLeadingIcon = value;
312-
customizationState.hasCountrySelector = !value;
313-
}),
345+
title: context.l10n.app_components_textInput_leadingIcon_label,
346+
value: !customizationState.hasCountrySelector,
347+
onChanged: (value) {
348+
customizationState.hasLeadingIcon = value;
349+
customizationState.hasCountrySelector = !value;
350+
},
351+
),
314352
CustomizableSwitch(
315-
title: context.l10n.app_components_phoneNumberInput_country_selector_label,
353+
title: context
354+
.l10n
355+
.app_components_phoneNumberInput_country_selector_label,
316356
value: !customizationState.hasLeadingIcon,
317357
onChanged: (value) {
318358
customizationState.hasCountrySelector = value;
@@ -329,7 +369,11 @@ class _CustomizationContentState extends State<_CustomizationContent> {
329369
CustomizableSwitch(
330370
title: context.l10n.app_components_common_loader_label,
331371
value: customizationState.hasLoader,
332-
onChanged: customizationState.isLoaderWhenError || !customizationState.isTyping || customizationState.isLoaderWhenEnabled || customizationState.isEnabledWhenPlaceHolderIsNotEmpty
372+
onChanged:
373+
customizationState.isLoaderWhenError ||
374+
!customizationState.isTyping ||
375+
customizationState.isLoaderWhenEnabled ||
376+
customizationState.isEnabledWhenPlaceHolderIsNotEmpty
333377
? null
334378
: (value) {
335379
customizationState.hasLoader = value;

ouds_theme_contract/lib/ouds_component_version.dart

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@
1313
// Generated by Tokenator
1414

1515
class OudsComponentVersion {
16-
static const alertMessage = '1.0.0';
17-
static const badge = '1.2.0';
18-
static const bar = '1.0.0';
19-
static const button = '3.2.0';
20-
static const checkbox = '2.4.0';
21-
static const chip = '1.3.0';
22-
static const divider = '1.0.0';
23-
static const inlineAlert = '1.0.0';
24-
static const link = '2.2.0';
25-
static const passwordInput = '1.2.0';
26-
static const phoneNumberInput = '1.2.0';
27-
static const pinCodeInput = '1.2.0';
28-
static const radioButton = '1.4.0';
29-
static const skeleton = '1.0.0';
30-
static const switchButton = '1.5.0';
31-
static const tag = '1.4.0';
32-
static const textInput = '1.3.0';
16+
static const alertMessage = '1.1.0';
17+
static const badge = '1.2.0';
18+
static const bar = '1.0.0';
19+
static const button = '3.2.0';
20+
static const checkbox = '2.4.0';
21+
static const chip = '1.3.0';
22+
static const divider = '1.0.0';
23+
static const inlineAlert = '1.0.0';
24+
static const link = '2.2.0';
25+
static const passwordInput = '1.2.0';
26+
static const phoneNumberInput = '1.2.0';
27+
static const pinCodeInput = '1.2.0';
28+
static const radioButton = '1.4.0';
29+
static const skeleton = '1.0.0';
30+
static const switchButton = '1.5.0';
31+
static const tag = '1.4.0';
32+
static const textInput = '1.3.0';
3333
}

0 commit comments

Comments
 (0)