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

dash_bubble 표지
패키지 상세v2.0.0

dash_bubble

다시 버블은 화면에 부유하는 버블을 만들 수 있는 플러터 플러그인입니다.

Android
30일 다운로드
146
좋아요
144
Pub 점수
160

패키지 설치

flutter pub add dash_bubble

패키지 개요

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

다시 버블은 개발자가 앱 화면에 부유형으로 상호작용 가능한 버블 위젯을 추가할 수 있도록 해주는 플러터 플러그인입니다. 간단함과 사용자 정의를 위해 설계되었으며, 화면 어디든 배치 가능하며 빠른 작업이나 시각적 강화에 사용할 수 있습니다. 이 버블은 가볍고 기존 레이아웃에 원활하게 통합됩니다. 특히 플로팅 액션 버튼이나 알림 표시기와 같은 직관적인 UI 요소를 만들 때 유용합니다. 이 플러그인은 안드로이드 기기와 호환되며 moaz.dev에서 유지보수되고 있습니다.

사용 사례

  • 플로팅 액션 트리거
  • 빠른 액세스 위젯
  • 알림 표시기
  • 사용자 정의 오버레이 요소
  • 앱 탐색 보조 기능

주요 기능

  • 플로팅 버블 위치 지정
  • 사용자 정의 가능한 외관
  • 간단한 통합
  • 안드로이드 전용 지원
  • 경량 설계

적합한 대상

  • 간단한 사용자 인터페이스 개선
  • 모바일 앱 프로토타이핑
  • 인터랙티브 오버레이
  • 미니멀리스트 디자인 앱
  • 안드로이드 중심 프로젝트

고려 사항

  • 안드로이드 플랫폼에 제한됨
  • iOS 지원 없음
  • 기본 사용자 정의 옵션
  • 복잡한 상호작용에 적합하지 않습니다
  • 수동 위치 지정 로직이 필요합니다

원본 README

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

Dash Bubble Banner

Dash Bubble

Platform Pub Package License: BSD-3-Clause
GitHub code size in bytes Star on GitHub GitHub Open Issues GitHub Last Commit Date


💡 Overview

A Flutter plugin that allows you to create a floating bubble on the screen built on top of Floating-Bubble-View library for Android.

The plugin currently supports Android only and doesn't support IOS because the feature of drawing over other apps is not available there


Animated Example
This GIF is taken from the Example Project

🚧 Breaking Changes

v2.0.0
  • 🚚 rename requestPermission() method to requestOverlayPermission().
  • 🚚 rename hasPermission() method to hasOverlayPermission().
  • 🚚 rename options parameter in startBubble() method to bubbleOptions.
  • ✨ add notificationOptions parameter to startBubble() method and move the notification options from bubbleOptions to the new notificationOptions.
  • 🛂 starting from Android 13 (Tiramisu), the service notification will not be shown unless the POST_NOTIFICATIONS permission is granted at the runtime, refer to the Service Notification section for details.
v1.0.0
  • 🚚 rename onBubbleTap() callback to onTap() in startBubble() method.
  • ✨ convert the values of startLocationX and startLocationY to be in density-independent pixels (dp) instead of pixels (px) as per Flutter convention.

🔧 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
        ...
    }
}

The plugin uses these two permissions but you don't need to add them to your AndroidManifest.xml file because the plugin will add them automatically:

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

💻 Usage

Import the package:

import 'package:dash_bubble/dash_bubble.dart';

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

DashBubble.instance.requestPermission()
DashBubble.instance.startBubble()

📘 You can checkout the complete API Reference here

🧰 Available Methods

Notes
  • All the methods are asynchronous and has a return type of Future<bool>.
  • All the methods returns false if the platform is not Android.
Method Description Parameters Behavior Notes
requestOverlayPermission() Requests the permission to draw over other apps (Overlay) - Returns true if the permission is granted, false otherwise If the permission is already granted, this method will return true without asking the user

In Android versions prior to Android 6.0 (M), this method will return true without asking the user
hasOverlayPermission() Checks if the permission to draw over other apps is granted (Overlay) - Returns true if the permission is granted, false otherwise In Android versions prior to Android 6.0 (M), this method will always return true
requestPostNotificationsPermission() Requests the permission to post notifications (Used to customize the Service Notification) - Returns true if the permission is granted, false otherwise

If the Android version is prior to Android 13 (Tiramisu), or if the permission is already granted, this method will return true without asking the user.
The user can be asked for the permission only twice, if the user denied the permission twice, the function would not be able to ask for the permission anymore and it will return false, however, the user can still grant the permission manually from the app settings page.

Starting from Android 13 (Tiramisu), the service notification will not be shown unless the POST_NOTIFICATIONS permission is granted at the runtime
hasPostNotificationsPermission() Checks if the permission to post notifications is granted - Returns true if the permission is granted, false otherwise If the Android version is prior to Android 13 (Tiramisu), this method will always return true
isRunning() Checks if the bubble is currently running - Returns true if the bubble is running, false otherwise The bubble is considered running if it is visible on the screen
startBubble() Starts the bubble BubbleOptions? bubbleOptions

NotificationOptions? notificationOptions

Available Callbacks
Returns true if the bubble started successfully, false otherwise If the bubble is already running or the permission is not granted, this method will return false
stopBubble() Stops the bubble - Returns true if the bubble stopped successfully, false otherwise If the bubble is not running, this method will return false

📝 Bubble Customization Options

Note: All the options are optional and you can pass only the options you want to customize.

Option Description Default Notes
bubbleIcon The icon of the bubble null The icon is set as an image file placed inside android\app\src\main\res\drawable\ and the value of the parameter should be the the file name without the extension

If not provided, the icon will be the plugin icon
closeIcon The icon of the close button null The icon is set as an image file placed inside android\app\src\main\res\drawable\ and the value of the parameter should be the the file name without the extension

If not provided, there will be a default close icon
startLocationX The initial starting position of the bubble on the x axis 0 -
startLocationY The initial starting position of the bubble on the y axis 200 -
bubbleSize The size of the bubble 60 -
opacity The opacity of the bubble 1.0 The value must be between 0.0 and 1.0
enableClose Whether to show the close button or not true -
closeBehavior The behavior of the close button CloseBehavior.following The value must be a member of CloseBehavior enum

Available values:
CloseBehavior.following
CloseBehavior.fixed
distanceToClose The distance between the bubble and the bottom edge of the screen to show the close button 100 -
enableAnimateToEdge Whether to animate the bubble to the edge of the screen when it is dragged to the edge of the screen or not true -
enableBottomShadow Whether to show the bottom shadow behind the close button of the bubble or not true -
keepAliveWhenAppExit Whether to keep the bubble alive when the app is closed or not false -

📞 Available Callbacks

Note: All the callbacks are optional and they all can be passed as parameters to the startBubble() method.

Callback Description Parameters Notes
onTap Called when the bubble is tapped - -
onTapDown Called when the bubble is tapped down (pressed) double x
double y
The parameters x and y are the coordinates of the bubble when it is tapped down
onTapUp Called when the bubble is tapped up (released) double x
double y
The parameters x and y are the new coordinates of the bubble after it is tapped up
onMove Called when the bubble is moved double x
double y
The parameters x and y are the new coordinates of the bubble after it is moved

🔔 Service Notification

The service notification is a non-dismissible notification that is shown when the bubble is running to keep the service alive.

The notification is shown automatically when the bubble is started and hidden automatically when the bubble is stopped.

Currently, their is no way to disable the notification.

Note: Starting from Android 13 (Tiramisu), the POST_NOTIFICATIONS permission must be granted to show the notification, however, you don't need to add the permission to the AndroidManifest.xml file because it is already added by the plugin, but you need to request it at the runtime, otherwise the notification will not be shown.

This permission can be requested by calling requestPostNotificationsPermission() method and can be checked by calling hasPostNotificationsPermission() method.

If the permission is not granted, the notification will not be shown but the bubble will still work normally.

Customization Options

The service notification can be optionally customized by passing a notificationOptions parameter to the startBubble() method.

Note: All the options are optional and you can pass only the options you want to customize. Here is a list of the available options in the notificationOptions parameter:

Option Description Default Notes
id The id of the service notification 101 -
title The title of the service notification null If not provided, the title will be the app name
body The body of the service notification null If not provided, there will be no notification body
icon The icon of the service notification null The icon is set as an image file placed inside android\app\src\main\res\drawable\ and the value of the parameter should be the the file name without the extension

If not provided, the icon will be the plugin icon
channelId The channel id of the service notification bubble_notification -
channelName The channel name of the service notification Bubble Notification -

✅ Roadmap

  • [ ] Add Tests 🧪
  • [ ] Implement a ready-to-use AppBubble which starts automatically when the app is on the background and stops when the app is on the foreground and has the ability to bring the app to the foreground when the bubble is tapped 📱
  • [ ] Ability to pass a Widget as the bubbleIcon and closeIcon 💪🏻
  • [ ] Implement the ExpandableView feature in the original library ⚡
  • [x] Implement the the rest of the available callbacks in the original library onMove(x,y), onUp(x,y), and onDown(x,y) 🔗

💪🏻 Contribution Guide

I would be happy to have your contributions 💙

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an Issue.
If you fixed a bug or implemented a feature, please send a Pull Request.

Made with contrib.rocks.

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.0.2

소스 저장소

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

아직 데이터가 없습니다.