Skip to content

Instantly share code, notes, and snippets.

@vizioners
Last active April 10, 2019 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vizioners/9b4f6ebd1e7d1f44ab04da24fd8d915d to your computer and use it in GitHub Desktop.
Save vizioners/9b4f6ebd1e7d1f44ab04da24fd8d915d to your computer and use it in GitHub Desktop.
gird view demo
new GridView.builder(
itemCount: 5,
gridDelegate:
new SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3),
itemBuilder: (BuildContext context, int index) {
return new GestureDetector(
child: new Card(
elevation: 5.0,
child: new Container(
alignment: Alignment.center,
child: new Text('Item $index'),
),
),
onTap: () {
showDialog(
context: context,
barrierDismissible: false,
child: new CupertinoAlertDialog(
title: new Column(
children: <Widget>[
new Text("Girdview"),
new Icon(
Icons.favorite,
color: Colors.green,
)
],
),
content: new Text("Selected Item $index"),
actions: <Widget>[
new FlatButton(onPressed: () {
Navigator.of(context).pop();
},
child: new Text("OK")
)
],
)
);
},
);
}
),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment