renderRemoteSubspaces function
dynamic
renderRemoteSubspaces( - dynamic context,
- dynamic ref,
- String spaceIdOrAlias,
- List spaces, {
- int? maxLength,
- dynamic padding,
})
Implementation
Widget renderRemoteSubspaces(
BuildContext context,
WidgetRef ref,
String spaceIdOrAlias,
List<SpaceHierarchyRoomInfo> spaces, {
int? maxLength,
EdgeInsetsGeometry? padding,
}) {
if (spaces.isEmpty) {
return const SizedBox.shrink();
}
int itemCount = spaces.length;
if (maxLength != null && maxLength < itemCount) {
itemCount = maxLength;
}
return GridView.builder(
padding: padding,
itemCount: itemCount,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
childAspectRatio: 4.0,
mainAxisExtent: 100,
),
shrinkWrap: true,
itemBuilder: (context, index) {
final roomInfo = spaces[index];
final parentId = spaceIdOrAlias;
final roomId = roomInfo.roomIdStr();
return RoomHierarchyCard(
key: Key('subspace-list-item-$roomId'),
roomInfo: roomInfo,
parentId: parentId,
indicateIfSuggested: true,
trailing: Wrap(
children: [
RoomHierarchyJoinButton(
joinRule: roomInfo.joinRuleStr().toLowerCase(),
roomId: roomId,
roomName: roomInfo.name() ?? roomId,
viaServerName: roomInfo.viaServerName(),
forward: (spaceId) {
goToSpace(context, spaceId);
ref.invalidate(spaceRelationsProvider(parentId));
ref.invalidate(spaceRemoteRelationsProvider(parentId));
},
),
RoomHierarchyOptionsMenu(
isSuggested: roomInfo.suggested(),
childId: roomId,
parentId: parentId,
),
],
),
);
},
);
}