Flutter - Container onPressed?

dart, flutter, flutter-layout

Solution

You can use a `GestureDetector` widget like this:

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"),
              ]
          ),
        )
    );

Problem

I have this container: ``` 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"), ] ), ), ``` When the user clicks on the `Container`, I want an `onPressed()` method to be fired (like it can be done with `IconButton` for example). How can I achieve this behaviour with `Container`?

Original source

Related problems