Skip to content

Instantly share code, notes, and snippets.

@Reprevise
Last active December 22, 2019 15:28
Show Gist options
  • Save Reprevise/d62f2a463b889e6ed40e521fbe241c8f to your computer and use it in GitHub Desktop.
Save Reprevise/d62f2a463b889e6ed40e521fbe241c8f to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
final List<Map<String, String>> mapInAList = [
{
'name': 'OMG',
'value': 'Number 1',
},
{
'name': 'i',
'value': 'Number 2',
},
{
'name': 'am',
'value': 'Number 3',
},
{
'name': 'a',
'value': 'Number 4',
},
{
'name': 'map',
'value': 'Number 5',
},
{
'name': 'in',
'value': 'Number 6',
},
{
'name': 'a',
'value': 'Number 7',
},
{
'name': 'list',
'value': 'Number 8',
},
];
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: mapInAList.length,
shrinkWrap: true,
itemBuilder: (context, index) {
var currentItem = mapInAList[index];
return Padding(
padding: EdgeInsets.symmetric(horizontal: 100),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(currentItem['name']),
Text("VALUE: ${currentItem['value']}"),
],
),
);
},
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment