import 'package:flutter/material.dart';
import 'package:intl_phone_field/intl_phone_field.dart';

class PhoneNumberInput extends StatelessWidget {
  const PhoneNumberInput({super.key});

  @override
  Widget build(BuildContext context) {
    final border = OutlineInputBorder(
      borderSide:
          BorderSide(color: Theme.of(context).colorScheme.onSurface, width: 2),
    );
    return IntlPhoneField(
      decoration: InputDecoration(
          labelText: 'Phone number',
          counter: SizedBox(),
          border: border,
          enabledBorder: border),
      initialCountryCode: 'US',
      dropdownIconPosition: IconPosition.trailing,
      flagsButtonMargin: EdgeInsets.symmetric(horizontal: 12),
      onChanged: (phone) {
        print(phone.completeNumber);
      },
    );
  }
}
