Skip to content

Instantly share code, notes, and snippets.

@stegrams
Last active May 11, 2020 18:44
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 stegrams/c597de94bccf7b6204f1b0645e09758e to your computer and use it in GitHub Desktop.
Save stegrams/c597de94bccf7b6204f1b0645e09758e to your computer and use it in GitHub Desktop.
Grid view sample with 2 texts per row.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: GridView.count(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
crossAxisCount: 2,
childAspectRatio: 2,
children: <Widget>[
...[Text('15.00'), Text('AJC Bose Rd Flyover Connector')],
...[Text('15.45'), Text('Shibpur B.E College')],
...[Text('16.00'), Text('Kona Express & Ichapur Road')],
...[Text('16.05'), Text('Ichapur Water Tank Howrah')],
...[Text('16.15'), Text('Mandirtala')],
...[Text('16.15'), Text('Mandirtala')],
...[Text('16.15'), Text('Mandirtala')],
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment