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 LinkStepState.pending:
      icon = '○';
      color = Colors.gray;
    case LinkStepState.running:
      icon = '◉';
      color = Colors.cyan;
    case LinkStepState.done:
      icon = '✔';
      color = Colors.green;
    case LinkStepState.failed:
      icon = '✘';
      color = Colors.red;
    case LinkStepState.skipped:
      icon = '–';
      color = Colors.gray;
  }
  return Padding(
    padding: const EdgeInsets.only(left: 2),
    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 == LinkStepState.running
                      ? Colors.cyan
                      : null,
                  fontWeight: step.state == LinkStepState.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,
              ),
            ),
          ),
      ],
    ),
  );
}