Created
February 28, 2023 12:48
-
-
Save LokieVikky/00eaa48e65841b514095ae2eb8848451 to your computer and use it in GitHub Desktop.
list_map.dart
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/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
home: FirstPage(), | |
); | |
} | |
} | |
class FirstPage extends StatefulWidget { | |
const FirstPage({Key? key}) : super(key: key); | |
@override | |
State<FirstPage> createState() => _FirstPageState(); | |
} | |
class _FirstPageState extends State<FirstPage> { | |
List<String> items = [ | |
'Item 1', | |
'Item 2', | |
'Item 3', | |
'Item 4', | |
'Item 5', | |
'Item 1', | |
'Item 2', | |
'Item 3', | |
'Item 4', | |
'Item 5', | |
'Item 1', | |
'Item 2', | |
'Item 3', | |
'Item 4', | |
'Item 5', | |
'Item 1', | |
'Item 2', | |
'Item 3', | |
'Item 4', | |
'Item 5', | |
]; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Heading'), | |
), | |
body: Column( | |
children: [ | |
Expanded( | |
child: ListView.builder( | |
itemBuilder: (BuildContext context, int index) { | |
return Column( | |
children: [ | |
ListTile(title: Text(items[index]),leading: Icon(Icons.add),), | |
Divider(), | |
], | |
); | |
}, | |
itemCount: items.length, | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment