flutter 中 如果给图片外面套 InkWell ,你会发现点击的逻辑生效了,但是 UI 上没反应
备注: 图片来源, 违反版权请联系我,删除
代码如下
import 'package:flutter/material.dart';
class ImageTapWidget extends StatefulWidget {
final Widget child;
final Function onTap;
const ImageTapWidget({
Key key, this.child, this.onTap}) : super(key: key);
@override
ImageTapWidgetState createState() {
return new ImageTapWidgetState();
}
}
class ImageTapWidgetState extends State<ImageTapWidget> {
var isDown = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
child: AnimatedContainer(
duration: Duration(milliseconds: 500),
foreground