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

패키지 상세v0.1.2

ola_like_country_picker

국가 선택기용 새로운 Flutter 패키지입니다. ola_like_country_picker는 국가(깃발 및 다이얼 코드)를 리스트에서 선택할 수 있는 바텀 시트를 제공합니다(선택 사항).

30일 다운로드
40
좋아요
19
Pub 점수
40

패키지 설치

flutter pub add ola_like_country_picker

패키지 개요

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

국가 선택을 위한 하단 시트를 제공하는 플러터 패키지로, 국기와 선택적 다이얼 코드를 표시합니다. 국제 전화번호 입력이 필요한 양식에 적합한 깔끔하고 사용자 친화적인 인터페이스를 제공합니다. 가볍고 기존 플러터 앱에 원활하게 통합되며, 커스터마이징을 지원하며 현대적이고 직관적인 UX를 고려해 설계되었습니다.

사용 사례

  • 국제 전화번호 입력
  • 사용자 프로필 국가 선택
  • 다국어 앱 로컬라이제이션
  • 여행 또는 배송 양식 국가 선택기
  • 인증 흐름 국가 선택

주요 기능

  • 바텀 시트 UI
  • 국가 깃발 표시
  • 선택적 다이얼 코드 지원
  • 사용자 정의 가능한 외관
  • Flutter 폼과의 간편한 통합
  • 경량이고 빠름

적합한 대상

  • 국가 선택이 필요한 모바일 앱
  • 전화번호 입력이 필요한 양식
  • 글로벌 사용자를 대상으로 하는 앱
  • 간단한 국가 선택기 필요 개발자
  • 사용자 인터페이스 중심의 Flutter 프로젝트

고려 사항

  • 국가 및 통화 코드만 제한
  • 내장 검색 기능 없음
  • 지역 필터링을 지원하지 않습니다
  • 선택한 국가 데이터의 수동 처리가 필요합니다
  • 오프라인 모드가 지정되지 않았습니다

원본 README

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

Ola Like Country Picker

A new country picker Flutter package built in Dart.

Introduction

It is Flutter plug-n-play country picker package.

  1. Simple two lines of code. Initialize and Launch.
CountryPicker countryPicker = CountryPicker(
                                onCountrySelected:(country){
                                    print(country);
                                },
                              );
countryPicker.launch(context)

Installation

https://pub.dev/packages/ola_like_country_picker#-installing-tab-

  1. To use the Country Picker look at the example below :
Example Usage:
class _MyHomePageState extends State<MyHomePage> {
  CountryPicker countryPicker;
  Country country = Country.fromJson(countryCodes[0]); // select initial country 

  @override
  void initState() {
    super.initState();
    countryPicker = CountryPicker(onCountrySelected: (Country country) {
      print(country);
      setState(() {
        this.country = country;
      });
    });
  }
  
    @override
  Widget build(BuildContext context) {
    // To simply launch the country picker
    // use countryPicker.launch(context)
    // to forcefully dismiss use countryPicker.dismiss()
    // simple example could be
    return GestureDetector(
      child: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image:
                AssetImage(country.flagUri, package: 'ola_like_country_picker'),
          ),
        ),
      ),
      onTap: () {
        countryPicker.launch(context);
      },
    );

  }  
}
Output
Parameters
parameter default required type remark
onCountrySelected null yes OnCountrySelectedCallback called when country is selected.
showTitle true no bool whether to show title or not.
titleText "Select your country" no String text for title.
  1. To simply use country list view any where use CountryListView() and to modify attributes like flagWidth, flagHeight, countryTitle style etc use below arguments like
CountryListView(flagWidth:50, flagHeight:50 , itemTitleStyle: TextStyle(fontSize:20)); 
Example Usage:
return MaterialApp(
  theme: ThemeData(primarySwatch: Colors.purple),
  home: Scaffold(
    appBar: AppBar(
      title: Text('Select Country'),
    ),
    body: CountryListView(),
  ),
);
Output
Parameters
parameter default required type remark
countryJsonList country_codes no List<Map<String, String>> can be used to specify own set of sublist of countries from the variable country_codes
flagWidth 25 no double width of flag
flagHeight 25 no double height of flag
showFlag true no bool whether to show flag or not
showDialCode true no bool whether to show dial code or not
dialCodePrefix '+' no String The prefix added to the dial code for e.g +91 here prefix is '+'
itemTitleStyle null no TextStyle Used to change style of Country title e.g TextStyle(fontSize:30)
dialCodeStyle null no TextStyle Used to change style of Country's dial code e.g TextStyle(backgroundColor:Colors.green[400])
onSelected null no OnCountrySelectedCallback When Any Country is selected what callback has to be executed e.g CountryListView(onSelected: (Country country){ print(country.toString() });
  1. To use the own version of CountryListView() with CountryPicker() use setCountryListView() method before calling launch() e.g.
    c = CountryPicker(onCountrySelected: (Country country) {
      print(country);
      setState(() {
        this.country = country;
      });
    });
    CountryListView clv = CountryListView(showFlag:false); //own version of CountryListView
    c.setCountryListView(clv);
    ...
    ...
    // Call c.launch(context) in GestureDetector() or other listeners 
    ...
    ...
    

Support

The simplest way to show your support is by giving the project a star.

You can also support by becoming a patron on Patreon:

Patreon

Or by making a single donation by buying a coffee:

Buy Me A Coffee

카테고리

소스 저장소

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

아직 데이터가 없습니다.