File tree Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Expand file tree Collapse file tree 1 file changed +20
-14
lines changed Original file line number Diff line number Diff line change 1
1
import 'package:flutter/material.dart' ;
2
2
3
3
class MyGridView {
4
- Card getStructuredGridCell (name, image) {
5
- return Card (
6
- elevation: 1.5 ,
7
- child: Column (
8
- crossAxisAlignment: CrossAxisAlignment .stretch,
9
- mainAxisSize: MainAxisSize .min,
10
- verticalDirection: VerticalDirection .down,
11
- children: < Widget > [
12
- Image (image: AssetImage ('data_repo/img/' + image)),
13
- Center (
14
- child: Text (name),
15
- )
16
- ],
17
- ));
4
+ GestureDetector getStructuredGridCell (name, image) {
5
+ // Wrap the child under GestureDetector to setup a on click action
6
+ return GestureDetector (
7
+ onTap: () {
8
+ print ("onTap called." );
9
+ },
10
+ child: Card (
11
+ elevation: 1.5 ,
12
+ child: Column (
13
+ crossAxisAlignment: CrossAxisAlignment .stretch,
14
+ mainAxisSize: MainAxisSize .min,
15
+ verticalDirection: VerticalDirection .down,
16
+ children: < Widget > [
17
+ Image (image: AssetImage ('data_repo/img/' + image)),
18
+ Center (
19
+ child: Text (name),
20
+ )
21
+ ],
22
+ )),
23
+ );
18
24
}
19
25
20
26
GridView build () {
You can’t perform that action at this time.
0 commit comments