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

speech_bubble 封面
插件详情v0.0.9

speech_bubble

一个在 Flutter 中模拟气泡对话框的部件。

AndroidiOS
近 30 天下载
137
喜欢数
30
Pub 分数
150

安装插件

flutter pub add speech_bubble

插件介绍

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

一个模仿对话气泡外观的 Flutter 小部件,常用于聊天界面或需要对话元素的 UI。它提供了一种简单且可自定义的方式来显示文本,以圆润带尖角的容器形式呈现,类似于现实生活中的对话气泡。该小部件支持多种配置,如对齐方式、尾部位置和样式,非常适合用于消息应用或交互式 UI。它轻量级,并能无缝集成到现有的 Flutter 项目中。

适合场景

  • 聊天界面
  • 用户反馈显示
  • 交互式教程
  • 通知弹窗
  • 游戏对话框

主要特点

  • 可定制的尾巴位置
  • 圆角带指针
  • 灵活的对齐选项
  • 轻量且易于集成
  • 支持文本样式

适合对象

  • 消息应用
  • 教育类应用
  • UI 原型设计
  • 简单聊天组件
  • 社交媒体功能

使用建议

  • 仅限基本气泡设计
  • 无内置动画支持
  • 需要手动处理动态内容的大小调整
  • 不适合复杂的对话系统
  • 在小屏幕上,尾部位置可能需要调整

原始 README

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

SpeechBubble

A flutter widget that emulates a speech bubble.

This widget is modeled after the red Instagram notification popups.

Screenshot

Installing

Dart Pub: https://pub.dartlang.org/packages/speech_bubble#-installing-tab-

  1. Depend on it

    Add this to your package's pubspec.yaml file:

  speech_bubble: ^0.0.5
  1. Install it

    You can install packages from the command line:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

  1. Import it

    Now in your Dart code, you can use:

import 'package:speech_bubble/speech_bubble.dart';

Usage

Creates a widget that emulates a speech bubble. Could be used for a tooltip, or as a pop-up notification, etc.

Properties

  • child -> Widget

The child contained by the SpeechBubble.

  • nipLocation -> NipLocation

The location of the nip of the speech bubble. Use the NipLocation enum, either TOP, RIGHT, BOTTOM, or LEFT. The nip will automatically center to the side that it is assigned.

  • color -> Color

The color of the body of the SpeechBubble and nip. Defaultly red.

  • borderRadius -> double

The borderRadius of the SpeechBubble. The SpeechBubble is built with a circular border radius on all 4 corners.

  • height -> double

The explicitly defined height of the SpeechBubble. The SpeechBubble will defaultly enclose its child.

  • width -> double

The explicitly defined width of the SpeechBubble. The SpeechBubble will defaultly enclose its child.

  • padding -> Widget

The padding widget between the child and the edges of the SpeechBubble.

Example Code

import 'package:flutter/material.dart';
import 'package:speech_bubble/speech_bubble.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Center(
          child: new SpeechBubble(
            nipLocation: NipLocation.BOTTOM,
            // child: Column(
            //   mainAxisSize: MainAxisSize.min,
            //   children: <Widget>[
            //     Text("Give your users some guided instruction"),
            //     Text("From the inside of a Speech Bubble")
            //   ],
            // ),
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                Icon(
                  Icons.favorite,
                  color: Colors.white,
                ),
                Padding(
                  padding: const EdgeInsets.all(4.0),
                ),
                Text(
                  "1",
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 18.0,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

所属分类

源码仓库

使用此插件的项目

暂无相关数据。