import 'package:flutter/material.dart';

import '../../../../common/theme/theme.dart';
import '../../../components/spacer/spacer.dart';
import 'stats_tile.dart';

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

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(
        vertical: 24,
        horizontal: AppValue.padding,
      ).copyWith(bottom: 0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                'Ringkasan Hari Ini',
                style: AppStyle.h6.copyWith(
                  fontWeight: FontWeight.w700,
                  color: AppColor.textPrimary,
                  letterSpacing: -0.5,
                ),
              ),
              Container(
                padding: const EdgeInsets.symmetric(
                  horizontal: 12,
                  vertical: 6,
                ),
                decoration: BoxDecoration(
                  color: AppColor.success.withOpacity(0.1),
                  borderRadius: BorderRadius.circular(20),
                  border: Border.all(
                    color: AppColor.success.withOpacity(0.2),
                    width: 1,
                  ),
                ),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    Icon(
                      Icons.trending_up_rounded,
                      color: AppColor.success,
                      size: 14,
                    ),
                    const SpaceWidth(4),
                    Text(
                      'Live',
                      style: AppStyle.sm.copyWith(
                        color: AppColor.success,
                        fontWeight: FontWeight.w600,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
          const SpaceHeight(20),
          Row(
            children: [
              Expanded(
                child: HomeStatsTile(
                  title: 'Total Penjualan',
                  value: 'Rp 2.450.000',
                  icon: Icons.trending_up_rounded,
                  color: AppColor.success,
                  change: '+12%',
                  subtitle: 'dari kemarin',
                ),
              ),

              const SpaceWidth(16),
              Expanded(
                child: HomeStatsTile(
                  title: 'Transaksi',
                  value: '85',
                  icon: Icons.receipt_long_rounded,
                  color: AppColor.info,
                  change: '+8%',
                  subtitle: 'lebih tinggi',
                ),
              ),
            ],
          ),
          const SizedBox(height: 16),
          Row(
            children: [
              Expanded(
                child: HomeStatsTile(
                  title: 'Profit Bersih',
                  value: 'Rp 735.000',
                  icon: Icons.account_balance_wallet_rounded,
                  color: AppColor.warning,
                  change: '+15%',
                  subtitle: 'margin sehat',
                ),
              ),
              const SpaceWidth(16),
              Expanded(
                child: HomeStatsTile(
                  title: 'Pelanggan Baru',
                  value: '42',
                  icon: Icons.person_add_rounded,
                  color: AppColor.primary,
                  change: '+3%',
                  subtitle: 'bertambah',
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
