Created
November 24, 2019 20:57
-
-
Save orhanerday/3a40fbdad3dc2f90c621113a3b517497 to your computer and use it in GitHub Desktop.
This file contains hidden or 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'; | |
main()=>runApp(new MaterialApp( | |
home: new AppHome(), | |
)); | |
class AppHome extends StatefulWidget{ | |
@override | |
State<AppHome> createState() { | |
return new AppState(); | |
} | |
} | |
class AppState extends State<AppHome>{ | |
List<String> Names = [ | |
'Abhishek','John','Robert','Shyam', 'Sita','Gita','Nitish' | |
]; | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: AppBar( | |
title: new Text("My List App"), | |
), | |
body: new Container( | |
child: new ListView.builder( | |
reverse: false, | |
itemBuilder: (_,int index)=>EachList(this.Names[index]), | |
itemCount: this.Names.length, | |
), | |
), | |
); | |
} | |
} | |
class EachList extends StatelessWidget{ | |
final String name; | |
EachList(this.name); | |
@override | |
Widget build(BuildContext context) { | |
return new Card( | |
child: new Container( | |
padding: EdgeInsets.all(8.0), | |
child: new Row( | |
children: <Widget>[ | |
new CircleAvatar(child: new Text(name[0]),), | |
new Padding(padding: EdgeInsets.only(right: 10.0)), | |
new Text(name,style: TextStyle(fontSize: 20.0),) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment