build method

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

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

Implementation

@override
Component build(BuildContext context) {
  final String icon;
  final Color color;
  switch (step.state) {
    case InitStepState.pending:
      icon = '○';
      color = Colors.gray;
    case InitStepState.running:
      icon = '◉';
      color = Colors.cyan;
    case InitStepState.done:
      icon = '✔';
      color = Colors.green;
    case InitStepState.failed:
      icon = '✘';
      color = Colors.red;
    case InitStepState.skipped:
      icon = '–';
      color = Colors.gray;
  }

  return Padding(
    padding: const EdgeInsets.only(left: 2, bottom: 0),
    child: Column(
      children: [
        Row(
          children: [
            Text(icon, style: TextStyle(color: color, fontWeight: FontWeight.bold)),
            const Text(' '),
            Expanded(
              child: Text(
                step.label,
                style: TextStyle(
                  color: step.state == InitStepState.running ? Colors.cyan : null,
                  fontWeight: step.state == InitStepState.running ? FontWeight.bold : null,
                ),
              ),
            ),
          ],
        ),
        if (step.detail != null)
          Padding(
            padding: const EdgeInsets.only(left: 4),
            child: Text(
              step.detail!,
              style: const TextStyle(color: Colors.gray, fontWeight: FontWeight.dim),
            ),
          ),
      ],
    ),
  );
}