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

패키지 상세v1.0.4

ccp_dialog

국가 코드, 국기, 통화 및 통화 ISO를 다이얼로그 및 바텀 시트에 표시하기 위한 CCP Dialog 패키지.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
80
좋아요
28
Pub 점수
140

패키지 설치

flutter pub add ccp_dialog

패키지 개요

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

CCP Dialog는 대화상자 또는 바텀 시트에서 국가 코드, 국기, 화폐 및 화폐 ISO를 표시하기 위해 설계된 Flutter 패키지입니다. 앱에 국가 선택 기능을 쉽게 통합할 수 있도록 하며, 사용자가 자신의 국가를 선택할 수 있도록 깔끔하고 사용자 정의 가능한 UI를 제공합니다. 지역별 데이터 입력이 필요한 국제화 애플리케이션에 적합하며, Android, iOS, Web, macOS, Windows, Linux 등 여러 플랫폼을 지원합니다. 선택 과정에서 국기와 화폐 정보와 같은 시각적 신호를 제공함으로써 사용자 경험을 향상시킵니다.

사용 사례

  • 국제 앱 온보딩
  • 국가 선택이 있는 전화번호 입력
  • 통화 인식 폼 입력
  • 다중 지역 전자상거래 앱
  • 여행 및 물류 애플리케이션

주요 기능

  • 국가의 국기와 코드를 표시합니다
  • 통화 및 통화 ISO 표시
  • 다이얼로그 및 바텀 시트 모드를 지원합니다
  • 크로스 플랫폼 호환성
  • 사용자 정의 가능한 UI 요소
  • pub add를 통한 간편한 통합

적합한 대상

  • 글로벌 앱을 개발하는 개발자
  • 국가 선택이 필요한 앱
  • 지역 데이터를 필요로 하는 폼 빌더
  • 로컬라이제이션 필요성이 있는 모바일 및 웹 애플리케이션
  • 사용자 경험 중심 인터페이스

고려 사항

  • 완전한 국가 데이터를 사용하려면 인터넷이 필요합니다(동적일 경우)
  • 영어 이외의 지역에 맞게 맞춤 설정이 필요할 수 있습니다
  • 사전 정의된 국가 목록에 제한됨
  • 대규모 데이터 세트의 성능 영향
  • 오프라인 전용 사용 사례에는 적합하지 않습니다

원본 README

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

Flutter CCP dialog

Features

Flexible CCP dialog for getting Country code, Calling code, isoCode and Currency in Dialog and Bottom sheet.


# Installation
  1. Add the latest version of package to your pubspec.yaml (and dart pub get):
dart
  dependencies:
    flutter:
      sdk: flutter
    ccp_dialog: any
  1. Import the package and use it in your App.

Usage Example

import 'package:ccp_dialog/country_picker/flutter_country_picker.dart';

Example

import 'package:ccp_dialog/country_picker/flutter_country_picker.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Country Piker Dialog'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String countryCode ="+91";
  Country selectedCountry = Country.IN;

  _updateCountry(Country country){
    selectedCountry = country;
    countryCode = "+${country.dialingCode}";
    setState(() {

    });
  }
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'Select Country',
            ),
            Container(
                height: 45,
                 width: MediaQuery.of(context).size.width/2,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(30),
                    color: Colors.white),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                   CountryPicker(
                      selectedCountry: selectedCountry,
                      dense: true ,
                       //displays arrow, true by default
                      showLine: true,
                       //displays line, false by default If dense true Line not show
                      showFlag: false,
                       //displays flag, true by default
                         showFlagCircle: true,
                       //displays flagCircle, false by default
                      dialingCodeTextStyle:const TextStyle(fontSize: 18),
                      showDialingCode: true,
                      //displays dialing code, false by default
                      showName: false,
                       //displays Name, true by default
                      withBottomSheet: true,
                      //displays country name, true by default
                      showCurrency: false,
                      //eg. 'British pound'
                      showCurrencyISO: false,
                      onChanged:_updateCountry
                   ),
                   const Text('9876541230',style: TextStyle(fontSize: 20),),
                ]))
          ],
        ),
      ),
    );
  }
}

Using Getx

Example:-

  Rx<Country> selectedCountry = Country.IN.obs;
  var countryCode = "+91".obs;
  updateCountry(Country country)
  {
      selectedCountry.value = country;
      countryCode.value = "+" + country.dialingCode.toString();
  }
  Obx(
  () => CountryPicker(
  selectedCountry: _controller.selectedCountry.value,
  dense: false,
  showFlag: false,
  showFlagCircle: true,
  showDialingCode: true,                                      
  showName: false,
  showCurrency: false,                                         
  showCurrencyISO: false,
  onChanged: _controller.updateCountry
  ),
 )

How to get Default Country

Country? country =  await getCountryByCountryCode(Get.context!, '+91');

Future<Country?> getCountryByCountryCode(BuildContext context, String countryCode) async {
const list = Country.ALL;
return list.firstWhere((element) => element.dialingCode == countryCode);
}

simulator_screenshot_24795F01-DE84-46B5-977D-C23CED7D1EE1

Simulator Screen Shot - iPhone 14 - 2023-05-31 at 15 11 38

Simulator Screen Shot - iPhone 14 - 2023-05-31 at 15 12 12

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

카테고리

소스 저장소

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

아직 데이터가 없습니다.