The CountrySelectorNavigator widget does not display the favorite countries in the specified order, even when sortCountries: false is set. According to the documentation, favorite countries should always appear in the order they are provided in the favorites parameter, regardless of the sortCountries setting. However, they are displayed in alphabetical order instead.
Reproduction Steps
The issue can be reproduced using the following minimal code:
import 'package:flutter/material.dart';
import 'package:phone_form_field/phone_form_field.dart';
class TestCountrySelector extends StatelessWidget {
const TestCountrySelector({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: PhoneFormField(
countrySelectorNavigator: const CountrySelectorNavigator.page(
favorites: [IsoCode.FR, IsoCode.GB, IsoCode.DE],
sortCountries: false,
),
initialValue: const PhoneNumber(isoCode: IsoCode.GB, nsn: ''),
decoration: const InputDecoration(labelText: 'Phone Number'),
),
);
}
}
Observed Behavior
When running the example above, the favorite countries are displayed in alphabetical order (FR, DE, GB) instead of the specified order (FR, GB, DE).
Expected Behavior
The favorite countries should appear in the exact order provided in the favorites parameter. In this case, the expected order is [FR, GB, DE].
Environment
Flutter Version: Flutter 3.24.5 • channel stable
phone_form_field Version: 10.0.2
The CountrySelectorNavigator widget does not display the favorite countries in the specified order, even when sortCountries: false is set. According to the documentation, favorite countries should always appear in the order they are provided in the favorites parameter, regardless of the sortCountries setting. However, they are displayed in alphabetical order instead.
Reproduction Steps
The issue can be reproduced using the following minimal code:
Observed Behavior
When running the example above, the favorite countries are displayed in alphabetical order (FR, DE, GB) instead of the specified order (FR, GB, DE).
Expected Behavior
The favorite countries should appear in the exact order provided in the favorites parameter. In this case, the expected order is [FR, GB, DE].
Environment
Flutter Version: Flutter 3.24.5 • channel stable
phone_form_field Version: 10.0.2