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

overlay_pop_up 封面
套件詳情v1.0.6+6

overlay_pop_up

一個全新的 Flutter 插件,可在 Android 上即使應用已關閉或被終止時,仍能在其他應用之上顯示彈出視窗或畫面。

Android
近 30 天下載
21
喜歡數
53
Pub 分數
160

安裝套件

flutter pub add overlay_pop_up

套件介紹

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

一個 Flutter 插件,可在 Android 上顯示彈出視窗或覆蓋螢幕,即使應用程式已關閉或終止。它利用 Android 的系統層級覆蓋權限,在其他應用程式之上顯示內容,適用於通知、快速動作或持續性 UI 元素。此插件與 Flutter 無縫整合,需要使用者授權才能運作。專為 Android 設計,不支援 iOS。開發者可程式化自訂覆蓋層的外觀與行為。

適用情境

  • 顯示持久通知
  • 建立浮動操作面板
  • 應用在背景時顯示警告
  • 實現快速存取工具
  • 在其他應用中提供即時更新

主要特色

  • 即使應用被終止也能正常運作
  • 僅限 Android 的覆蓋層支援
  • 可自訂的覆蓋內容
  • 系統層級權限處理
  • 與 Flutter 的簡單整合

適合對象

  • 開發始終開啟的 UI 組件的開發者
  • 需要持久覆蓋的應用程式
  • 需要前景可見性
  • 通知增強的應用程式
  • 具有浮動介面的實用程式應用

使用建議

  • 需要 Android 系統覆蓋層權限
  • iOS 上不可用
  • 可能受到設備製造商的限制
  • 使用者必須手動啟用權限
  • 可能影響電池與效能

原始 README

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

overlay_pop_up

A new Flutter plugin to display pop ups or screens over other apps in Android even when app is closed or killed.

Buy Me A Coffee

Demo

Preview

Android

add this to your AndroidManifest.xml

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

 <application>
        ...
        <service
           android:name="com.requiemz.overlay_pop_up.OverlayService"
           android:exported="false" />
    </application>
Android 14

applications that target SDK 34 and use foreground service should include foregroundServiceType attribute(see documentation).

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

 <application>
        ...
        <service
           android:name="com.requiemz.overlay_pop_up.OverlayService"
           android:exported="false"
           <!-- add this -->
           android:foregroundServiceType="camera, dataSync, location, etc" />
    </application>

Flutter implementation

configure your main.dart entry point a widget to display (make sure to add @pragma('vm:entry-point'))

NOTE: Now you can pass as parameter the dart entry point method name when showOverlay is called

@pragma("vm:entry-point")
void overlayPopUp() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MaterialApp(
    debugShowCheckedModeBanner: false,
    home: Text('Hello Pub.dev!'),
  ));
}

Overlay Methods

returns true when overlay permission is alreary granted if permission is not granted then open app settings

await OverlayPopUp.requestPermission();

returns true or false according to permission status

await OverlayPopUp.checkPermission();

display your overlay and return true if is showed

PARAMS

  • height is not required by default is MATCH_PARENT

  • width is not required by default is MATCH_PARENT

  • verticalAlignment is not required by default is CENTER for more info see: https://developer.android.com/reference/android/view/Gravity

  • horizontalAlignment is not required by default is CENTER for more info see: https://developer.android.com/reference/android/view/Gravity

  • backgroundBehavior by default is focusable flag that is you can take focus inside a overlay for example inside a textfield and [tapThrough] you can tap through the overlay background even if has MATCH_PARENT sizes.

  • screenOrientation by default orientation is portrait.

  • closeWhenTapBackButton by default when user presses back button the overlay no has any action if you pass true then back button will close overlay.

  • isDraggable by default is false therefore the overlay can´t be dragged.

  • entryPointMethodName by default is 'overlayPopUp' if you want you can change it

    await OverlayPopUp.showOverlay();
    

    returns true if overlay closed correctly or already is closed

    await OverlayPopUp.closeOverlay();
    

    returns the overlay status true = open, false = closed

    await OverlayPopUp.isActive();
    

    returns the last overlay position if drag is enabled

    await OverlayPopUp.getOverlayPosition();
    

    share dynamic data to overlay

    await OverlayPopUp.sendToOverlay({'data':'hello!'});
    await OverlayPopUp.sendToOverlay('hello');
    

    receive the data from flutter as stream

    await OverlayPopUp.dataListener();
    

所屬分類

依賴

依賴清單 1 項

  • plugin_platform_interface^2.1.8

原始碼儲存庫

使用此套件的專案

暫無相關資料。