renderRemoteChats function
dynamic
renderRemoteChats( - dynamic context,
- dynamic ref,
- String parentId,
- List chats,
- int? maxItems, {
- bool showSuggestedMarkIfGiven = true,
})
Implementation
Widget renderRemoteChats(
BuildContext context,
WidgetRef ref,
String parentId,
List<SpaceHierarchyRoomInfo> chats,
int? maxItems, {
bool showSuggestedMarkIfGiven = true,
bool renderMenu = true,
}) {
if (chats.isEmpty) return const SizedBox.shrink();
return ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
physics: const NeverScrollableScrollPhysics(),
itemCount: maxItems ?? chats.length,
itemBuilder: (context, index) {
final roomInfo = chats[index];
final roomId = roomInfo.roomIdStr();
return RoomHierarchyCard(
indicateIfSuggested: showSuggestedMarkIfGiven,
parentId: parentId,
roomInfo: roomInfo,
trailing: Wrap(
children: [
RoomHierarchyJoinButton(
joinRule: roomInfo.joinRuleStr().toLowerCase(),
roomId: roomId,
roomName: roomInfo.name() ?? roomId,
viaServerName: roomInfo.viaServerName(),
forward: (roomId) {
goToChat(context, roomId);
// make sure the UI refreshes when the user comes back here
ref.invalidate(spaceRelationsProvider(parentId));
ref.invalidate(spaceRemoteRelationsProvider(parentId));
},
),
if (renderMenu)
RoomHierarchyOptionsMenu(
isSuggested: roomInfo.suggested(),
childId: roomId,
parentId: parentId,
),
],
),
);
},
);
}