Created
September 30, 2020 17:57
-
-
Save Maddoxx88/b949a72823b7b2f30118ebd37d6921cb to your computer and use it in GitHub Desktop.
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(MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: MyApp(), | |
)); | |
} | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
final List<String> entries = <String>['A', 'B', 'C', 'D', 'E', 'F']; | |
final List<Color> colorS = <Color>[Colors.amber, Colors.green, Colors.red, Colors.blue, Colors.orange, Colors.purple]; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Container( | |
child: ListView.builder( | |
padding: EdgeInsets.symmetric( | |
horizontal: 25, | |
vertical: 70 | |
), | |
itemCount: entries.length, | |
itemBuilder: (_, int index) { | |
return Container( | |
margin: EdgeInsets.symmetric(vertical: 20), | |
height: 150, | |
color: colorS[index], | |
child: Center(child: Text('Container ${entries[index]}', | |
style: TextStyle( | |
fontSize: 28.0, | |
fontWeight: FontWeight.bold | |
),)), | |
); | |
} | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment