build method
Describes the part of the UI represented by this widget.
Implementation
@override
Widget build(BuildContext context) {
final theme = ThemeScope.of(context);
final bg = background ?? theme.surface;
final tStyle = _copyStyle(titleStyle ?? theme.titleSmall)
..foreground(theme.onSurface)
..bold();
final uStyle = _copyStyle(undoStyle ?? theme.bodySmall)
..foreground(theme.onSurface);
final rStyle = _copyStyle(redoStyle ?? theme.bodySmall)
..foreground(theme.muted)
..dim();
final mStyle = _copyStyle(markerStyle ?? theme.bodySmall)
..foreground(theme.muted)
..bold();
final children = <Widget>[];
// Title
if (title.isNotEmpty) {
children.add(Text(title, style: tStyle));
children.add(Text(''));
}
// Determine visible items
final (undoVisible, redoVisible) = _computeVisible();
// Overflow indicator for hidden undo items
if (mode == HistoryPanelMode.compact &&
undoVisible.length < undoItems.length) {
final hidden = undoItems.length - undoVisible.length;
children.add(Text('... ($hidden more)', style: rStyle));
}
// Undo items
for (final entry in undoVisible) {
children.add(Text('$undoIcon${entry.description}', style: uStyle));
}
// Position marker
children.add(Text(markerText, style: mStyle));
// Redo items
for (final entry in redoVisible) {
children.add(Text('$redoIcon${entry.description}', style: rStyle));
}
// Overflow indicator for hidden redo items
if (mode == HistoryPanelMode.compact &&
redoVisible.length < redoItems.length) {
final hidden = redoItems.length - redoVisible.length;
children.add(Text('... ($hidden more)', style: rStyle));
}
return Container(
padding: padding ?? const EdgeInsets.all(1),
color: bg,
child: Column(gap: 0, children: children),
);
}