搜尋套件、儲存庫與 APP 分類

simple_tooltip 封面
套件詳情v1.2.0

simple_tooltip

一個用於建立提示工具的簡單程式庫

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
5560
喜歡數
78
Pub 分數
130

安裝套件

flutter pub add simple_tooltip

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個輕量級的 Flutter 套件,可輕鬆為 UI 元素新增工具提示。它提供簡單的 API,當使用者懸停或點擊特定元件時顯示資訊性浮出文字,以最少的設定提升使用者體驗。適合需要上下文指引但不需要複雜動畫或樣式之應用。支援所有主要平台,包含行動裝置、網頁與桌面。

適用情境

  • 向表單字段添加上下文幫助
  • 引導使用者了解應用功能
  • 透過描述性提示改善可訪問性
  • 增強儀表板提示工具
  • 在圖示上顯示快速資訊
  • 提供對互動元件的回饋

主要特色

  • 最小設定
  • 跨平台支援
  • 可自定義的提示框外觀
  • 支援點按和懸停互動
  • 輕量且快速
  • 與現有組件的輕鬆整合

適合對象

  • 初學者 Flutter 開發者
  • 需要簡單提示的 App
  • 注重可存取性的設計
  • 原型與快速開發
  • 資訊密度較高的介面佈局

使用建議

  • 有限的高級動畫選項
  • 在複雜佈局中,可能需要手動調整工具提示的位置
  • 無內建的鍵盤導航支援
  • 最適合基本使用案例
  • 可能需要額外的樣式以與設計系統保持一致

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

simple_tooltip

A plugin for creating tooltips with shape of a balloon

You can customize multiple elements

💻 Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  simple_tooltip: <latest version>

Usage

Basic

You can get started really simple, just add

Basic

SimpleTooltip(
        tooltipTap: () {
        print("Tooltip tap");
        },
        animationDuration: Duration(seconds: 3),
        show: true,
        tooltipDirection: TooltipDirection.up,
        child: Container(
        width: 200,
        height: 120,
        child: Placeholder(),
        ),
        content: Text(
        "Some text example!!!!",
        style: TextStyle(
            color: Colors.black,
            fontSize: 18,
            decoration: TextDecoration.none,
        ),
        ),
    ),

Full Api

/// The [child] which the tooltip will target to
  final Widget child;

  /// Sets the tooltip direction
  /// defaults to [TooltipDirection.up]
  final TooltipDirection tooltipDirection;

  /// Defines the content that its placed inside the tooltip ballon
  final Widget content;

  /// If true, it will display the tool , if false it will hide it
  final bool show;

  /// Sets the content padding
  /// defautls to: `const EdgeInsets.symmetric(horizontal: 20, vertical: 16),`
  final EdgeInsets ballonPadding;

  /// sets the duration of the tooltip entrance animation
  /// defaults to [460] milliseconds
  final Duration animationDuration;

  /// [top], [right], [bottom], [left] position the Tooltip absolute relative to the whole screen
  double top, right, bottom, left;

  /// [minWidth], [minHeight], [maxWidth], [maxHeight] optional size constraints.
  /// If a constraint is not set the size will ajust to the content
  double minWidth, minHeight, maxWidth, maxHeight;

  ///
  /// The distance of the tip of the arrow's tip to the center of the target
  final double arrowTipDistance;

  ///
  /// The length of the Arrow
  final double arrowLength;

  ///
  /// the stroke width of the border
  final double borderWidth;

  ///
  /// The minium padding from the Tooltip to the screen limits
  final double minimumOutSidePadding;

  ///
  /// The corder radii of the border
  final double borderRadius;

  ///
  /// The width of the arrow at its base
  final double arrowBaseWidth;

  ///
  /// The color of the border
  final Color borderColor;

  ///
  /// The color of the border
  final Color backgroundColor;

  ///
  /// Set a custom list of [BoxShadow]
  /// defaults to `const BoxShadow(color: const Color(0x45222222), blurRadius: 8, spreadRadius: 2),`
  final List<BoxShadow> customShadows;

  ///
  /// Set a handler for listening to a `tap` event on the tooltip (This is the recommended way to put your logic for dismissing the tooltip)
  final Function() tooltipTap;

  ///
  /// If you want to automatically dismiss the tooltip whenever a user taps on it, set this flag to [true]
  /// For more control on when to dismiss the tooltip please rely on the [show] property and [tooltipTap] handler
  /// defaults to [false]
  final bool hideOnTooltipTap;

  ///
  /// Pass a `RouteObserver` so that the widget will listen for route transition and will hide tooltip when
  /// the widget's route is not active
  final RouteObserver<PageRoute> routeObserver;

Screenshots

Animated
This plugin was inspired by super_tooltip

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。