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

套件詳情v0.0.8

device_screenshot

一個 Flutter 插件,可幫助您截取整個裝置的螢幕截圖。

Android
近 30 天下載
61
喜歡數
9
Pub 分數
150

安裝套件

flutter pub add device_screenshot

套件介紹

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

device_screenshot 套件是一個專為 Flutter 設計的外掛程式,旨在於 Android 上擷取整個裝置螢幕的畫面截圖。它讓開發者能以程式設計方式取得完整裝置的截圖,對於測試、除錯或產生視覺報告非常有用。此外掛程式可與 Flutter 應用程式無縫整合,除了標準設定外,不需要額外的原生程式碼設定。它支援 Android 平台,非常適合需要視覺驗證或自動化截圖產生的情境。

適用情境

  • 自動化UI測試
  • 調試視覺問題
  • 產生應用預覽
  • 建立視覺文件
  • 錄音應用程式狀態

主要特色

  • 擷取整個裝置螢幕
  • 僅限 Android 支援
  • 簡單的 API 結合
  • 無需原生程式碼
  • 於背景執行

適合對象

  • 測試自動化工程師
  • UI/UX 開發人員
  • 應用除錯工具
  • 文件創建者
  • 品質保證團隊

使用建議

  • 僅限 Android 平台
  • 需要執行時權限
  • 可能無法在所有裝置上運作
  • 捕獲期間可能產生的效能影響
  • 不適用於 iOS 開發

原始 README

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

Device Screenshot Banner

Device Screenshot

💡 Overview

A Flutter plugin that can helps you to take screenshot your overall device using media projection and foreground service.

The plugin currently supports Android only and doesn't support IOS because the feature of media projection is not available there

💻 Usage

First, add device_screenshot as a dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter

  device_screenshot: ^update_version

Don't forget to flutter pub get.

🔧 Setup

Set the minimum SDK version to 21 or higher in your android/app/build.gradle file:

android {
    defaultConfig {
        ...
        minSdkVersion 21 // Set this to 21 or higher
        ...
    }
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="...">
  ...

  <application
        ...
        ...>

        <activity
            ...
            ...>

        <!--Add this-->
        <service
            android:name="com.flutter.device_screenshot.src.MediaProjectionService"
            android:enabled="true"
            android:exported="false"
            android:foregroundServiceType="mediaProjection"
            android:permission="TODO"
            android:stopWithTask="false"
            />
        <!--end-->

        ...
  ...
  </application>
</manifest>

Import the package:

import 'package:device_screenshot/device_screenshot.dart';

Use the singleton instance of DeviceScreenshot to access all the available methods, for example:

DeviceScreenshot.instance.checkMediaProjectionService()

📱 To take screenshot

At first you need to run foreground service and for this

DeviceScreenshot.instance.requestMediaProjection()

Now you are ready to take your Device Screenshot.

Uri? uri = await DeviceScreenshot.instance.takeScreenshot()

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.0.2

原始碼儲存庫

使用此套件的專案

暫無相關資料。