43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../widgets/friend_card.dart';
|
|
import '../../widgets/friend_detail_screen.dart';
|
|
|
|
class FriendsContent extends StatelessWidget {
|
|
final List<Map<String, String>> friends = [
|
|
{'name': 'Alice', 'imageUrl': 'https://example.com/image1.jpg'},
|
|
{'name': 'Bob', 'imageUrl': 'https://example.com/image2.jpg'},
|
|
{'name': 'Charlie', 'imageUrl': 'https://example.com/image3.jpg'},
|
|
// Autres amis...
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.builder(
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 16.0),
|
|
itemCount: friends.length,
|
|
itemBuilder: (context, index) {
|
|
final friend = friends[index];
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10.0),
|
|
child: FriendCard(
|
|
name: friend['name']!,
|
|
imageUrl: friend['imageUrl']!,
|
|
onTap: () => _navigateToFriendDetail(context, friend),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
void _navigateToFriendDetail(BuildContext context, Map<String, String> friend) {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (context) => FriendDetailScreen(
|
|
name: friend['name']!,
|
|
imageUrl: friend['imageUrl']!,
|
|
friendId: friend['friendId']!,
|
|
),
|
|
));
|
|
}
|
|
}
|