通过GestureDetector可以将container这类的组件也加上按钮的效果。
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('You have pushed this button many times'),
Text('test2'),
GestureDetector(
onTap: (){
print('1111');
},
onDoubleTap: (){
print('double click');
},
child: Container(
width: 200,
height: 200,
color: Colors.red,
),
)
],
),
),