ola_like_country_picker 0.1.2 copy "ola_like_country_picker: ^0.1.2" to clipboard
ola_like_country_picker: ^0.1.2 copied to clipboard

A new Flutter package for country picker. ola_like_country_picker provides a bottom sheet allowing a user to select a country(with flag and dialcode)(optional) from a list.

example/example.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  CountryPicker c;
  Country country = Country.fromJson(countryCodes[94]);

  @override
  void initState() {
    super.initState();
    c = CountryPicker(onCountrySelected: (Country country) {
      print(country);
      setState(() {
        this.country = country;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image:
                AssetImage(country.flagUri, package: 'ola_like_country_picker'),
          ),
        ),
      ),
      onTap: () {
        c.launch(context);
      },
    );
  }
}
19
likes
40
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter package for country picker. ola_like_country_picker provides a bottom sheet allowing a user to select a country(with flag and dialcode)(optional) from a list.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on ola_like_country_picker