import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/analytics/modules/air_quality/helpers/range_of_aqi_charts_helper.dart';
import 'package:syncrow_web/pages/analytics/modules/analytics/widgets/chart_informative_cell.dart';
import 'package:syncrow_web/utils/style.dart';

class AqiLegend extends StatelessWidget {
  const AqiLegend({super.key});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsetsDirectional.all(20),
      decoration: subSectionContainerDecoration.copyWith(
        borderRadius: BorderRadius.circular(20),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        spacing: 16,
        children: RangeOfAqiChartsHelper.gradientData.map((e) {
          return Flexible(
            flex: 4,
            child: FittedBox(
              fit: BoxFit.fill,
              child: ChartInformativeCell(
                color: e.$1,
                title: FittedBox(
                  fit: BoxFit.fill,
                  child: Text(e.$2),
                ),
                height: null,
              ),
            ),
          );
        }).toList(),
      ),
    );
  }
}
