Skip to content

Commit

Permalink
add initial value
Browse files Browse the repository at this point in the history
  • Loading branch information
Merculiar committed Nov 29, 2024
1 parent afad309 commit 2a6ab9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class PhoneNumberTextField extends StatefulWidget {
super.key,
required this.controller,
required this.placeholder,
this.initialCountry,
this.onPhoneChanged,
});

final TextEditingController controller;
final String placeholder;
final Country? initialCountry;
final ValueSetter<String>? onPhoneChanged;

@override
Expand All @@ -38,6 +40,7 @@ class _PhoneNumberTextFieldState extends State<PhoneNumberTextField> {
@override
void initState() {
super.initState();
_selectedCountry = widget.initialCountry;
widget.controller.addListener(_notifyPhoneChanged);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '../../../l10n/l10n.dart';
import '../../../ui/button.dart';
import '../../../ui/loader.dart';
import '../../../ui/snackbar.dart';
import '../../country_picker/models/country.dart';
import '../../country_picker/widgets/phone_text_field.dart';
import '../services/kyc_service.dart';
import '../utils/kyc_exception.dart';
Expand Down Expand Up @@ -84,6 +85,7 @@ class _PhoneInputScreenState extends State<PhoneVerificationScreen> {
const SizedBox(height: 40),
PhoneNumberTextField(
controller: _numberController,
initialCountry: Country.findByCode('NG'),
placeholder: context.l10n.phoneNumber,
onPhoneChanged: (fullNumber) =>
setState(() => _fullPhoneNumber = fullNumber),
Expand Down

0 comments on commit 2a6ab9c

Please sign in to comment.