最佳答案
Been developing a flutter app and dynamicly building some containers from some Firebase data. I wanted to know if there is a way to get a onTap method for containers (or any widget which is not a button ?
Here is a code sample :
child: new Container(
//INSERT ONTAP OR ONPRESSED METHOD HERE
margin: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Container(
margin: const EdgeInsets.only(right: 16.0),
child: new GoogleUserCircleAvatar(snapshot.value['images'][0]),
),
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children : [
new Container(
padding: const EdgeInsets.only(bottom: 8.0),
child: new Text("${snapshot.value['name']}",
style: new TextStyle(
fontWeight: FontWeight.bold,
),
),
),
new Text("${snapshot.value['description']}",
style: new TextStyle(
color: Colors.grey[500],
),
),
]
)
],
),