ptwcode_country_codes 1.0.0 copy "ptwcode_country_codes: ^1.0.0" to clipboard
ptwcode_country_codes: ^1.0.0 copied to clipboard

outdated

A package to find the calling code and iso code to a country.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Country? _country;

  void _onTap() async {
    _country = await showCountryDialog(context);
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Center(
        child: ElevatedButton(
          onPressed: _onTap,
          child: Text(
            _country == null
                ? 'no country choosen'
                : 'Country: ${_country?.name} | Code: +${_country?.call}',
          ),
        ),
      ),
    );
  }
}
2
likes
0
points
54
downloads

Publisher

unverified uploader

Weekly Downloads

A package to find the calling code and iso code to a country.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on ptwcode_country_codes