Skip to content

Commit

Permalink
Option to exclude country selector chip from focus (#223)
Browse files Browse the repository at this point in the history
* add option to exclude country selector navigator chip from focus traversal

* make country selector navigator chip always unfocusable
  • Loading branch information
hbatalhaStch authored Mar 11, 2024
1 parent eee51af commit ad50bd6
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions lib/src/phone_form_field_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,26 @@ class PhoneFormFieldState extends FormFieldState<PhoneNumber> {
}

Widget _buildCountryCodeChip(BuildContext context) {
return AnimatedBuilder(
animation: controller,
builder: (context, _) => CountryButton(
key: const ValueKey('country-code-chip'),
isoCode: controller.value.isoCode,
onTap: widget.enabled ? _selectCountry : null,
padding: _computeCountryButtonPadding(context),
showFlag: widget.showFlagInInput,
showIsoCode: widget.showIsoCodeInInput,
showDialCode: widget.showDialCode,
textStyle: widget.countryCodeStyle ??
widget.decoration.labelStyle ??
TextStyle(
fontSize: 16,
color: Theme.of(context).textTheme.bodySmall?.color,
),
flagSize: widget.flagSize,
enabled: widget.enabled,
return ExcludeFocus(
child: AnimatedBuilder(
animation: controller,
builder: (context, _) => CountryButton(
key: const ValueKey('country-code-chip'),
isoCode: controller.value.isoCode,
onTap: widget.enabled ? _selectCountry : null,
padding: _computeCountryButtonPadding(context),
showFlag: widget.showFlagInInput,
showIsoCode: widget.showIsoCodeInInput,
showDialCode: widget.showDialCode,
textStyle: widget.countryCodeStyle ??
widget.decoration.labelStyle ??
TextStyle(
fontSize: 16,
color: Theme.of(context).textTheme.bodySmall?.color,
),
flagSize: widget.flagSize,
enabled: widget.enabled,
),
),
);
}
Expand Down

0 comments on commit ad50bd6

Please sign in to comment.