@@ -40,13 +40,15 @@ import 'package:provider/provider.dart';
4040
4141class 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 {
97103class _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;
0 commit comments