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

bubble_box 封面
插件详情v0.5.3

bubble_box

一个功能强大的气泡框,实现了基本气泡、边框、虚线、渐变色、角度、自适应宽高、气泡方向、偏移等特性。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1250
喜欢数
52
Pub 分数
150

安装插件

flutter pub add bubble_box

插件介绍

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

Bubble Box 是一个 Flutter 包,使开发者能够创建视觉上吸引人的气泡形状容器,具有可自定义的特性,如边框、虚线、渐变、角度、自适应大小和方向偏移。它支持多个平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。该包简化了动态、时尚 UI 元素的实现,非常适合用于提示工具、徽章或交互式设计组件。通过直观的配置选项,它在无需复杂自定义绘图的情况下提升了用户界面的美观性。

适合场景

  • 创建动画提示
  • 设计聊天气泡
  • 构建交互式徽章
  • 通过渐变效果增强用户界面
  • 实现响应式气泡布局

主要特点

  • 可自定义气泡方向
  • 自适应宽度和高度
  • 渐变颜色支持
  • 虚线边框
  • 角度和偏移调整
  • 平台跨兼容性

适合对象

  • 寻求视觉魅力的UI设计师
  • 开发聊天界面的开发者
  • 需要动态徽章组件的应用程序
  • 注重视觉效果的项目
  • 跨平台移动和网页应用

使用建议

  • 过度使用可能影响性能
  • 需要仔细的布局管理
  • 除了基本示例外,文档有限
  • 不适合简单的矩形形状

原始 README

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

pub package

English 中文

bubble_box

A powerful bubble box, which implements basic bubble, border, dotted line, gradient color, angle, adaptive width and height, bubble direction, offset, etc.

This project was wrote with pure dart code,which means it's support both iOS As well as Android, web, windows, linux, etc.

Modified a lot of APIs, please pay attention to upgrade

Screenshot

Basic Components

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.8,
    child: Text('I am a basic component application example'),
)

Customize the border color, width, and component background color

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.8,
    shape: BubbleShapeBorder(
      border: BubbleBoxBorder(
        color: Colors.blue,
        width: 3,
      ),
      position: const BubblePosition.center(0),
      direction: BubbleDirection.right,
    ),
    backgroundColor: Colors.green.withOpacity(0.8),
    child: Text('I can customize the color and width of the border, the background color of the component, the position of the sharp corner of the bubble and the offset of the sharp corner'),
  )

Define the border as a dashed line and the border color gradient

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.8,
    gradient: LinearGradient(
      colors: [
        Colors.pink,
        Colors.orange[700],
      ],
    ),
    blendMode: BlendMode.srcATop,
    shape: BubbleShapeBorder(
      border: BubbleBoxBorder(
        gradient: LinearGradient(
          colors: [
            Colors.pink,
            Colors.orange[700],
          ],
        ),
        width: 3,
        style: BubbleBoxBorderStyle.dashed,
      ),
      direction: BubbleDirection.left,
      position: const BubblePosition.start(12),
    ),
    margin: EdgeInsets.all(4),
    elevation: 5,
    shadowColor: Colors.redAccent,
    child: Text(
        'However, I can not only customize the border and sharp corners of the bubble. I can also define the border as a dashed line and a gradient of border color. \nI am adaptive to the content, there is no need to set the width and height. Of course, you can limit the maximum width and height of the component. \nMy content can also be faded. \nIn addition, you may need some shadows, and the shadows may also need some of their own colors.'),
  )

background color gradient

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.85,
    elevation: 5,
    gradient: LinearGradient(colors: [
      Colors.red,
      Colors.orange[700],
      Colors.orange[500],
    ]),
    shape: BubbleShapeBorder(
      border: BubbleBoxBorder(
        gradient: LinearGradient(
          colors: [
            Colors.pink,
            Colors.orange[700],
          ],
        ),
        color: Colors.blue,
        width: 3,
        style: BubbleBoxBorderStyle.dashed,
      ),
      direction: BubbleDirection.none,
      position: const BubblePosition.start(12),
    ),
    margin: EdgeInsets.all(4),
    child: Text(
      'my background can actually fade',
    ),
  ),

obtuse angle

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.85,
    shape: BubbleShapeBorder(
      direction: BubbleDirection.left,
      position: const BubblePosition.start(12),
      arrowQuadraticBezierLength: 2,
    ),
    backgroundColor: Color(0xff98E165),
    margin: EdgeInsets.all(4),
    child: Text(
      'We added new obtuse angles so that the triangles are no longer so sharp',
    ),
  ),

enhanced radius

BubbleBox(
    maxWidth: MediaQuery.of(context).size.width * 0.85,
    backgroundColor: Color(0xff98E165),
    margin: EdgeInsets.all(4),
    shape: BubbleShapeBorder(
      radius: BorderRadius.only(
          topRight: Radius.elliptical(30, 15),
          bottomLeft: Radius.elliptical(30, 15)),
    ),
    child: Text(
      'We have made some modifications to the border radius to make it more free',
    ),
  ),

所属分类

源码仓库

使用此插件的项目

暂无相关数据。