build method
Describes the part of the UI represented by this widget.
Implementation
@override
Widget build(BuildContext context) {
final theme = ThemeScope.of(context);
final children = <Widget>[];
for (var i = 0; i < steps.length; i++) {
final step = steps[i];
final effectiveStatus = _resolveStatus(step, i);
final (icon, iconColor) = _iconForStatus(effectiveStatus, theme);
final iconStyle = _copyStyle(Style())..foreground(iconColor);
final labelStyle = _copyStyle(theme.bodyMedium)
..foreground(
effectiveStatus == StepStatus.active
? theme.onSurface
: (effectiveStatus == StepStatus.completed
? theme.success
: theme.muted),
);
if (effectiveStatus == StepStatus.active) {
labelStyle.bold();
} else if (effectiveStatus == StepStatus.skipped) {
labelStyle.dim();
}
final stepRow = Row(
gap: 1,
children: [
Text(icon, style: iconStyle),
Text(step.label, style: labelStyle),
],
);
children.add(stepRow);
if (step.description != null && step.description!.isNotEmpty) {
final descStyle = _copyStyle(theme.bodySmall)..foreground(theme.muted);
children.add(
Row(
gap: 0,
children: [
Text(' ', style: descStyle),
Text(step.description!, style: descStyle),
],
),
);
}
// Add connector line between steps.
if (i < steps.length - 1) {
final connectorColor = effectiveStatus == StepStatus.completed
? theme.success
: theme.border;
final connectorStyle = _copyStyle(Style())..foreground(connectorColor);
children.add(Text('│', style: connectorStyle));
}
}
return Column(gap: 0, children: children);
}