我有这个容器:
new Container( width: 500.0,padding: new EdgeInsets.fromLTRB(20.0,40.0,20.0,40.0),color: Colors.green,child: new Column( children: [ new Text("Ableitungen"),] ),),
当用户点击Container时,我想要触发onPressed方法(例如,可以使用IconButtons来完成).如何使用容器实现此行为?
提前致谢
解决方法
我想你可以像这样使用GestureDetector小部件:
new GestureDetector( onTap: (){ print("Container clicked"); },child: new Container( width: 500.0,] ),) );