build method
Describes the part of the UI represented by this widget.
Implementation
@override
Widget build(BuildContext context) {
final theme = ThemeScope.of(context);
final accent = _accentFor(theme);
final markerStyle = _copyStyle(theme.labelMedium)
..foreground(accent)
..bold();
final titleStyle = _copyStyle(theme.titleSmall)
..foreground(theme.onSurface)
..bold();
final bodyStyle = _copyStyle(theme.bodyMedium)..foreground(theme.onSurface);
final header = title == null ? null : Text(title!, style: titleStyle);
final content = child ?? Text(message ?? '', style: bodyStyle);
final body = Column(
gap: (header != null && (message != null || child != null)) ? 1 : 0,
children: [if (header != null) header, content],
);
final row = Row(
gap: 1,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(_markerFor(), style: markerStyle),
Expanded(child: body),
if (actions.isNotEmpty) Row(gap: 1, children: actions),
],
);
return Frame(
padding: padding ?? const EdgeInsets.all(1),
margin: margin,
background: theme.surface,
border: border ?? Border.normal,
borderColor: accent,
child: row,
);
}