import 'package:flutter/material.dart'; import '../models/TaxiOptionsModel.dart'; import '../utils/colors.dart'; class AllowedItemsSelector extends StatelessWidget { final List items; final List selectedItems; final Function(TaxiOptionModel) onItemToggle; const AllowedItemsSelector({ super.key, required this.items, required this.selectedItems, required this.onItemToggle, }); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.symmetric(horizontal: 22,vertical: 20), decoration: BoxDecoration( color:Theme.of(context).brightness == Brightness.dark ? AppColors.blackBackgroundColor:AppColors.whiteBackgroundColor, borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), spreadRadius: 1, blurRadius: 10, offset: const Offset(0, 2), ), ], ), child: Column( children: [ const Text( 'What do you allow in your taxi?', style: TextStyle( fontSize: 14, color: Colors.grey, fontWeight: FontWeight.w500, ), ), const SizedBox(height: 20), Wrap( spacing: 8, runSpacing: 8, children: items.map((item) { final isSelected = selectedItems.contains(item.id); return GestureDetector( onTap: () => onItemToggle(item), child: Container( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10), decoration: BoxDecoration( color: isSelected ? Theme.of(context).brightness == Brightness.dark ? AppColors.darkPrimaryColor : AppColors.primaryColor : Theme.of(context).brightness == Brightness.dark ? AppColors.blackBackgroundColor: AppColors.whiteBackgroundColor, borderRadius: BorderRadius.circular(20), border: Border.all( color: isSelected ? Theme.of(context).brightness == Brightness.dark ? AppColors.darkPrimaryColor : AppColors.primaryColor : AppColors.darkCardColor, width: 1.5, ), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ if (isSelected) Icon( Icons.check_circle, size: 16, color: isSelected ? Theme.of(context).brightness == Brightness.dark ? AppColors.whiteBackgroundColor : Colors.white : Theme.of(context).brightness == Brightness.dark ? AppColors.whiteBackgroundColor : Colors.grey.shade700, ), if (isSelected) const SizedBox(width: 6), Text( item.name, style: TextStyle( fontSize: 13, fontWeight: FontWeight.w500, color: isSelected ? Theme.of(context).brightness == Brightness.dark ? AppColors.whiteBackgroundColor : Colors.white : Theme.of(context).brightness == Brightness.dark ? AppColors.whiteBackgroundColor : Colors.grey.shade700, ), ), ], ), ), ); }).toList(), ), ], ), ); } } Widget buildSectionTitle(String title) { return Text( title, style: const TextStyle( fontSize: 20, fontWeight: FontWeight.bold, color: Colors.black87, ), ); }