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 UpgradeCard');
    }
  }

  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.shouldDisplayUpgrade()) {
            return buildUpgradeCard(
                context, const Key('upgrade_alert_card'));
          } else {
            if (widget.upgrade.debugLogging) {
              if (kDebugMode) {
                print('hcUpgrade: UpgradeCard will not display');
              }
            }
          }
        }
        return const SizedBox.shrink();
      });
}