mirror of
https://github.com/nisrulz/flutter-examples.git
synced 2025-09-24 16:44:06 +08:00
Setup on click action on GridView items
This commit is contained in:
@ -1,8 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class MyGridView {
|
class MyGridView {
|
||||||
Card getStructuredGridCell(name, image) {
|
GestureDetector getStructuredGridCell(name, image) {
|
||||||
return Card(
|
// Wrap the child under GestureDetector to setup a on click action
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
print("onTap called.");
|
||||||
|
},
|
||||||
|
child: Card(
|
||||||
elevation: 1.5,
|
elevation: 1.5,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
@ -14,7 +19,8 @@ class MyGridView {
|
|||||||
child: Text(name),
|
child: Text(name),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
));
|
)),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
GridView build() {
|
GridView build() {
|
||||||
|
Reference in New Issue
Block a user