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

套件詳情v2.0.0

proximity_sensor

僅用於接近感應器的簡單易用Flutter外掛套件

AndroidiOS
近 30 天下載
4.2萬
喜歡數
48
Pub 分數
160

安裝套件

flutter pub add proximity_sensor

套件介紹

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

proximity_sensor 套件是一個輕量級的 Flutter 插件,旨在簡化在 Android 和 iOS 設備上存取設備接近感應器的操作。它讓應用程式能夠偵測物體是否靠近裝置,常見用於通話期間自動關閉螢幕等功能。該套件提供一個簡單直覺的 API,設定簡單,非常適合希望實現基本接近偵測而不需額外複雜性的開發者。它支援兩大主要行動平台,並能順暢整合至現有的 Flutter 專案中。

適用情境

  • 通話期間自動螢幕變暗
  • 基於手勢的互動檢測
  • 接近觸發的應用行為
  • 設備方向感知
  • 從睡眠模式智能喚醒

主要特色

  • 簡單、極簡的 API
  • 跨平台支援(Android 與 iOS)
  • 即時接近事件監聽
  • 輕便且快速
  • 無額外依賴

適合對象

  • 需要接近檢測的移動應用
  • 呼叫介面增強
  • 物聯網裝置互動
  • 無障礙功能
  • 低階層傳感器整合

使用建議

  • 僅限接近感應器
  • 需要設備硬體支援
  • 不支援的設備沒有備用方案
  • 平台特定的行為差異
  • 傳感器精度可能因設備而異

原始 README

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

proximity_sensor

https://pub.dev/packages/proximity_sensor

simple and easy to use flutter plugin package for proximity sensor (only)

Getting started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  proximity_sensor:

In your library add the following import:

import 'package:proximity_sensor/proximity_sensor.dart';

Note

Android 12 and higher are required to specify an explicit value for android:exported
This is an example.

<activity
    android:exported="true"
    ....

(Android only) WAKE_LOCK permission is needed if you run setProximityScreenOff(true) before listening to events

Add below permission in your AndroidManifest.xml file.

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

Some recent devices use virtual proximity sensors. There are no physical sensors. I found it hard to trust the sensor information in this case.

所屬分類

原始碼儲存庫

使用此套件的專案