Created
February 16, 2020 06:17
-
-
Save jimit24365/602e856eb3279421aec3b1dcbc06738c to your computer and use it in GitHub Desktop.
InFiniteListView
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'; | |
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