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

패키지 상세v0.13.0

flutter_credit_card_scanner

기기 카메라를 사용하여 신용카드 정보를 스캔하고 추출하는 Flutter 패키지입니다. 안드로이드에서는 Google ML을, iOS에서는 Apple Vision을 사용합니다.

AndroidiOS
30일 다운로드
1.5천
좋아요
19
Pub 점수
160

패키지 설치

flutter pub add flutter_credit_card_scanner

패키지 개요

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

기기의 카메라를 사용하여 신용카드 정보를 스캔할 수 있는 플러터 패키지입니다. 안드로이드에서는 Google ML Kit, iOS에서는 Apple Vision을 활용하여 카드 정보를 정확하게 탐지하고 추출합니다. 결제 또는 체크아웃 흐름에 원활하게 통합될 수 있도록 설계되었으며, 실제 카드에서 데이터를 자동으로 캡처함으로써 사용자 입력을 단순화합니다. 이 패키지는 두 가지 주요 모바일 플랫폼을 모두 지원하며 앱 내에서 안전하고 효율적인 카드 입력을 위한 신뢰할 수 있는 기반을 제공합니다.

사용 사례

  • 체크아웃 흐름에서 자동 신용 카드 입력
  • 결제 양식 작성 간소화
  • 금융 앱에 카드 스캔 기능 통합하기
  • 전자상거래 앱에서 빠른 데이터 캡처 활성화
  • 디지털 지갑 설정 지원

주요 기능

  • Google ML Kit(안드로이드) 사용
  • Apple Vision(iOS) 활용
  • 카드 번호, 유효 기간 및 이름을 추출합니다
  • 카메라 기반 스캔 인터페이스
  • 크로스 플랫폼 호환성

적합한 대상

  • 전자상거래 애플리케이션
  • 결제 처리 도구
  • 금융 및 은행 앱
  • 디지털 지갑 통합
  • 빠른 카드 입력이 필요한 앱

고려 사항

  • 카메라 권한이 필요합니다
  • 정확도는 카드의 가시성과 조명에 따라 달라집니다
  • 민감한 데이터 처리는 안전해야 한다
  • 추가 검증 단계가 필요할 수 있습니다
  • 모든 카드 유형이나 방향에 적합하지 않습니다

원본 README

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

🇵🇸 In solidarity with Palestine and all the free people of the world 🇵🇸

CameraScannerWidget

Description:

Introducing a cutting-edge Flutter package that harnesses the power of your device's camera to seamlessly scan and extract credit card information. This innovative solution leverages state-of-the-art machine learning technologies: Google ML Kit for Android devices and Apple Vision for iOS, ensuring optimal performance across platforms.

CameraScannerWidget (
    onScan: (ctx, value) {},
    loadingHolder: CircularProgressIndicator(),
    onNoCamera: () {
        // Handle camera unavailability
    }
)

Demo: Witness the magic in action! 🎥✨

https://github.com/user-attachments/assets/ff6e818c-a65c-4bff-bb95-cbaef2368a23

Key Features:

  • 📱 Cross-platform compatibility (iOS & Android)
  • 🚀 Lightning-fast credit card recognition
  • 🔒 Secure, on-device processing
  • 🎨 Customizable UI elements

Input Parameters:

  • onScan (required): Your gateway to extracted card data! This callback function receives the BuildContext and a CreditCardModel object containing the juicy details (number, holder name, expiration month, expiration year) when a card is successfully scanned.
  • loadingHolder (required): Keep your users engaged! Specify a widget to display during camera initialization.
  • onNoCamera (required): Gracefully handle camera unavailability with this callback function.
  • aspectRatio (optional): Fine-tune your preview! Set the aspect ratio of the camera view (defaults to device screen ratio).
  • cardNumber (optional): Toggle card number scanning (default: true).
  • cardHolder (optional): Enable/disable cardholder name extraction (default: true).
  • cardExpiryDate (optional): Control expiry date scanning (default: true).
  • useLuhnValidation (optional): Enable/disable Luhn validation (default: true).
  • durationOfNextFrame (optional): The duration of the next frame. This can be used to slow down the camera scanning and process the image so it will scan and wait for the next frame to be processed based on the duration. Default is null which means the camera will scan as fast as possible.
  • resolutionPreset (optional): The resolution preset for the camera. Defaults to [ResolutionPreset.high]. This can be used to set the resolution of the camera to a lower resolution to improve performance. Depends on the targeted platform it can be ResolutionPreset.low, ResolutionPreset.medium, ResolutionPreset.high, ResolutionPreset.veryHigh, ResolutionPreset.ultraHigh, ResolutionPreset.max.

Platform-Specific Setup:

Android Configuration:

  1. Ensure your app has integration with Firebase and Google ML Kit, YOU don't need it in IOS.
  2. Upgrade your Android experience! Update android/app/build.gradle:
android {
    defaultConfig {
        minSdkVersion 21
        // ... other configurations
    }
}
  1. Grant camera access! Modify android/app/src/main/AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.your_app_name">

    <uses-permission android:name="android.permission.CAMERA" />

</manifest>

iOS Configuration:

  1. Inform your users! Update ios/Runner/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app needs camera access to scan credit cards.</string>
  1. Set the stage! Modify ios/Podfile:

platform :ios, '15.5' // minimum deployment target

Don't forget to run pod install in the ios directory!

Example Usage:

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

class MyAppCreditCardScanner extends StatefulWidget {
  const MyAppCreditCardScanner({super.key});

  @override
  State<MyAppCreditCardScanner> createState() => _MyAppCreditCardScannerState();
}

class _MyAppCreditCardScannerState extends State<MyAppCreditCardScanner> {
  CreditCardModel? cardModel;
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        CameraScannerWidget(
          onNoCamera: () {
            ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
                content: Text('No camera found, please enable camera')));
          },
          onScan: (_, p1) {
            setState(() {
              cardModel = p1;
            });
          },
          loadingHolder: const Center(
            child: CircularProgressIndicator(),
          ),
        ),
        if (cardModel != null)
          Align(
            alignment: Alignment.bottomCenter,
            child: Container(
              decoration: BoxDecoration(
                  color: Colors.white, borderRadius: BorderRadius.circular(10)),
              padding: MediaQuery.of(context)
                  .padding
                  .add(const EdgeInsets.symmetric(horizontal: 10, vertical: 5)),
              child: AnimatedSwitcher(
                duration: const Duration(milliseconds: 400),
                child: Column(
                    mainAxisSize: MainAxisSize.min,
                    key: ValueKey(cardModel),
                    children: [
                      Text(cardModel!.number),
                      Text(cardModel!.holderName),
                      Text(cardModel!.expiryDate),
                    ]
                        .map((e) => Padding(
                            padding: const EdgeInsets.all(5),
                            child: Card(
                                child: Padding(
                              padding: const EdgeInsets.all(8.0),
                              child: e,
                            ))))
                        .toList()),
              ),
            ),
          )
      ],
    );
  }
}

Conclusion: Elevate your app's user experience with seamless credit card scanning! 🚀💳✨

카테고리

의존성

의존성 목록 4 개

소스 저장소

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

아직 데이터가 없습니다.