Files
tm_app/lib/views/detail/widgets/meeting_time_dialog.dart
T
amirrezaghabeli 919b9fb2ed Refactor completion of documents routing and UI components
- Removed unused mobile route for completion of documents.
- Updated app routes to reflect the removal of the mobile route.
- Enhanced the desktop and mobile pages for completion of documents with improved layout and added TabletDesktopAppbar.
- Introduced meeting time handling in TenderDetailActions, integrating new bottom sheet and dialog components for better user interaction.
- Added meeting time state management in TenderDetailViewModel.
- Cleaned up deprecated files related to meeting time selection.
2025-10-13 14:51:39 +03:30

199 lines
6.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:tm_app/core/routes/app_routes.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';
class MeetingTimeDialog extends StatefulWidget {
const MeetingTimeDialog({required this.onConfirm, super.key});
final ValueChanged<String> onConfirm;
@override
State<MeetingTimeDialog> createState() => _MeetingTimeDialogState();
}
class _MeetingTimeDialogState extends State<MeetingTimeDialog> {
int selectedType = 0;
late String type = '';
final List<Map<String, String>> 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: double.infinity,
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: [
Text(
TenderDetailsStrings.meetingTime,
style: TextStyle(
fontSize: 20.0.sp(),
fontWeight: FontWeight.w600,
color: AppColors.grey70,
),
),
SizedBox(height: 15.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()),
Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
widget.onConfirm(type);
context.pop();
const CompletionOfDocumentsRouteData().push(context);
},
child: Container(
width: double.infinity,
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()),
],
),
),
],
),
),
),
),
);
}
}