搜尋套件、儲存庫與 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,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。