ontap function in flutter on row code example

Example 1: flutter how to add ontap on container

You can wrap your Container in an InkWell or GestureDetector.
The difference is that InkWell is a material widget that shows
a visual indication that the touch was received,
whereas GestureDetector is a more general purpose widget that shows no visual
indicator.

GestureDetector(
    onTap: () { 
        print("Click event on Container"); 
    },
    child: Container(.......),
)

Example 2: flutter make container clickable

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

Tags:

Misc Example