From a9eecc7349fb205f46762eec38fac93376bfb478 Mon Sep 17 00:00:00 2001 From: atanasyordanov21 <63714308+atanasyordanov21@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:15:37 +0300 Subject: [PATCH] Component phone input (#24) * chore: update contributing * fix: Fix button group immutability (#1) * Fix errors * fix copywith function * [automated commit] lint format and import sort --------- Co-authored-by: Osman Co-authored-by: github-actions * [automated commit] lint format and import sort * update on-main to push to firebase (#3) * ci: move firebase to flutter main host for qa (#4) * feat: Add List Item (#5) * feat: Add List Item * [automated commit] lint format and import sort --------- Co-authored-by: Simeon Dimitrov Co-authored-by: github-actions * fix(main): ListItem disabled color (#8) * fix(main): ListItem disabled color * [automated commit] lint format and import sort --------- Co-authored-by: github-actions * feat : Dropdown menu (#7) * Create dropdown * Add sizes * create stoyrybook and add size * Fix errrs and respond to comments * Fix issues * [automated commit] lint format and import sort * Alter isLarge * Fix spacing * [automated commit] lint format and import sort * Alter leading styles * [automated commit] lint format and import sort --------- Co-authored-by: Osman Co-authored-by: github-actions * Component ZetaSwitch (#6) * create ZetaSwitch * ZetaSwitch using MaterialSwitch * widgetbook for ZetaSwitch * remove hover; fix initState * add showHover parameter * add comments 'Zeta change' in material_switch.dart * remove size parameter and factory constructors * fix example and widgetbook * Component Zeta Radio Button (#9) * create component Zeta Radio Button * remove hover color * fix label line height * feat(main): SnackBar (#10) * add snackbar example * Add snackbar widgetbook * feat(main): SnackBar * [automated commit] lint format and import sort * remove view icon * Add view icon * Add widgetbook icon helper * [automated commit] lint format and import sort * fix alphabetical imports * Fix delete and error background color --------- Co-authored-by: github-actions * feat(main): Tabs (#11) * feat(main): Tabs * [automated commit] lint format and import sort --------- Co-authored-by: github-actions * chore: Update text styles (#13) * fix: switch on web (#14) * Component date input (#12) * create ZetaDateInput * create different ZetaDateInput variants * fix show error style * date validation and input mask; documentation for ZetaDateInput properties * create widgetbook * changes according to comments * Component date input (#16) * create ZetaDateInput * create different ZetaDateInput variants * fix show error style * date validation and input mask; documentation for ZetaDateInput properties * create widgetbook * changes according to comments * fix Typography of Date Input * restore * remove text line height * ZetaPhoneInput initial commit * complete ZetaPhoneInput; add flags * create phoneInputUseCase in Widgetbook * refactor phone input to use native alert dialog * don't use root navigator in widgetbook --------- Co-authored-by: Luke Co-authored-by: ahmed-osman3 <99483750+ahmed-osman3@users.noreply.github.com> Co-authored-by: Osman Co-authored-by: github-actions Co-authored-by: Luke Walton Co-authored-by: Simeon Dimitrov Co-authored-by: sd-athlon <163880004+sd-athlon@users.noreply.github.com> --- .../pages/components/phone_input_widgetbook.dart | 1 + lib/src/components/phone_input/phone_input.dart | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/example/widgetbook/pages/components/phone_input_widgetbook.dart b/example/widgetbook/pages/components/phone_input_widgetbook.dart index c63f423f..1b36f6c0 100644 --- a/example/widgetbook/pages/components/phone_input_widgetbook.dart +++ b/example/widgetbook/pages/components/phone_input_widgetbook.dart @@ -22,6 +22,7 @@ Widget phoneInputUseCase(BuildContext context) { label: 'Phone number', hint: 'Enter your phone number', countries: countries.isEmpty ? null : countries.toUpperCase().split(','), + useRootNavigator: false, ), ); }, diff --git a/lib/src/components/phone_input/phone_input.dart b/lib/src/components/phone_input/phone_input.dart index 58e80f2f..0ac45469 100644 --- a/lib/src/components/phone_input/phone_input.dart +++ b/lib/src/components/phone_input/phone_input.dart @@ -20,6 +20,7 @@ class ZetaPhoneInput extends StatefulWidget { this.countryDialCode, this.phoneNumber, this.countries, + this.useRootNavigator = true, }); /// If provided, displays a label above the input field. @@ -55,6 +56,9 @@ class ZetaPhoneInput extends StatefulWidget { /// List of countries ISO 3166-1 alpha-2 codes final List? countries; + /// Determines if the root navigator should be used in the [CountriesDialog]. + final bool useRootNavigator; + @override State createState() => _ZetaPhoneInputState(); @override @@ -70,7 +74,8 @@ class ZetaPhoneInput extends StatefulWidget { ..add(ObjectFlagProperty? p1)?>.has('onChanged', onChanged)) ..add(StringProperty('countryDialCode', countryDialCode)) ..add(StringProperty('phoneNumber', phoneNumber)) - ..add(IterableProperty('countries', countries)); + ..add(IterableProperty('countries', countries)) + ..add(DiagnosticsProperty('useRootNavigator', useRootNavigator)); } }