38 lines
927 B
Dart
38 lines
927 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:get_it_mixin/get_it_mixin.dart';
|
|
|
|
import '/models/contact_model.dart';
|
|
import 'friend_tile.dart';
|
|
|
|
class FriendGroup extends StatelessWidget with GetItMixin {
|
|
FriendGroup({
|
|
super.key,
|
|
required this.groupName,
|
|
});
|
|
|
|
final String groupName;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final friends = watchOnly((Contact contact) => contact.friends);
|
|
|
|
return ExpansionTile(
|
|
title: Text(groupName),
|
|
trailing: Text(
|
|
get<Contact>().filterGroupFriends(groupName).length.toString(),
|
|
),
|
|
children: List.generate(
|
|
get<Contact>().filterGroupFriends(groupName).length,
|
|
(index) => FriendTile(
|
|
key: ValueKey(
|
|
friends.keys.toList()[index],
|
|
),
|
|
friendId:
|
|
get<Contact>().filterGroupFriends(groupName).keys.toList()[index],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|