Skip to content

Commit

Permalink
Component phone input (#34)
Browse files Browse the repository at this point in the history
* 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 <AO3856@zebra.com>
Co-authored-by: github-actions <github-actions@github.com>

* [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 <simeon.dimitrov.work@gmail.com>
Co-authored-by: github-actions <github-actions@github.com>

* fix(main): ListItem disabled color (#8)

* fix(main): ListItem disabled color

* [automated commit] lint format and import sort

---------

Co-authored-by: github-actions <github-actions@github.com>

* 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 <AO3856@zebra.com>
Co-authored-by: github-actions <github-actions@github.com>

* 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 <github-actions@github.com>

* feat(main): Tabs (#11)

* feat(main): Tabs

* [automated commit] lint format and import sort

---------

Co-authored-by: github-actions <github-actions@github.com>

* 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

* pass parameter useRootNavigator

* restore some missing countries in the list

* countries search

* add searchHint

* fix comments

* use ZetaSearchBar in CountriesDialog

---------

Co-authored-by: Luke <lwalton@zebra.com>
Co-authored-by: ahmed-osman3 <99483750+ahmed-osman3@users.noreply.github.com>
Co-authored-by: Osman <AO3856@zebra.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Luke Walton <thelukewalton@users.noreply.github.com>
Co-authored-by: Simeon Dimitrov <simeon.dimitrov.work@gmail.com>
Co-authored-by: sd-athlon <163880004+sd-athlon@users.noreply.github.com>
  • Loading branch information
8 people committed Apr 25, 2024
1 parent 1f4eee7 commit 26810cc
Showing 1 changed file with 6 additions and 30 deletions.
36 changes: 6 additions & 30 deletions lib/src/components/phone_input/countries_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ class _CountriesList extends StatefulWidget {

class _CountriesListState extends State<_CountriesList> {
late final bool _enableSearch = widget.items.length > 20;
final _controller = TextEditingController();
List<CountriesMenuItem> _items = [];

@override
Expand All @@ -126,7 +125,8 @@ class _CountriesListState extends State<_CountriesList> {
_items = List.from(widget.items);
}

void _search(String value) {
void _search(String? text) {
final value = text ?? '';
setState(() {
_items = widget.items.where((item) {
return item.value.name.toLowerCase().contains(value.toLowerCase()) ||
Expand All @@ -135,19 +135,6 @@ class _CountriesListState extends State<_CountriesList> {
});
}

void _clearSearch() {
_controller.clear();
setState(() {
_items = List.from(widget.items);
});
}

@override
void dispose() {
_controller.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
final zeta = widget.zeta ?? Zeta.of(context);
Expand All @@ -163,22 +150,11 @@ class _CountriesListState extends State<_CountriesList> {
if (_enableSearch)
Padding(
padding: const EdgeInsets.only(bottom: ZetaSpacing.b),
child: TextField(
controller: _controller,
child: ZetaSearchBar(
onChanged: _search,
decoration: InputDecoration(
hintText: widget.searchHint ?? 'Search by name or dial code',
prefixIcon: const Icon(ZetaIcons.search_round),
suffixIcon: _controller.text.isEmpty
? null
: IconButton(
onPressed: _clearSearch,
icon: Icon(
ZetaIcons.cancel_round,
color: zeta.colors.cool.shade70,
),
),
),
hint: widget.searchHint ?? 'Country or dial code',
shape: ZetaWidgetBorder.full,
showSpeechToText: false,
),
),
if (_enableSearch)
Expand Down

0 comments on commit 26810cc

Please sign in to comment.