1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2025-11-08 20:50:04 +00:00

Setup on click action on GridView items

This commit is contained in:
Nishant Srivastava
2019-11-15 00:56:03 +01:00
parent 34747b99ab
commit 034178da5b

View File

@@ -1,8 +1,13 @@
import 'package:flutter/material.dart';
class MyGridView {
Card getStructuredGridCell(name, image) {
return Card(
GestureDetector getStructuredGridCell(name, image) {
// Wrap the child under GestureDetector to setup a on click action
return GestureDetector(
onTap: () {
print("onTap called.");
},
child: Card(
elevation: 1.5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -14,7 +19,8 @@ class MyGridView {
child: Text(name),
)
],
));
)),
);
}
GridView build() {