another_intl_phone_number_input 0.0.1 copy "another_intl_phone_number_input: ^0.0.1" to clipboard
another_intl_phone_number_input: ^0.0.1 copied to clipboard

A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber with ability to change country code manually using keyboard.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:another_intl_phone_number_input/another_intl_phone_number_input.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      title: 'Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
          appBar: AppBar(title: Text('Demo')),
          body: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final GlobalKey<FormState> formKey = GlobalKey<FormState>();

  final TextEditingController controller = TextEditingController();
  // PhoneNumber number = PhoneNumber(isoCode: 'NG');

  @override
  Widget build(BuildContext context) {
    return Form(
      key: formKey,
      child: Container(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            AnotherInternationalPhoneNumberInput(
                useLocaleToSetCountry: true,
                onInputChanged: (number) {
                  print('onInputChanged: ' + number.toString());
                  Locale myLocale = Localizations.localeOf(context);
                  print('COUNTRY CODE: ' + myLocale.countryCode.toString());
                },
                onInputValidated: (number) {
                  print('onInputChanged: ' + number.toString());
                }
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
60
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

A simple and customizable flutter package for inputting phone number in intl / international format uses Google's libphonenumber with ability to change country code manually using keyboard.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, country_picker, equatable, flutter, libphonenumber_plugin

More

Packages that depend on another_intl_phone_number_input