패키지, 저장소 및 앱 카테고리 검색

csc_picker 표지
패키지 상세v0.2.7

csc_picker

선택된 항목에 따라 국가, 주, 도시 목록을 표시하는 플러터 패키지이며, 전 세계의 국가, 주, 도시를 검색할 수 있습니다.

30일 다운로드
1.9천
좋아요
223
Pub 점수
70

패키지 설치

flutter pub add csc_picker

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

csc_picker는 계층적 드롭다운 구조를 통해 국가, 주, 도시를 선택할 수 있는 Flutter 패키지입니다. 전 세계의 모든 국가, 주, 도시를 검색할 수 있어 위치 입력이 필요한 양식에 이상적입니다. 가볍고 쉽게 통합할 수 있으며, 사용자의 선택에 따라 국가, 주, 도시 선택을 위한 깔끔한 UI를 제공합니다. 국제 주소 입력 또는 지역별 데이터 수집이 필요한 애플리케이션에서 특히 유용합니다.

사용 사례

  • 국제 주소 양식
  • 사용자 프로필 위치 설정
  • 전자상거래 배송 세부 정보
  • 여행 예약 시스템
  • 다중 지역 앱 로컬라이제이션

주요 기능

  • 계층적 국가-주-도시 선택
  • 전역 검색 기능
  • 경량이며 간편한 통합
  • 선택 간 동적 종속성 지원
  • 깨끗하고 사용자 정의 가능한 UI

적합한 대상

  • 국제 위치 입력이 필요한 앱
  • 다중 레벨 위치 필드를 가진 양식
  • 간단한 국가 선택기 찾는 개발자
  • 글로벌 사용자 기반을 가진 프로젝트
  • 로컬라이제이션 필요성이 있는 모바일 앱

고려 사항

  • 오프라인 데이터 캐싱 포함되지 않음
  • 드롭다운 표시의 사용자 정의 제한
  • 완전한 검색 기능을 사용하려면 인터넷이 필요합니다
  • 사용자 지정 영역 또는 비표준 계층을 지원하지 않습니다
  • 대규모 데이터 세트에서는 초기 로드가 느릴 수 있습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

csc_picker

version 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
ParametersTypeDescription
flagStateCountryFlagEnable (get flag with country name) / Disable (Disable flag) / ShowInDropdownOnly (display flag in dropdown only)
layoutLayoutToggle dropdown layout (Horizontal / Vertical)
showStatesBoolean Enable disable States dropdown (true / false)
showCitiesBoolean Enable disable Cities dropdown (true / false)
dropdownDecorationBoxDecorationDropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER] (USE with disabledDropdownDecoration)
disabledDropdownDecorationBoxDecorationDisabled Dropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER] (USE with disabled dropdownDecoration)
selectedItemStyleTextStyleTo change selected item style
dropdownHeadingStyleTextStyleTo change DropdownDialog Heading style
dropdownItemStyleTextStyleTo change DropdownDialog Item style
dropdownDialogRadiusdoubleTo change DropdownDialogBox radius
searchBarRadiusdoubleTo change search bar radius
defaultCountryCscCountryTo select default country
disableCountryBooleanDisable country dropdown (Note: use it with default country)
countryFilterList of CscCountryShow only countries in dropdown that you want
countrySearchPlaceholderStringPlaceholder for country search field
stateSearchPlaceholderStringPlaceholder for state search field
citySearchPlaceholderStringPlaceholder for city search field
countryDropdownLabelStringLabel/Title for country dropdown
countryDropdownLabelStringLabel/Title for state dropdown
countryDropdownLabelStringLabel/Title for city dropdown
Example
import 'package:csc_picker/csc_picker.dart';
import 'package:flutter/material.dart';

/// This is a implementation of the Country State City Picker.
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> {
  /// Variables to store country state city data in onChanged method.
  String countryValue = "";
  String stateValue = "";
  String cityValue = "";
  String address = "";

  @override
  Widget build(BuildContext context) {

    GlobalKey<CSCPickerState> _cscPickerKey = GlobalKey();

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Container(
            padding: EdgeInsets.symmetric(horizontal: 20),
            height: 600,
            child: Column(
              children: [
                ///Adding CSC Picker Widget in app
                CSCPicker(
                  ///Enable disable state dropdown [OPTIONAL PARAMETER]
                  showStates: true,

                  /// Enable disable city drop down [OPTIONAL PARAMETER]
                  showCities: true,

                  ///Enable (get flag with country name) / Disable (Disable flag) / ShowInDropdownOnly (display flag in dropdown only) [OPTIONAL PARAMETER]
                  flagState: CountryFlag.DISABLE,

                  ///Dropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER] (USE with disabledDropdownDecoration)
                  dropdownDecoration: BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                      color: Colors.white,
                      border:
                      Border.all(color: Colors.grey.shade300, width: 1)),

                  ///Disabled Dropdown box decoration to style your dropdown selector [OPTIONAL PARAMETER]  (USE with disabled dropdownDecoration)
                  disabledDropdownDecoration: BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                      color: Colors.grey.shade300,
                      border:
                      Border.all(color: Colors.grey.shade300, width: 1)),

                  ///placeholders for dropdown search field
                  countrySearchPlaceholder: "Country",
                  stateSearchPlaceholder: "State",
                  citySearchPlaceholder: "City",

                  ///labels for dropdown
                  countryDropdownLabel: "*Country",
                  stateDropdownLabel: "*State",
                  cityDropdownLabel: "*City",

                  ///Default Country
                  //defaultCountry: CscCountry.India,

                  ///Disable country dropdown (Note: use it with default country)
                  //disableCountry: true,

                  ///Country Filter [OPTIONAL PARAMETER]
                  countryFilter: [CscCountry.India,CscCountry.United_States,CscCountry.Canada],

                  ///selected item style [OPTIONAL PARAMETER]
                  selectedItemStyle: TextStyle(
                    color: Colors.black,
                    fontSize: 14,
                  ),

                  ///DropdownDialog Heading style [OPTIONAL PARAMETER]
                  dropdownHeadingStyle: TextStyle(
                      color: Colors.black,
                      fontSize: 17,
                      fontWeight: FontWeight.bold),

                  ///DropdownDialog Item style [OPTIONAL PARAMETER]
                  dropdownItemStyle: TextStyle(
                    color: Colors.black,
                    fontSize: 14,
                  ),

                  ///Dialog box radius [OPTIONAL PARAMETER]
                  dropdownDialogRadius: 10.0,

                  ///Search bar radius [OPTIONAL PARAMETER]
                  searchBarRadius: 10.0,

                  ///triggers once country selected in dropdown
                  onCountryChanged: (value) {
                    setState(() {
                      ///store value in country variable
                      countryValue = value;
                    });
                  },

                  ///triggers once state selected in dropdown
                  onStateChanged: (value) {
                    setState(() {
                      ///store value in state variable
                      stateValue = value;
                    });
                  },

                  ///triggers once city selected in dropdown
                  onCityChanged: (value) {
                    setState(() {
                      ///store value in city variable
                      cityValue = value;
                    });
                  },
                ),

                ///print newly selected country state and city in Text Widget
                TextButton(
                    onPressed: () {
                      setState(() {
                        address = "$cityValue, $stateValue, $countryValue";
                      });
                    },
                    child: Text("Print Data")),
                Text(address)
              ],
            )),
      ),
    );
  }
}
Special Thanks to

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.