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

expand_tap_area 封面
插件详情v1.1.1

expand_tap_area

手动扩展小部件的点击区域,而不会改变其大小或布局。类似于 iOS 开发中的 hitTest。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2.1万
喜欢数
60
Pub 分数
140

安装插件

flutter pub add expand_tap_area

插件介绍

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

expand_tap_area 包允许开发者手动增大小部件的可触摸区域,而不会改变其视觉大小或布局。这对于提高触摸设备上的可用性特别有用,尤其是对于小型交互元素。它模拟了 iOS 开发中的 hitTest 行为,使开发者能够精确控制手势识别区域。该包可在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上运行。

适合场景

  • 改进小按钮的触摸目标大小
  • 增强移动应用的可访问性
  • 为图标创建更大的触摸区域
  • 为运动功能障碍用户优化UI
  • 设计响应式触摸界面

主要特点

  • 非侵入式点击区域扩展
  • 无需布局更改
  • 跨平台兼容性
  • 简单的 API 集成
  • 支持自定义展开偏移量

适合对象

  • 移动应用开发者
  • 注重可访问性的项目
  • UI/UX 设计师
  • 跨平台 Flutter 应用

使用建议

  • 可能影响重叠手势检测
  • 需要仔细调整偏移量
  • 不适合复杂的手势链
  • 仅限点击交互
  • 如果展开过多,可能会造成视觉混淆

原始 README

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

ExpandTapArea

Manually expand the tap area of a widget without changing its size or layout. Similar with the hitTest in iOS development.

Context

In the Human Interface Guidelines, Apple recommends a minimum target size of 44 x 44 px. 
In the Android Material Design Guidelines, it’s suggested that touch targets should be at least 48 x 48 dp.

Inspired by issue

Usage

ExpandTapWidget(
  onTap: () {},
  tapPadding: EdgeInsets.all(25.0),
  child: smallWidget(),
),

Demo

Attention

  1. ExpandTapWidget can be wrapped inside/outside GestureDetector: To avoid the conflict of gesture, it is better to apply on the innermost/smallest widget.
  2. The expanded area wouldn't exceed the boundary of the Parent Box. You can set debugPaintExpandAreaEnabled = true to display the actual expanded area.

所属分类

源码仓库

使用此插件的项目