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 icon = switch (step.state) {
    UpdateStepState.idle => '○',
    UpdateStepState.running => '●',
    UpdateStepState.done => '✔',
    UpdateStepState.skipped => '⊖',
  };
  final color = switch (step.state) {
    UpdateStepState.idle => Colors.gray,
    UpdateStepState.running => Colors.cyan,
    UpdateStepState.done => Colors.green,
    UpdateStepState.skipped => Colors.yellow,
  };

  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 == UpdateStepState.running ? Colors.cyan : null,
                  fontWeight: step.state == UpdateStepState.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),
            ),
          ),
      ],
    ),
  );
}