38222afcfa
- Updated AuthViewModel to hydrate user data from storage on initialization. - Added method to AuthRepository for retrieving stored customer data. - Enhanced AuthService to save and retrieve customer data from SharedPreferences. - Refactored UI components to use context.watch for user role updates in MeetingTimeDialog, TenderDetailActions, and TendersPage. - Improved navigation logic in final completion pages to handle user interactions more effectively.
206 lines
6.9 KiB
Dart
206 lines
6.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:provider/provider.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/view_models/auth_view_model.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) {
|
|
final userRole = context.watch<AuthViewModel>().userRole;
|
|
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();
|
|
userRole == Role.admin
|
|
? const CompletionOfDocumentsRouteData().push(context)
|
|
: const FinalCompletionOfDocumentsRouteData().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()),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|