import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class AqiLocationInfoCell extends StatelessWidget {
  const AqiLocationInfoCell({
    required this.label,
    required this.value,
    required this.svgPath,
    super.key,
  });

  final String label;
  final String value;
  final String svgPath;

  @override
  Widget build(BuildContext context) {
    return Expanded(
      child: Container(
        decoration: BoxDecoration(
          color: ColorsManager.whiteColors,
          borderRadius: BorderRadius.circular(12),
        ),
        child: Stack(
          children: [
            Align(
              alignment: AlignmentDirectional.topStart,
              child: Padding(
                padding: const EdgeInsetsDirectional.all(10),
                child: SizedBox(
                  height: 24,
                  child: FittedBox(
                    fit: BoxFit.scaleDown,
                    alignment: AlignmentDirectional.topStart,
                    child: Text(
                      label,
                      style: context.textTheme.bodySmall?.copyWith(
                        color: ColorsManager.textPrimaryColor,
                        fontWeight: FontWeight.w400,
                        fontSize: 12,
                      ),
                    ),
                  ),
                ),
              ),
            ),
            Align(
              alignment: AlignmentDirectional.bottomCenter,
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.end,
                children: [
                  Expanded(
                    child: SvgPicture.asset(
                      svgPath,
                      fit: BoxFit.scaleDown,
                      alignment: AlignmentDirectional.bottomStart,
                    ),
                  ),
                  Expanded(
                    child: FittedBox(
                      fit: BoxFit.scaleDown,
                      alignment: AlignmentDirectional.bottomEnd,
                      child: Padding(
                        padding: const EdgeInsetsDirectional.all(10),
                        child: Text(
                          value,
                          style: context.textTheme.bodySmall?.copyWith(
                            color: ColorsManager.vividBlue.withValues(
                              alpha: 0.7,
                            ),
                            fontWeight: FontWeight.w700,
                            fontSize: 24,
                          ),
                        ),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
