Untitled
unknown
plain_text
10 months ago
1.1 kB
4
Indexable
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Daftar Teman'),
),
body: FriendList(),
),
);
}
}
class FriendList extends StatelessWidget {
final List<String> friends = [
'Alice',
'Bob',
'Charlie',
'Diana',
'Eva',
];
@override
Widget build(BuildContext context) {
return Container(
color: Colors.blue[100], // Warna latar belakang
child: ListView.builder(
padding: EdgeInsets.all(16.0),
itemCount: friends.length,
itemBuilder: (context, index) {
return Card(
color: Colors.white, // Warna latar belakang card
child: ListTile(
title: Text(
friends[index],
style: TextStyle(fontSize: 18.0),
),
),
);
},
),
);
}
}Editor is loading...
Leave a Comment