import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';

class BottomNavigation1 extends StatefulWidget {
  const BottomNavigation1({super.key, required this.items});

  final List<BottomNavigation1Item> items;

  @override
  State<BottomNavigation1> createState() => _BottomNavigation1State();
}

class _BottomNavigation1State extends State<BottomNavigation1> {
  @override
  Widget build(BuildContext context) {
    return Container(
      height: 90,
      padding: EdgeInsets.fromLTRB(50, 10, 50, 10),
      decoration: BoxDecoration(
        color: AppColor.blueNormal,
        borderRadius: const BorderRadius.only(
          topLeft: Radius.circular(50),
          topRight: Radius.circular(50),
        ),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: widget.items,
      ),
    );
  }
}

class BottomNavigation1Item extends StatelessWidget {
  final String icon;
  final String label;
  final bool isSelected;
  final Function() onTap;

  const BottomNavigation1Item({
    super.key,
    required this.icon,
    required this.label,
    required this.isSelected,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      width: 80,
      height: 80,
      padding: const EdgeInsets.symmetric(horizontal: 10),
      decoration: BoxDecoration(
        color: isSelected ? Colors.white.withAlpha(208) : Colors.transparent,
        borderRadius: BorderRadius.circular(10),
      ),
      child: InkWell(
        onTap: onTap,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            SvgGenImage.vec(icon).svg(
                width: 32,
                height: 32,
                colorFilter: ColorFilter.mode(
                    isSelected ? AppColor.blueNormal : Colors.white,
                    BlendMode.srcIn)
            ),
            const SizedBox(height: 5),
            Text(
              label,
              style: AppFonts.yekan10.copyWith(
                color: isSelected ? AppColor.blueNormal : Colors.white,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
