Widget _getStatusIcon()

in ui/lib/modules/my_services/widgets/workstation_widget.dart [215:268]


  Widget _getStatusIcon({required Workstation workstation}) {
    Widget child = Container();

    var doneIcon = Icon(
      Icons.check_circle_rounded,
      color: Colors.green,
    );

    if (workstation.state.contains("STOPPED")) {
      child = Icon(Icons.stop_circle);
    }
    if (workstation.state.contains("RUNNING")) {
      child = doneIcon;
    }
    if (workstation.state.contains("STARTING")) {

      var inProgressIcon = Row(
            children: [
              SizedBox(
                child: CircularProgressIndicator(strokeWidth: 2),
                height: 15,
                width: 15,
              ),
              SizedBox(
                width: 5,
              )
            ],
          );

      final workstationStartingProgress = ref.watch(workstationStartingProgressProvider(projectId: widget.service.projectId,
        clusterName: workstation.clusterName,
        configName: workstation.configName,
        instanceName: workstation.displayName,
        region: widget.service.region,
      ));

      child = workstationStartingProgress.when(
        data: (inProgress) {
          if (inProgress) {
            return inProgressIcon;
          } else {
            return doneIcon;
          }
        },
        loading: () => inProgressIcon,
        error: (err, stack) {
          print(err);
          return Container();
          },
      );
    }

    return child;
  }