import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/utils/size_config.dart'; import 'package:tm_app/views/detail/strings/tender_details_strings.dart'; import 'meeting_time_successful_registered_dialog.dart'; class MeetingTimeDialog extends StatefulWidget { const MeetingTimeDialog({required this.onConfirm, super.key}); final ValueChanged onConfirm; @override State createState() => _MeetingTimeDialogState(); } class _MeetingTimeDialogState extends State { int selectedType = 0; late String type = ''; final List> times = [ {'title': 'Sun 2025-06-15', 'value': 'mode1', 'time': '10:00'}, {'title': 'Sun 2025-06-16', 'value': 'mode2', 'time': '12:00'}, {'title': 'Sun 2025-06-17', 'value': 'mode3', 'time': '14:00'}, {'title': 'Sun 2025-06-18', 'value': 'mode4', 'time': '16:00'}, {'title': 'Sun 2025-06-19', 'value': 'mode5', 'time': '18:00'}, ]; @override Widget build(BuildContext context) { return Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), side: BorderSide.none, ), insetPadding: const EdgeInsets.symmetric(horizontal: 150), child: Wrap( children: [ Container( width: 560.0, padding: EdgeInsets.fromLTRB( 24.0.w(), 24.0.h(), 24.0.w(), 33.0.h(), ), decoration: BoxDecoration( color: AppColors.backgroundColor, borderRadius: const BorderRadius.all(Radius.circular(16.0)), ), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( TenderDetailsStrings.meetingTime, style: TextStyle( fontSize: 20.0.sp(), fontWeight: FontWeight.w600, color: AppColors.grey70, ), ), InkWell( onTap: () { context.pop(); }, splashColor: Colors.transparent, child: Container( width: 24.0.w(), height: 24.0.w(), decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: AppColors.grey60, width: 2.0, ), ), alignment: Alignment.center, child: Icon( Icons.close, color: AppColors.grey60, size: 16.0, ), ), ), ], ), SizedBox(height: 16.0.h()), Divider(color: AppColors.grey20), SizedBox(height: 8.0.h()), ListView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: times.length, itemBuilder: (context, index) { final item = times[index]; return Padding( padding: EdgeInsets.only(bottom: 8.0.h()), child: _submissionType( title: item['title']!, time: item['time']!, isSelected: type == item['value'], onTap: () { selectedType = index; type = item['value']!; setState(() {}); }, ), ); }, ), SizedBox(height: 8.0.h()), SizedBox(height: 8.0.h()), Align( alignment: Alignment.centerRight, child: Material( color: Colors.transparent, child: InkWell( borderRadius: BorderRadius.circular(100), onTap: () { // widget.onConfirm(type); context.pop(); showDialog( context: context, builder: (context) { return const MeetingTimeSuccessfulRegisteredDialog(); }, ); }, child: Container( width: 150, height: 56.0.h(), decoration: BoxDecoration( color: AppColors.primary20, borderRadius: BorderRadius.circular(100), ), alignment: Alignment.center, child: Text( TenderDetailsStrings.apply, style: TextStyle( fontSize: 14.0.sp(), fontWeight: FontWeight.w500, color: AppColors.mainBlue, ), ), ), ), ), ), ], ), ), ], ), ); } Widget _submissionType({ required VoidCallback onTap, required String title, required String time, required bool isSelected, }) { return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(8.0), border: Border.all( color: isSelected ? AppColors.mainBlue : AppColors.grey40, ), ), child: Material( color: Colors.transparent, child: InkWell( onTap: onTap, child: SizedBox( width: double.infinity, height: 40.0.h(), child: Row( children: [ Container( width: 20.0.w(), height: 20.0.w(), margin: EdgeInsets.symmetric( horizontal: 10.0.w(), vertical: 10.0.h(), ), padding: const EdgeInsets.all(3), decoration: BoxDecoration( shape: BoxShape.circle, border: Border.all( color: isSelected ? AppColors.mainBlue : AppColors.grey70, width: 2.0, ), ), alignment: Alignment.center, child: Container( decoration: BoxDecoration( shape: BoxShape.circle, color: isSelected ? AppColors.mainBlue : Colors.transparent, ), ), ), Expanded( child: Row( children: [ Text( title, style: TextStyle( fontSize: 14.0.sp(), fontWeight: FontWeight.w500, color: AppColors.grey80, ), ), const Spacer(), Text( time, style: TextStyle( fontSize: 14.0.sp(), fontWeight: FontWeight.w500, color: AppColors.grey80, ), ), SizedBox(width: 10.0.w()), ], ), ), ], ), ), ), ), ); } }