Skip to content

Instantly share code, notes, and snippets.

@e200
Last active August 21, 2020 12:52
Show Gist options
  • Save e200/98b38239016b071acb024b3ea7072725 to your computer and use it in GitHub Desktop.
Save e200/98b38239016b071acb024b3ea7072725 to your computer and use it in GitHub Desktop.
GridView with load indicator at the end
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