7 Horiz
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
buildLegendItem(Colors.black, 'Obsidian', '70%'),
const Gap(16),
buildLegendItem(Colors.green, 'Olivine', '20%'),
const Gap(16),
buildLegendItem(Colors.purple.shade300, 'Hematite', '5%'),
const Gap(16),
buildLegendItem(Colors.red, 'Halite', '5%'),
],
),
Widget buildLegendItem(Color color, String title, String data) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(Icons.circle, size: 12, color: color),
const Gap(6),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: const TextStyle(
fontSize: 12,
color: Colors.black87,
height: 1,
),
),
const Gap(8),
Text(
data,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
color: Colors.black87,
height: 1,
),
),
],
),
],
);
}