compartments static method
ShapePart
compartments(
- List<
String> rows, { - String slotPrefix = 'section',
- DiagramColor headerFill = const DiagramColor(0xFFEAF1FF),
- DiagramColor bodyFill = const DiagramColor(0xFFFFFFFF),
- double padding = 8,
Stacked, square-cornered compartments with one text slot each,
'$slotPrefix-0', '$slotPrefix-1'... The first row is a single-line
header filled with headerFill.
Implementation
static ShapePart compartments(
List<String> rows, {
String slotPrefix = 'section',
DiagramColor headerFill = const DiagramColor(0xFFEAF1FF),
DiagramColor bodyFill = const DiagramColor(0xFFFFFFFF),
double padding = 8,
}) => ShapeColumn([
for (var i = 0; i < rows.length; i++)
ShapeSurface(
style: ShapeStyle(
fill: i == 0 ? headerFill : bodyFill,
cornerRadius: 0,
strokeWidth: 1,
),
child: ShapePadding(
padding,
child: ShapeText(
'$slotPrefix-$i',
text: rows[i],
textType: PlainTextDefinition(maxLines: i == 0 ? 1 : 0),
),
),
),
]);