7 Vert
import 'package:flutter/material.dart';
SizedBox(
width: 140,
child: Table(
columnWidths: const {
0: FixedColumnWidth(20),
1: FlexColumnWidth(),
2: FixedColumnWidth(30),
},
children: [
buildLegendItem(Colors.black, 'Obsidian', '70%'),
buildLegendItem(Colors.green, 'Olivine', '20%'),
buildLegendItem(Colors.purple.shade300, 'Hematite', '5%'),
buildLegendItem(Colors.red, 'Halite', '5%'),
],
),
),
TableRow buildLegendItem(Color color, String title, String data) {
return TableRow(
children: [
SizedBox(
height: 30,
child: TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Icon(Icons.circle, size: 10, color: color),
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Padding(
padding: const EdgeInsets.only(left: 4),
child: Text(
title,
style: const TextStyle(
fontSize: 14,
color: Colors.black87,
),
),
),
),
TableCell(
verticalAlignment: TableCellVerticalAlignment.middle,
child: Text(
data,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black87,
),
),
),
],
);
}