import 'package:flutter/cupertino.dart';

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

class WFiltersDeals extends StatefulWidget {
  const WFiltersDeals({super.key});

  @override
  State<WFiltersDeals> createState() => _WFiltersDealsState();
}

class _WFiltersDealsState extends State<WFiltersDeals> with FilterMixins {
  List<bool> values = [false, false];

  @override
  Widget build(BuildContext context) {
    final List<String> dealsTitle = [
      context.loc.deals,
      context.loc.bestOverall,
    ];
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        25.verticalSpace,
        Text(
          "From Uber eats",
          style: AppTextStyles.size18Medium,
        ).paddingSymmetric(horizontal: 20),
        15.verticalSpace,
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: List.generate(2, (index) {
            return AppListTile(
              onPressed: () {
                setState(() {
                  values[index] = !values[index];
                });
              },
              isSelected: false,
              leading: index == 0
                  ? SvgPicture.asset(filterDeals[index], height: 30, width: 30)
                  : Image.asset(filterDeals[index], height: 30, width: 30),
              svgPath: filterDeals[index],
              title: dealsTitle[index],
              trailing: CupertinoSwitch(
                value: values[index],
                onChanged: (value) {
                  setState(() {
                    values[index] = !values[index];
                  });
                },
              ),
            );
          }),
        ),
      ],
    );
  }
}
