Skip to content

Commit

Permalink
use ListView on small screens for example app
Browse files Browse the repository at this point in the history
  • Loading branch information
josxha committed Jan 31, 2024
1 parent f42425e commit 40bcd4e
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,41 @@ class SelectionPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final children = [
SelectionItemWidget(
title: 'flutter_map_cache',
desc: 'A slim yet powerful caching plugin for flutter_map '
'tile layers.',
pageBuilder: (context) => const FlutterMapCachePage(),
),
SelectionItemWidget(
title: 'flutter_map_pmtiles',
desc: 'PMTiles for flutter_map',
pageBuilder: (context) => const FlutterMapPmTilesPage(),
),
SelectionItemWidget(
title: 'vector_map_tiles_pmtiles',
desc: 'PMTiles for vector_map_files / flutter_map',
pageBuilder: (context) => VectorMapTilesPmTilesPage(),
),
];

final size = MediaQuery.sizeOf(context);

if (size.width > 900) {
return Padding(
padding: const EdgeInsets.all(8),
child: GridView.count(
crossAxisCount: 2,
childAspectRatio: 5,
children: children,
),
);
}
return Padding(
padding: const EdgeInsets.all(8),
child: GridView.count(
crossAxisCount: 2,
childAspectRatio: 5,
children: [
SelectionItemWidget(
title: 'flutter_map_cache',
desc: 'A slim yet powerful caching plugin for flutter_map '
'tile layers.',
pageBuilder: (context) => const FlutterMapCachePage(),
),
SelectionItemWidget(
title: 'flutter_map_pmtiles',
desc: 'PMTiles for flutter_map',
pageBuilder: (context) => const FlutterMapPmTilesPage(),
),
SelectionItemWidget(
title: 'vector_map_tiles_pmtiles',
desc: 'PMTiles for vector_map_files / flutter_map',
pageBuilder: (context) => VectorMapTilesPmTilesPage(),
),
],
child: ListView(
children: children,
),
);
}
Expand Down

0 comments on commit 40bcd4e

Please sign in to comment.