flutter_country_state 0.1.3+4 copy "flutter_country_state: ^0.1.3+4" to clipboard
flutter_country_state: ^0.1.3+4 copied to clipboard

outdated

A customizable Flutter package that displays all countries with there respective state.

flutter_country_state #

A package for Flutter with a heart of gold. A customizable Flutter package that displays all countries with there respective state.

show some ❤️ and star the repo to support the project. #

Example #

Please run the app in the Example folder

Installation #

dependencies:
  flutter:
    sdk: flutter
  flutter_country_state:

You can also change the style of the text of list of the country and states #

Use It #

This will display the countries #

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_country_state/flutter_country_state.dart';

class ShowCountry extends StatelessWidget {


 @override
 Widget build(BuildContext context) {
   return GestureDetector(
                      child:Padding(
                        padding: EdgeInsets.symmetric(horizontal:kHorizontal),
                        child: Align(
                          alignment: Alignment.topLeft,
                          child:  Column(
                            children: <Widget>[
                              Text(kCcompanylocated,
                                  style:TextStyle(
                                fontSize: ScreenUtil()
                                    .setSp(20,
                                    allowFontScalingSelf: true),
                                color: kComapnylocation,
                                fontFamily: 'Rajdhani',

                              )
                              ),
                              Text(Variables.country,
                                  style:TextStyle(
                                    fontSize: ScreenUtil()
                                        .setSp(20,
                                        allowFontScalingSelf: true),
                                    color: kComapnylocation,
                                    fontFamily: 'Rajdhani',

                                  )
                              )
                            ],
                          ),


                        ),
                      ),
                      onTap: () {
                        showDialog(
                            context: context,
                            child: SimpleDialog(
                                shape: RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(8.0)),
                                elevation: 4,
                                children: <Widget>[

                                  Align(
                                    alignment: Alignment.topRight,
                                    child: GestureDetector(
                                      onTap: (){
                                        Navigator.of(context).push
                                          (MaterialPageRoute(builder: (context) => ThirdScreen()));

                                      },
                                      child: Padding(
                                        padding: EdgeInsets.only(right:18.0),
                                        child: Material(
                                          color:Colors.red,
                                          child: Text('Done',
                                              style:TextStyle(
                                                fontSize: ScreenUtil()
                                                    .setSp(15,
                                                    allowFontScalingSelf: true),
                                                color: kComapnylocation,
                                                fontFamily: 'Rajdhani',

                                              )
                                          ),
                                        ),
                                      )
                                    ),
                                  ),
                                  SingleChildScrollView(
                                      child: Container(child: ShowMyDialog(
                                        searchHint: 'Search country',
                                        substringBackground: Colors.green,
                                      ))

                                  )
                                ],

                            )
                        );
                      }
                  ),
 }
}

This will display the states of the country selected #

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_country_state/flutter_country_state.dart';
class ShowState extends StatefulWidget {

 @override
 _ShowStateState createState() => _ShowStateState();
}

class _ShowStateState extends State<ShowState> {
 @override
 Widget build(BuildContext context) {
   return  GestureDetector(
                      child:Padding(
                        padding: EdgeInsets.symmetric(horizontal:kHorizontal),
                        child: Align(
                          alignment: Alignment.topLeft,
                          child: Column(
                            children: <Widget>[
                              Text( kCcompanystatelocated, style:TextStyle(
                                fontSize: ScreenUtil()
                                    .setSp(20,
                                    allowFontScalingSelf: true),
                                color: kComapnylocation,
                                fontFamily: 'Rajdhani',

                              )
                              ),
                              Text( Variables.state, style:TextStyle(
                                fontSize: ScreenUtil()
                                    .setSp(20,
                                    allowFontScalingSelf: true),
                                color: kComapnylocation,
                                fontFamily: 'Rajdhani',

                              )
                              ),
                            ],
                          )

                        ),
                      ),
                      onTap: (){
                        showDialog(
                        context: context,
                        child: SimpleDialog(
                                          shape: RoundedRectangleBorder(
                                              borderRadius: BorderRadius.circular(8.0)),
                                          elevation: 4,
                                          children: <Widget>[
                                            Align(
                                              alignment: Alignment.topRight,
                                              child: GestureDetector(
                                                  onTap: (){
                                                    Navigator.of(context).push
                                                      (MaterialPageRoute(builder: (context) => ThirdScreen()));

                                                  },
                                                  child: Padding(
                                                    padding: EdgeInsets.only(right:18.0),
                                                    child: Material(
                                                      color:Colors.red,
                                                      child: Text('Done',
                                                          style:TextStyle(
                                                            fontSize: ScreenUtil()
                                                                .setSp(15,
                                                                allowFontScalingSelf: true),
                                                            color: kComapnylocation,
                                                            fontFamily: 'Rajdhani',

                                                          )
                                                      ),
                                                    ),
                                                  )
                                              ),
                                            ),

                                            SingleChildScrollView(child: Container(child:StateDialog(),),)

                                          ],

                                      )
                        );

                      }
                  ),
 }
}

Check this #

Happy Coding!!!

16
likes
0
pub points
78%
popularity

Publisher

verified publishermiriamly.co

A customizable Flutter package that displays all countries with there respective state.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_country_state