搜尋套件、儲存庫與 APP 分類

套件詳情v0.1.1

camerakit

Flutter camera kit 使用原生 Android 和 iOS API 來拍攝照片和掃描條碼,並支援可控制的閃光燈。

AndroidiOS
近 30 天下載
208
喜歡數
33
Pub 分數
125

安裝套件

flutter pub add camerakit

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

CameraKit 是一個 Flutter 插件,利用原生 Android 和 iOS 相機 API 來實現高效率的圖片拍攝與條碼掃描。它為開發者提供對相機功能的細微控制,包含可調節的閃光燈設定,以達到最佳照明條件。設計上支援無縫整合,兩個平台皆能以最少設定運作。此套件非常適合需要可靠相機功能的應用程式,例如文件掃描、QR 碼讀取器或照片拍攝工具。

適用情境

  • 零售應用中的條形碼掃描
  • 數位表單的文件捕獲
  • 移動庫存系統中的照片捕獲
  • 二維碼產生與讀取
  • 即時影像處理工作流程

主要特色

  • Android 和 iOS 的原生相機存取
  • 閃光燈控制,實現更佳照明
  • 條碼和QR碼掃描
  • 高解析度影像擷取
  • 跨平台相容性

適合對象

  • 需要攝影機整合的行動應用程式
  • 需要條形碼掃描的應用程式
  • 開發庫存或文件工具的開發者
  • 使用即時攝像頭畫面的專案
  • 針對 Android 和 iOS 的 Flutter 應用

使用建議

  • 需要在應用清單中授予相機權限
  • 可能需要額外設定以進行條碼掃描
  • 僅限相機特定任務
  • 依賴原生 SDK 才能實現完整功能
  • 不適用於影片錄製或進階相機效果

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Use Prerelease version to support nullsafety.

Flutter Camera Kit

Flutter camera kit uses native android and ios APIs for taking picture and scanning barcode with controlable flash.This plugin uses Camera2 API in android and AVFoundation in iOS for taking picture and MLFirebase library for scanning barcode.

Main features:

  • Easy implementation with controller
  • Automatic permission handling (no need for 3rd-party libraries)
  • Automatic camera resource handling for battery usage and avoid any conflict with another camera based applications.(you can also manage manually pause and resume camera)
  • fill and fit mode for camera preview frame.
  • Optimize memory usage in taking picture
  • auto, on and off flash mode while taking picture and scan barcode.

Installation

iOS

Add io.flutter.embedded_views_preview in info.plist with value YES. Add Privacy - Camera Usage Description in info.plist.

Usage

For use plugin, You shoude an instance of CameraKitController then initial CameraKitView passing CameraKitController instance to it.

   cameraKitController = CameraKitController();
    cameraKitView = CameraKitView(
      cameraKitController: cameraKitController,
      hasBarcodeReader: true,
      barcodeFormat: BarcodeFormats.FORMAT_ALL_FORMATS
      scaleType: ScaleTypeMode.fill,
      previewFlashMode: CameraFlashMode.auto,
      androidCameraMode: AndroidCameraMode.API_X,
      cameraSelector: CameraSelector.back
      onPermissionDenied: () {
          print("Camera permission is denied.");
          //ToDo on permission denied by user
      },
      onBarcodeRead: (code) {
        print("Barcode is read: " + code);
        //ToDo on barcode read
      },
    );

Cunstructor parameters

hasBarcodeReader: True means scan barcode mode and false means take picture mode

barcodeFormat: Set barcode format from available values, default value is FORMAT_ALL_FORMATS.

scaleType: There are 2 modes ScaleTypeMode.fill and ScaleTypeMode.fit for this parameter. If you want camera preview fill your widget area, use fill mode. In this mode, camera preview may be croped for filling widget area. If you want camera preview to show entire lens preview, use fit mode. In this mode, camera preview may be shows blank areas.

previewFlashMode: This parameter accepts 3 values, CameraFlashMode.auto, CameraFlashMode.on and CameraFlashMode.off. For changing value after initial use changeFlashMode method in controller.

androidCameraMode: This parameter has been replaced with useCamera2API. This parameter accepts 3 values, API_X, API_1, API_2. Default value is API_X. Some feature is available in each value. API_1 features: Taking picture API_2 features: Taking picture, Scaning barcode (Taking picture with flash has some issues, Auto flash in barcode scanning mode works in some phones.) API_X features: Taking picture, Scaning barcode (Auto flash in barcode scanning mode doesn't work.)

cameraSelector: Set front and back camera with this parameter. This parameter accepts 3 values, back and front

onPermissionDenied: After android and iOS user deny run time permission, this method is called.

onBarcodeRead: In barcodeReader mode, while camera preview detect barcodes, This method is called.

Controller methods

Take Picture You can take picture with this method. Unlike API_2, in API_X, you can take picture in scaning barcode mode. You can pass your custom path for save image. You can pass nothing and the image will be saved in default path.

  String path = await cameraKitController.takePicture({Your custom path});

Change Flash Mode For changing flash mode, don't change cunstructor parameter. Use changeFlashMode method in controller. Pass CameraFlashMode enum to this method.

    cameraKitController.changeFlashMode(CameraFlashMode.on);

Pause and Resume camera This plugin automatically manage pause and resume camera based on android, iOS life cycle and widget visibility, also you can call with your controller when ever you need.

    cameraKitController.pauseCamera();
    cameraKitController.resumeCamera();

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。