Last active
August 21, 2020 12:52
-
-
Save e200/98b38239016b071acb024b3ea7072725 to your computer and use it in GitHub Desktop.
GridView with load indicator at the end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(LazyGridViewApp()); | |
} | |
class LazyGridViewApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text('Lazy Grid View'), | |
), | |
body: CustomScrollView( | |
slivers: [ | |
SliverGrid.count( | |
crossAxisCount: 3, | |
children: List.generate( | |
42, | |
(index) => Container( | |
color: Colors.blue.withOpacity(index.isEven ? .1 : .4), | |
child: Center( | |
child: Text(index.toString()), | |
), | |
), | |
), | |
), | |
SliverToBoxAdapter( | |
child: Center( | |
child: Padding( | |
padding: const EdgeInsets.all(15), | |
child: CircularProgressIndicator(), | |
), | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment