129 lines
4.2 KiB
Dart
129 lines
4.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
|
import 'package:ftc_mobile_app/models/appointmentsListResponse/AppointmentsListResponse.dart';
|
|
import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart';
|
|
import 'package:ftc_mobile_app/view/custom_widgets/my_circle_image.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class AppointmentDetailsDialog extends StatelessWidget {
|
|
final AppointmentsListResponseData data;
|
|
|
|
const AppointmentDetailsDialog({super.key, required this.data});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final appointmentDate = DateFormat("dd/MM/yyyy")
|
|
.format(DateTime.fromMillisecondsSinceEpoch(data.appointmentDate!));
|
|
|
|
final appointmentTime =
|
|
"${data.appointmentStartTime ?? "NA"} to ${data.appointmentEndTime ?? "NA"}";
|
|
|
|
final d = (data.appointmentMin ?? 0).minutes;
|
|
final duration =
|
|
"${d.inHours} hours and ${d.inMinutes - (d.inHours.hours.inMinutes)} minutes";
|
|
|
|
return AlertDialog(
|
|
insetPadding: REdgeInsets.all(18),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)),
|
|
backgroundColor: Colors.white,
|
|
surfaceTintColor: Colors.white,
|
|
content: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
data.appointmentTitle ?? "",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16.sp,
|
|
),
|
|
textAlign: TextAlign.left,
|
|
),
|
|
CustomTextWidget(
|
|
text: "$appointmentDate $appointmentTime",
|
|
fontSize: 13.sp,
|
|
textAlign: TextAlign.left,
|
|
),
|
|
16.verticalSpace,
|
|
CustomTextWidget(
|
|
text: "Appointment duration:",
|
|
fontSize: 14.sp,
|
|
fontColor: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
textAlign: TextAlign.left,
|
|
),
|
|
CustomTextWidget(
|
|
text: duration,
|
|
fontSize: 13.sp,
|
|
textAlign: TextAlign.left,
|
|
),
|
|
16.verticalSpace,
|
|
Text.rich(
|
|
TextSpan(
|
|
text: "Detail: ",
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
children: [
|
|
TextSpan(
|
|
text: data.appointmentDetails ?? "",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
)
|
|
]),
|
|
),
|
|
16.verticalSpace,
|
|
CustomTextWidget(
|
|
text: "Staff:",
|
|
fontSize: 14.sp,
|
|
fontColor: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
textAlign: TextAlign.left,
|
|
),
|
|
8.verticalSpace,
|
|
Row(
|
|
children: [
|
|
MyCircleImage(
|
|
imageSize: 32.r,
|
|
url: "${WebUrls.baseUrl}${data.staff?.profilePictureUrl ?? ""}",
|
|
errorWidget: CustomImageWidget(
|
|
imagePath: AssetsManager.kPersonMainIcon,
|
|
height: 32.r,
|
|
width: 32.r,
|
|
),
|
|
),
|
|
8.horizontalSpace,
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
data.staff?.name ?? "",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w500
|
|
),
|
|
),
|
|
Text(
|
|
"Contact No. ${data.staff?.phoneNumber ?? ""}",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
actions: const [CommonCloseTextButton()],
|
|
);
|
|
}
|
|
}
|