Skip to content

Instantly share code, notes, and snippets.

@jimit24365
Created February 16, 2020 06:17
Show Gist options
  • Save jimit24365/602e856eb3279421aec3b1dcbc06738c to your computer and use it in GitHub Desktop.
Save jimit24365/602e856eb3279421aec3b1dcbc06738c to your computer and use it in GitHub Desktop.
InFiniteListView
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
final List<String> entries = <String>['A', 'B', 'C','D','E'];
final List<int> colorCodes = <int>[600, 500, 100,700,900];
@override
Widget build(BuildContext context) {
return ListView.builder(
padding: const EdgeInsets.all(8),
itemCount: entries.length,
itemBuilder: (BuildContext context, int index) {
return Container(
height: 50,
color: Colors.amber[colorCodes[index]],
child: Center(child: Text('Entry ${entries[index]}')),
);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment