48 lines
1.1 KiB
Dart
48 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:together_mobile/models/contact_model.dart';
|
|
import 'package:together_mobile/models/init_get_it.dart';
|
|
|
|
import 'friend_tile.dart';
|
|
|
|
class FriendGroup extends StatefulWidget {
|
|
const FriendGroup({
|
|
super.key,
|
|
required this.groupName,
|
|
});
|
|
|
|
final String groupName;
|
|
|
|
@override
|
|
State<FriendGroup> createState() => _FriendGroupState();
|
|
}
|
|
|
|
class _FriendGroupState extends State<FriendGroup> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ExpansionTile(
|
|
title: Text(widget.groupName),
|
|
trailing: Text(
|
|
getIt
|
|
.get<Contact>()
|
|
.filterGroupFriends(widget.groupName)
|
|
.length
|
|
.toString(),
|
|
),
|
|
children: List.generate(
|
|
getIt.get<Contact>().filterGroupFriends(widget.groupName).length,
|
|
(index) => FriendTile(
|
|
key: ValueKey(
|
|
getIt.get<Contact>().friends.keys.toList()[index],
|
|
),
|
|
friendId: getIt
|
|
.get<Contact>()
|
|
.filterGroupFriends(widget.groupName)
|
|
.keys
|
|
.toList()[index],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|