Skip to main content

11 Horiz

Image

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
buildLegendItem(Colors.green, 'Garut', '+12%'),
const Gap(24),
buildLegendItem(Colors.blue, 'Bandung', '+24%'),
const Gap(24),
buildLegendItem(Colors.red, 'Jakarta', '+41%'),
],
),
Widget buildLegendItem(Color color, String title, String data) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 12,
color: color,
),
),
Text(
data,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30,
color: Colors.black87,
),
),
],
);
}