csc_picker 0.0.8 copy "csc_picker: ^0.0.8" to clipboard
csc_picker: ^0.0.8 copied to clipboard

outdated

A flutter package to display list of Countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.

csc_picker #

version

A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.

Horizontal Layout Vertical Layout

How to Use #

To use this Package, add csc_picker as a dependency in your pubspec.yaml.

      	CSCPicker(
              onCountryChanged: (value) {
      			setState(() {
      					countryValue = value;
      				});
                  },
                  onStateChanged:(value) {
                      setState(() {
      					stateValue = value;
      				});
                  },
                  onCityChanged:(value) {
                  setState(() {
                      cityValue = value;
      			});
      		},
          ),

you will get feedback in onChanged functions

Parameters #

ParametersDataType & Description
styleTextStyle - format text designs
showFlagBoolean - toggle country flag
layoutLayout - toggle dropdown layout (Horizontal / Vertical)
showStatesBoolean - Enable disable States dropdown (true / false)
showCitiesBoolean - Enable disable Cities dropdown (true / false)

Example #

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'CSC Picker',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'CSC Picker'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  String countryValue ="";
  String stateValue ="";
  String cityValue ="";

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(

        title: Text(widget.title),
      ),
      body: Center(
        child: Container(
            padding: EdgeInsets.symmetric(horizontal: 20),
            height: 600,
            child:
            Column(
              children: [
                CSCPicker(
                  onCountryChanged: (value) {
                    setState(() {
                      countryValue = value;
                    });
                  },
                  onStateChanged:(value) {
                    setState(() {
                      stateValue = value;
                    });
                  },
                  onCityChanged:(value) {
                    setState(() {
                      cityValue = value;
                    });
                  },
                ),
                Text("$countryValue\n$stateValue\n$cityValue")
              ],
            )
        ),
      ),
    );
  }
}

Special Thanks to #

220
likes
0
pub points
97%
popularity

Publisher

unverified uploader

A flutter package to display list of Countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on csc_picker