Skip to content

Instantly share code, notes, and snippets.

@MarcinusX MarcinusX/main.dart Secret
Created Dec 30, 2018

Embed
What would you like to do?
[...]
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Grid to Pager')),
body: Stack(
children: <Widget>[
_buildGridView(),
],
),
);
}
Widget _buildGridView() {
return GridView.count(
crossAxisCount: 2,
children: images.map((imageName) {
return Card(
child: Center(
child: Image.asset("assets/$imageName"),
),
);
}).toList(),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.