我有这个容器:
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()触发一种方法(例如,可以使用IconButton)。我怎样才能做到这一点Container呢?
Container
onPressed()
IconButton
我猜你可以GestureDetector像这样使用小部件:
GestureDetector
new GestureDetector( onTap: (){ print("Container clicked"); }, child: 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"), ] ), ) );