一个用于扩展点击测试区域的 Flutter 包。提供了几个默认小部件,可以轻松自定义
用法
通过扩展 InkWell 的默认小部件
ExpandInkWell(
expandArea:const EdgeInsets.all(30),
onTap: () {
debugPrint("expand inkwell tap");
},
child: Container(color: Colors.red, height: 100, width: 100))
通过扩展 GestureDetector 的默认小部件
ExpandGestureDetector(
expandArea:const EdgeInsets.all(30),
onTap: () {
debugPrint("expand GestureDetector tap");
},
child: Container(color: Colors.red, height: 100, width: 100))
自定义
ExpandHitTestWidget(
expandArea:const EdgeInsets.all(30),
child: CupertinoButton(padding: EdgeInsets.zero,child: Container(color: Colors.red, height: 100, width: 100),
onPressed: () {
debugPrint("expand CupertinoButton tap");
}))
需要超越父级
ExpandHitTestScope(child: xxxxx)