import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/app_theme.dart';
import 'package:sk_base_mobile/screens/inventory_inout/inventory_inout_controller.dart';
import 'package:sk_base_mobile/util/screen_adaper_util.dart';
import 'dates.dart';

class DateContainer extends StatelessWidget {
  final int index;
  DateContainer({super.key, required this.index});
  final controller = Get.put(InventoryInoutController());
  @override
  Widget build(BuildContext context) {
    final size = MediaQuery.sizeOf(context);
    return Obx(() => AnimatedContainer(
        duration: const Duration(milliseconds: 200),
        height: ScreenAdaper.height(120),
        width: ScreenAdaper.width(110),
        margin: EdgeInsets.only(right: ScreenAdaper.width(size.width) * 0.05),
        decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(ScreenAdaper.sp(20)),
            gradient: controller.currentIndex.value == index
                ? const LinearGradient(
                    begin: Alignment.topCenter,
                    end: Alignment.bottomCenter,
                    colors: [
                        AppTheme.secondPrimaryColor,
                        AppTheme.secondPrimaryColorDark
                      ])
                : null,
            boxShadow: [
              controller.currentIndex.value == index
                  ? BoxShadow(
                      color: AppTheme.secondPrimaryColorLight,
                      offset: Offset(0, ScreenAdaper.width(10)),
                      blurRadius: ScreenAdaper.sp(20))
                  : BoxShadow(
                      color: Colors.black12,
                      offset: Offset(0, ScreenAdaper.width(10)),
                      blurRadius: ScreenAdaper.sp(20))
            ]),
        child: Dates(index: index)));
  }
}
