ListView Simple

 import "package:flutter/material.dart";


void main() {
runApp(const FlutterApp());
}

class FlutterApp extends StatelessWidget {
const FlutterApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Hello",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.teal,
),
home: const DashBoardScreen1(),
);
}
}

/*class DashBoardScreen extends StatelessWidget
{
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Hello HEER"),
),
/*body: ListView(

//scrollDirection: Axis.horizontal,
scrollDirection: Axis.vertical,
reverse: true,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("ONE", style: TextStyle(fontSize: 21, fontWeight: FontWeight.w600),),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("TWO", style: TextStyle(fontSize: 21, fontWeight: FontWeight.w600),),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("THREE", style: TextStyle(fontSize: 21, fontWeight: FontWeight.w600),),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("FOUR", style: TextStyle(fontSize: 21, fontWeight: FontWeight.w600),),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("FIVE", style: TextStyle(fontSize: 21, fontWeight: FontWeight.w600),),
),
],
)*/
);
}
}*/

class DashBoardScreen1 extends StatelessWidget {
const DashBoardScreen1({super.key});

@override
Widget build(BuildContext context) {
var arrNames = [
"Raman",
"Rajesh",
"Ramanujan",
"jay",
"Akshar",
"Aakash",
"Ajay"
];

return Scaffold(
drawer: const Drawer(),
appBar: AppBar(
title: const Text(
"Hello HeeR",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),

/*body: ListView.builder(itemBuilder: (context, index) {
return Text(arrNames[index], style: TextStyle(fontSize: 21, fontWeight: FontWeight.w500));
},
itemCount: arrNames.length,
itemExtent: 100,
//scrollDirection: Axis.horizontal,
//scrollDirection: Axis.vertical,
// reverse: true,
)*/

/*body: ListView.separated(itemBuilder: (context, index) {
return Text(arrNames[index], style: TextStyle(fontSize: 21, fontWeight: FontWeight.w500));
},
itemCount: arrNames.length,
separatorBuilder: (context, index) {
return Divider(height: 100, thickness: 5,);
}
)*/

body: ListView.separated(
itemBuilder: (context, index) {
return Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
arrNames[index],
style: const TextStyle(
fontSize: 21, fontWeight: FontWeight.w500),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
arrNames[index],
style: const TextStyle(
fontSize: 11, fontWeight: FontWeight.w500),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
arrNames[index],
style: const TextStyle(
fontSize: 21, fontWeight: FontWeight.w500),
),
),
],
);
},
itemCount: arrNames.length,
separatorBuilder: (context, index) {
return const Divider(
height: 100,
thickness: 5,
);
},
),
);
}
}

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter