build method
dynamic
build( - dynamic context,
- dynamic ref
)
Implementation
@override
Widget build(BuildContext context, WidgetRef ref) {
final suggestedChats =
ref.watch(suggestedChatsProvider(spaceId)).valueOrNull;
if (suggestedChats != null &&
(suggestedChats.$1.isNotEmpty || suggestedChats.$2.isNotEmpty)) {
return buildSuggestedChatsSectionUI(
context,
ref,
suggestedChats.$1,
suggestedChats.$2,
);
}
final overviewLoader = ref.watch(spaceRelationsOverviewProvider(spaceId));
return overviewLoader.when(
data: (overview) => buildChatsSectionUI(
context,
ref,
overview.knownChats,
),
error: (e, s) {
_log.severe('Failed to load the related spaces', e, s);
return Center(
child: Text(L10n.of(context).loadingSpacesFailed(e)),
);
},
loading: () => Skeletonizer(
child: Center(
child: Text(L10n.of(context).loading),
),
),
);
}