import '../../../../../../food_delivery_client.dart';

class WOffersCarouselSlider extends StatelessWidget {
  WOffersCarouselSlider({super.key});

  List _colors = [
    AppColors.cD2D7F0,
    AppColors.c9EE2B8,
    AppColors.cE2CC9E,
    AppColors.cC99EE2,
    AppColors.cE29EC7,
  ];

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        16.verticalSpace,
        CarouselSlider.builder(
          options: CarouselOptions(
            height: 170.0,
            reverse: false,
            viewportFraction: 0.9,
            animateToClosest: true,
            autoPlay: true,
            autoPlayCurve: Curves.easeIn,
            initialPage: 0,
            padEnds: false,
            enableInfiniteScroll: true,
            scrollPhysics: const AlwaysScrollableScrollPhysics(),
            scrollDirection: Axis.horizontal,
          ),
          itemBuilder: (context, index, realIndex) => Builder(
            builder: (BuildContext context) {
              return Container(
                width: MediaQuery.of(context).size.width,
                margin: EdgeInsets.only(left: 15),
                decoration: BoxDecoration(
                  color: _colors[index],
                  borderRadius: AppUtils.kBorderRadius16,
                ),
                child: Row(
                  children: [
                    Expanded(
                      flex: 3,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            "Order from these restaurants and save",
                            style: AppTextStyles.size17Bold,
                          ),
                          const Spacer(),
                          Material(
                            color: AppColors.cTransparent,
                            child: InkWell(
                              onTap: () {},
                              borderRadius: AppUtils.kBorderRadius30,
                              child: Ink(
                                decoration: BoxDecoration(
                                  color: AppColors.cFFFFFF,
                                  borderRadius: AppUtils.kBorderRadius30,
                                ),
                                child: Row(
                                  mainAxisSize: MainAxisSize.min,
                                  mainAxisAlignment: MainAxisAlignment.start,
                                  children: [Text('Browse offer')],
                                ).paddingSymmetric(horizontal: 8, vertical: 4),
                              ),
                            ),
                          ),
                        ],
                      ).paddingSymmetric(horizontal: 15, vertical: 15),
                    ),
                    Expanded(
                      flex: 2,
                      child: Column(
                        children: [
                          ClipRRect(
                            borderRadius: AppUtils.kBorderRadiusTop15Bottom15,
                            child: Image.network(
                              AppLocaleKeys.imageUrl,
                              height: 170,
                              fit: BoxFit.cover,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              );
            },
          ),
          itemCount: _colors.length,
        ),
        8.verticalSpace,
        WDivider(),
      ],
    );
  }
}
