import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_web/pages/common/date_time_widget.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_bloc.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_event.dart'; import 'package:syncrow_web/pages/visitor_password/bloc/visitor_password_state.dart'; import 'package:syncrow_web/utils/color_manager.dart'; class RepeatWidget extends StatelessWidget { const RepeatWidget({ super.key, }); @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; return BlocBuilder( builder: (context, state) { final smartDoorBloc = BlocProvider.of(context); return Column( children: [ Container( width: size.width * 0.8, height: size.height * 0.06, // Adjust height as needed child: ListView( scrollDirection: Axis.horizontal, children: smartDoorBloc.days.map((day) { return Container( width: size.width* 0.09, child: CheckboxListTile( title: Text( day['day']!, style: TextStyle( fontSize: 18, color: smartDoorBloc.selectedDays.contains(day['key']) ? Colors.black : ColorsManager.grayColor, ), ), value: smartDoorBloc.selectedDays.contains(day['key']), onChanged: (bool? value) { if (value != null) { smartDoorBloc.add(ToggleDaySelectionEvent(key: day['key']!)); } }, ), ); }).toList(), ), ), Padding( padding: const EdgeInsets.all(8.0), child: DateTimeWebWidget( isRequired: false, title: '', size: size, endTime: () { smartDoorBloc.add(SelectTimeVisitorPassword( isRepeat: true, context: context, isStart: false )); }, startTime: () { smartDoorBloc.add(SelectTimeVisitorPassword( isRepeat: true, context: context, isStart: true )); }, firstString: smartDoorBloc.repeatStartTime.toString(), secondString: smartDoorBloc.repeatEndTime.toString(), ), ), const SizedBox(height: 20), ], ); }); } }