搜索插件、代码仓与 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.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。