main.dart
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
theme: ThemeData(primarySwatch: Colors.pink),
home: Scaffold(
appBar: AppBar(
title: const Text("Flutter - GridView onTap")
),
body: bodyContent()
)
)
);
}
bodyContent(){
return GridView.count(
crossAxisCount: 4,
children: List.generate(100, (index){
return InkWell(
onTap: (){
// do something here
},
child: Card(
color: Colors.green.shade300,
child: Center(
child: Text("${index+1}")
)
)
);
})
);
}
More flutter tutorials
- flutter – How to create horizontal GridView
- flutter – GridView horizontal scroll
- flutter – GridView in column
- flutter – GridView disable scroll
- flutter – Card padding
- flutter – Card with image
- flutter – Card with image and text
- flutter – Container decoration image
- flutter – Container clip behavior
- flutter – How to use InkResponse
- flutter – Column items equal height
- flutter – Column items stretch horizontally
- flutter – Column height wrap content
- flutter – Row space between
- flutter – Row height