build method

  1. @override
dynamic build(
  1. dynamic context
)

Implementation

@override
Widget build(BuildContext context) {
  // get platform of context.
  if (ref.watch(clientProvider) == null) {
    // at the very startup we might not yet have a client loaded
    // show a loading spinner meanwhile.
    return const Scaffold(
      body: Center(
        child: CircularProgressIndicator(),
      ),
    );
  }
  final errorMsg = ref.watch(syncStateProvider.select((v) => v.errorMsg));
  if (errorMsg != null) {
    final softLogout = errorMsg == 'SoftLogout';
    if (softLogout || errorMsg == 'Unauthorized') {
      return LoggedOutScreen(softLogout: softLogout);
    }
  }

  return CallbackShortcuts(
    bindings: <LogicalKeySet, VoidCallback>{
      LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyK): () {
        context.pushNamed(Routes.quickJump.name);
      },
      LogicalKeySet(LogicalKeyboardKey.meta, LogicalKeyboardKey.keyK): () {
        context.pushNamed(Routes.quickJump.name);
      },
    },
    child: KeyboardDismissOnTap(
      // close keyboard if clicking somewhere else
      child: Scaffold(
        body: Screenshot(
          controller: screenshotController,
          child: Column(
            children: [
              const CrossSigning(),
              Expanded(
                child: buildBody(context),
              ),
            ],
          ),
        ),
      ),
    ),
  );
}