build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Describes the part of the user interface represented by this widget.

Implementation

@override
Widget build(BuildContext context) {
  if (widget.upgrade.debugLogging) {
    if (kDebugMode) {
      print('hcUpgrade: build UpgradeAlert');
    }
  }

  return StreamBuilder(
    initialData: widget.upgrade.evaluationReady,
    stream: widget.upgrade.evaluationStream,
    builder:
        (BuildContext context, AsyncSnapshot<HcUpgradeEvaluateNeed> snapshot) {
      if ((snapshot.connectionState == ConnectionState.waiting ||
          snapshot.connectionState == ConnectionState.active) &&
          snapshot.data != null &&
          snapshot.data!) {
        if (widget.upgrade.debugLogging) {
          if (kDebugMode) {
            print("hcUpgrade: need to evaluate version");
          }
        }

        if (!displayed) {
          final checkContext = widget.navigatorKey != null &&
              widget.navigatorKey!.currentContext != null
              ? widget.navigatorKey!.currentContext!
              : context;
          checkVersion(context: checkContext);
        }
      }
      return widget.child ?? const SizedBox.shrink();
    },
  );
}