build method

  1. @override
dynamic build(
  1. dynamic context,
  2. dynamic ref
)

Implementation

@override
Widget build(BuildContext context, WidgetRef ref) {
  final sessionsLoader = ref.watch(unknownSessionsProvider);
  return WithSidebar(
    sidebar: const SettingsPage(),
    child: Scaffold(
      appBar: AppBar(
        automaticallyImplyLeading: !context.isLargeScreen,
        title: Text(L10n.of(context).sessions),
        centerTitle: true,
        actions: [
          IconButton(
            icon: const Icon(Atlas.arrows_rotating_right_thin),
            iconSize: 28,
            color: Theme.of(context).colorScheme.surface,
            onPressed: () async {
              ref.invalidate(allSessionsProvider);
            },
          ),
        ],
      ),
      body: sessionsLoader.when(
        data: (sessions) => buildSessions(context, sessions),
        error: (e, s) {
          _log.severe('Failed to load unknown sessions', e, s);
          return Center(
            child: Text(L10n.of(context).couldNotLoadAllSessions),
          );
        },
        loading: () => const Center(
          child: CircularProgressIndicator(),
        ),
      ),
    ),
  );
}