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

country_pickers 표지
패키지 상세v3.0.1

country_pickers

국가, 코드, 국기 및 선택하는 여러 방법을 제공합니다… 한 위젯만 멀리…

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
6만
좋아요
179
Pub 점수
150

패키지 설치

flutter pub add country_pickers

패키지 개요

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

Country Pickers는 국가 코드, 이름 및 국기를 포함하여 국가를 선택할 수 있는 사용하기 쉬운 위젯을 제공하는 Flutter 패키지입니다. Android, iOS, Web, macOS, Windows, Linux 등 다양한 플랫폼을 지원하며, 드롭다운 또는 검색 가능한 목록을 통해 국가를 선택하는 다양한 방법을 제공합니다. 이 패키지는 앱 내에서 국가 선택에 일관되고 사용자 정의 가능한 인터페이스를 제공함으로써 국제화 작업을 간소화합니다.

사용 사례

  • 국제 폼 입력
  • 국가 코드가 포함된 전화번호 입력
  • 사용자 프로필 로컬라이제이션
  • 다중 지역 앱 지원
  • 여행 및 배송 서비스 선택

주요 기능

  • 내장 국가 깃발
  • 검색 가능한 국가 목록
  • ISO 국가 코드 지원
  • 사용자 지정 가능한 UI
  • 여러 피커 스타일

적합한 대상

  • 국가 선택이 필요한 앱
  • 국제 전화 번호를 포함한 폼
  • 전역 사용자 온보딩
  • 로컬라이제이션 중심 애플리케이션
  • 크로스플랫폼 모바일 및 웹 앱

고려 사항

  • 완전한 플래그 로딩을 위해서는 인터넷이 필요합니다(원격 이미지를 사용하는 경우)
  • 대규모 국가 목록에 맞춰 사용자 지정이 필요할 수 있습니다
  • 사전 정의된 국가 데이터로 제한
  • 오프라인 전용 사용에 최적화되지 않음
  • 저사양 기기에서 플래그 렌더링 성능

원본 README

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

country_pickers

Countries, codes, flags and several way of picking them at your service...one widget away...

CountryPickerDropdown example
 CountryPickerDropdown(
            initialValue: 'AR',
            itemBuilder: _buildDropdownItem,
            itemFilter:  ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
            priorityList:[
                    CountryPickerUtils.getCountryByIsoCode('GB'),
                    CountryPickerUtils.getCountryByIsoCode('CN'),
                  ],
            sortComparator: (Country a, Country b) => a.isoCode.compareTo(b.isoCode),
            onValuePicked: (Country country) {
              print("${country.name}");
            },
          )
 Widget _buildDropdownItem(Country country) => Container(
        child: Row(
          children: <Widget>[
            CountryPickerUtils.getDefaultFlagImage(country),
            SizedBox(
              width: 8.0,
            ),
            Text("+${country.phoneCode}(${country.isoCode})"),
          ],
        ),
      );
CountryPickerDialog example
void _openCountryPickerDialog() => showDialog(
        context: context,
        builder: (context) => Theme(
            data: Theme.of(context).copyWith(primaryColor: Colors.pink),
            child: CountryPickerDialog(
                titlePadding: EdgeInsets.all(8.0),
                searchCursorColor: Colors.pinkAccent,
                searchInputDecoration: InputDecoration(hintText: 'Search...'),
                isSearchable: true,
                title: Text('Select your phone code'),
                onValuePicked: (Country country) =>
                    setState(() => _selectedDialogCountry = country),
                itemFilter: (c) => ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
                priorityList: [
                  CountryPickerUtils.getCountryByIsoCode('TR'),
                  CountryPickerUtils.getCountryByIsoCode('US'),
                 ],
                itemBuilder: _buildDialogItem)),
      );
CountryPickerCupertino example
 void _openCupertinoCountryPicker() => showCupertinoModalPopup<void>(
      context: context,
      builder: (BuildContext context) {
        return CountryPickerCupertino(
          pickerSheetHeight: 300.0,
          onValuePicked: (Country country) =>
              setState(() => _selectedCupertinoCountry = country),
          itemFilter: (c) => ['AR', 'DE', 'GB', 'CN'].contains(c.isoCode),
          priorityList: [
            CountryPickerUtils.getCountryByIsoCode('TR'),
            CountryPickerUtils.getCountryByIsoCode('US'),
          ],
        );
      });

Credits

Thanks goes to country-flags repo for the flag image assets.

카테고리

소스 저장소

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

순위