搜索插件、代码仓与 APP 分类

floating_bubbles 封面
插件详情v2.6.2

floating_bubbles

一个用于在任何 Flutter 小部件的前景上添加浮动气泡的 Flutter 包。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1200
喜欢数
87
Pub 分数
150

安装插件

flutter pub add floating_bubbles

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Floating Bubbles 是一个 Flutter 包,可让开发者在任何 widget 的前景上添加动画浮动气泡。这些气泡可以自定义颜色、大小和运动模式,创造出适合背景或交互式界面的动态视觉效果。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,适用于跨平台应用。它轻量且易于集成,只需使用简单的 widget 包装器即可。

适合场景

  • 增强应用启动画面
  • 创建有趣的用户界面元素
  • 向仪表板添加背景动画
  • 通过细微的动态效果提升用户参与度
  • 设计主题着陆页

主要特点

  • 可自定义的气泡颜色和大小
  • 平滑浮动动画
  • 跨平台兼容性
  • 与现有控件的轻松集成
  • 可配置的速度和方向

适合对象

  • 寻求视觉魅力的UI设计师
  • 开发人员构建引人入胜的引导体验
  • 需要轻量级、非侵入式动画的应用程序
  • 具有艺术主题的创意数字产品
  • 致力于现代流畅界面设计的项目

使用建议

  • 可能会影响低端设备的性能
  • 如果使用过度,气泡可能会分散对核心内容的注意力
  • 需要仔细考虑颜色对比度以确保可读性
  • 不适合用于对可访问性要求较高的应用程序
  • 对单个气泡行为的控制有限

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Floating Bubbles Build Status

pub version GitNFT

A Flutter Package for adding Floating bubbles in the Foreground to a widget.

Getting Started

In your flutter project(in pubspec.yaml) add the dependency:

dependencies:
  floating_bubbles: ^2.6.2

Import the package:

import 'package:floating_bubbles/floating_bubbles.dart';

Usage

Here is an snippet on how to use Floating Bubbles to any Widget.

Creating FloatingBubbles() (this creates the animation and plays for amount of time you give as the duration.)
 return Stack(
    children: [
     Positioned.fill(
        child: Container(
        color: Colors.red,
      ),
     ),
     Positioned.fill(
         child: FloatingBubbles(
         noOfBubbles: 25,
         colorsOfBubbles: [
            Colors.green.withAlpha(30),
            Colors.red,
         ],
         sizeFactor: 0.16,
         duration: 120, // 120 seconds.
         opacity: 70,
         paintingStyle: PaintingStyle.stroke,
         strokeWidth: 8,
         shape: BubbleShape.circle, // circle is the default. No need to explicitly mention if its a circle.
         speed: BubbleSpeed.normal, // normal is the default
    ),
 );

Creating FloatingBubbles.alwaysRepeating() (Creates Floating Bubbles that always floats and doesn't stop.)
return Stack(
   children: [
    Positioned.fill(
       child: Container(
       color: Colors.red,
     ),
    ),
    Positioned.fill(
        child: FloatingBubbles.alwaysRepeating(
        noOfBubbles: 25,
         colorsOfBubbles: [
            Colors.green.withAlpha(30),
            Colors.red,
         ],
        sizeFactor: 0.16,
        opacity: 70,
        paintingStyle: PaintingStyle.fill,
        shape: BubbleShape.square,
        speed: BubbleSpeed.normal,

   ),
);

Parameters:

For Creating FloatingBubbles()
Name Description Is It Required Default Value
noOfBubbles No. of Bubbles to be present in the screen at a given Time Yes -
colorsOfBubbles List of colors for the bubbles. Colors are selected randomly for each bubble. Yes -
sizeFactor Size Factor of each bubbles Yes -
duration Duration to play the animation (input is taken as seconds) Yes -
opacity Opacity of the bubbles No 60
paintingStyle Painting Style of the bubbles. No PaintingStyle.fill
strokeWidth Stroke Width of the bubbles. This value is effective only if Painting Style is set to PaintingStyle.stroke. No 0
shape Shape of the bubbles. No BubbleShape.circle
speed Control the speed of the bubbles. No BubbleSpeed.normal

For Creating FloatingBubbles.alwaysRepeating()
Name Description Is It Required Default Value
noOfBubbles No. of Bubbles to be present in the screen at a given Time Yes -
colorsOfBubbles List of colors for the bubbles. Colors are selected randomly for each bubble. Yes -
sizeFactor Size Factor of each bubbles Yes -
opacity Opacity of the bubbles No 60
paintingStyle Painting Style of the bubbles. No PaintingStyle.fill
strokeWidth Stroke Width of the bubbles. This value is effective only if Painting Style is set to PaintingStyle.stroke. No 0
shape Shape of the bubbles. No BubbleShape.circle
speed Control the speed of the bubbles. No BubbleSpeed.normal

Example

The code for the Example shown below is here.


As the Gifs here are converted from mp4, there are some stutters. To see the MP4 format of these Gifs Click Here.

Platforms on which this package was tested.

Platform Supported Comments
Android Yes Works without any issues
IOS Yes Works without any issues
Web Yes (kinda) Works when using web renderer engine as html. use the command flutter run -d chrome --web-renderer html / flutter build web --web-renderer html
Windows Yes Works without any issues
Linux Not yet tested -
MacOS Not yet tested -

Stress Test

Stress Test has been done on this package. Below is the information(fps) on how the performance of the package when the animation was coupled with a heavy rive animation.

Average FPS of the UI when the package was stress tested on a low-end Android Phone

APP build in Debug Mode

APP build in Release Mode


Average FPS of the UI when the package was stress tested on a High-end Android Phone

APP build in Release Mode

Performance improvements will be made in the coming updates to make this package more suitable for low end devices. If you have any suggestions or ideas, just pull request :)


About Me

Support

Give a ⭐/👍 if you liked the work!! :) Suggestions are Welcome. Any issues just open an issue in Github. I will reach you as soon as possible.

License

The Scripts and Documentation in this project are released under the MIT License

所属分类

依赖

依赖清单 1 项

  • sa4_migration_kit^1.0.0

源码仓库

使用此插件的项目