flutter container onclick code example

Example 1: clickable container flutter

GestureDetector(
    onTap: () { 
        print("Tapped a Container"); 
    },
    child: Container(...),
)

Example 2: flutter onpressed Container

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

Example 3: flutter onclick container

InkWell(
  onTap: () {}, // Handle your callback
  child: Ink(height: 100, width: 100, color: Colors.blue),
)

Tags:

Dart Example