You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
350 lines
14 KiB
Dart
350 lines
14 KiB
Dart
import 'package:blinking_text/blinking_text.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:queuing_system/core/config/size_config.dart';
|
|
import 'package:queuing_system/core/response_models/call_config_model.dart';
|
|
import 'package:queuing_system/core/response_models/patient_ticket_model.dart';
|
|
import 'package:queuing_system/utils/call_type.dart';
|
|
import 'package:queuing_system/widget/data_display/app_texts_widget.dart';
|
|
|
|
class PriorityTickets extends StatelessWidget {
|
|
final List<PatientTicketModel> tickets;
|
|
final CallConfig callConfig;
|
|
|
|
const PriorityTickets({required this.tickets, required this.callConfig, Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final firstTicket = tickets[0];
|
|
final otherTickets = tickets.sublist(1, tickets.length);
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const SizedBox(height: 50),
|
|
TicketItem(
|
|
ticketNo: firstTicket.queueNo ?? '',
|
|
callType: firstTicket.getCallType(),
|
|
scale: 1.2,
|
|
blink: true,
|
|
roomNo: firstTicket.roomNo,
|
|
isClinicAdded: firstTicket.callNoStr != firstTicket.queueNo,
|
|
callConfig: callConfig,
|
|
),
|
|
const SizedBox(height: 50),
|
|
if (tickets.length > 1) ...[
|
|
SizedBox(height: SizeConfig.getHeightMultiplier() * 1.8),
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: otherTickets
|
|
.map((ticket) => Padding(
|
|
padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier() * 2),
|
|
child: TicketItem(
|
|
ticketNo: ticket.queueNo ?? '',
|
|
callType: ticket.getCallType(),
|
|
scale: 0.8,
|
|
roomNo: ticket.roomNo,
|
|
isClinicAdded: ticket.callNoStr != ticket.queueNo,
|
|
callConfig: callConfig,
|
|
),
|
|
))
|
|
.toList(),
|
|
)
|
|
]
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class TicketItem extends StatelessWidget {
|
|
final String ticketNo;
|
|
final String roomNo;
|
|
final CallType callType;
|
|
final bool blink;
|
|
final double scale;
|
|
final bool isClinicAdded;
|
|
final CallConfig callConfig;
|
|
|
|
const TicketItem({
|
|
Key? key,
|
|
required this.isClinicAdded,
|
|
required this.ticketNo,
|
|
required this.roomNo,
|
|
required this.callType,
|
|
required this.callConfig,
|
|
required this.scale,
|
|
this.blink = false,
|
|
}) : super(key: key);
|
|
|
|
String getFormattedTicket(String ticketNo, bool isClinicAdded) {
|
|
if (isClinicAdded) {
|
|
var formattedString = ticketNo.split(" ");
|
|
return formattedString[0] + " " + formattedString[1];
|
|
}
|
|
return ticketNo;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Transform.scale(
|
|
scale: scale,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
BlinkText(getFormattedTicket(ticketNo, isClinicAdded),
|
|
style: TextStyle(
|
|
fontSize: SizeConfig.getWidthMultiplier() * 10,
|
|
letterSpacing: -1,
|
|
height: 0.5,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
beginColor: Colors.black,
|
|
endColor: blink ? Colors.black.withOpacity(0.1) : Colors.black,
|
|
// endColor: blink ? AppGlobal.appRedColor : Colors.black,
|
|
times: 0,
|
|
duration: const Duration(seconds: 1)),
|
|
const SizedBox(height: 10),
|
|
Directionality(
|
|
textDirection: callConfig.textDirection,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 8),
|
|
child: callType.icon(SizeConfig.getHeightMultiplier() * 3),
|
|
),
|
|
const SizedBox(width: 10),
|
|
AppText(
|
|
callType.message(callConfig),
|
|
color: callType.color(),
|
|
letterSpacing: -1,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.8,
|
|
fontWeight: FontWeight.w600,
|
|
fontHeight: 1,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 8.0),
|
|
child: Container(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
width: 5,
|
|
height: SizeConfig.getHeightMultiplier() * 2,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
),
|
|
),
|
|
AppText(
|
|
callConfig.textDirection == TextDirection.ltr ? "${callConfig.roomText}: $roomNo" : " $roomNo : ${callConfig.roomText}",
|
|
color: callType.color(),
|
|
letterSpacing: -1,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.8,
|
|
fontWeight: FontWeight.w600,
|
|
fontHeight: 1,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
Widget noPatientInQueue() {
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Center(
|
|
child: AppText("Awaiting Patients Arrival", fontFamily: 'Poppins-SemiBold.ttf', fontSize: SizeConfig.getWidthMultiplier() * 9),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget qamarsBirthdayWidget() {
|
|
return Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText("Happy Birthday", fontFamily: 'Poppins-SemiBold.ttf', fontSize: SizeConfig.getWidthMultiplier() * 15),
|
|
Center(
|
|
child: AppText("Syed Qamar 🎉", fontFamily: 'Poppins-SemiBold.ttf', fontSize: SizeConfig.getWidthMultiplier() * 11),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget priorityTicketsWithSideList({required List<PatientTicketModel> tickets, required CallConfig callConfig}) {
|
|
final priorityTickets = tickets.sublist(0, 3);
|
|
final otherTickets = tickets.sublist(3, tickets.length);
|
|
return Row(
|
|
children: [
|
|
Expanded(flex: 7, child: PriorityTickets(callConfig: callConfig, tickets: priorityTickets)),
|
|
Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)),
|
|
Expanded(
|
|
flex: 6,
|
|
child: ListView(
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.fromLTRB(10, SizeConfig.getHeightMultiplier() * 3.3, 10, 10),
|
|
child: Directionality(
|
|
textDirection: callConfig.textDirection,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText(
|
|
callConfig.queueNoText,
|
|
letterSpacing: -2,
|
|
fontHeight: 0.5,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.8,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
width: 5,
|
|
height: SizeConfig.getHeightMultiplier() * 2,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
),
|
|
Expanded(
|
|
flex: 5,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText(
|
|
callConfig.callForText,
|
|
letterSpacing: -2,
|
|
fontHeight: 0.5,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.8,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
width: 5,
|
|
height: SizeConfig.getHeightMultiplier() * 2,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
),
|
|
Expanded(
|
|
flex: 3,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText(
|
|
callConfig.roomText,
|
|
letterSpacing: -2,
|
|
fontHeight: 0.5,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.8,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
ListView.builder(
|
|
shrinkWrap: true,
|
|
itemCount: otherTickets.length,
|
|
itemBuilder: (ctx, idx) {
|
|
final itm = otherTickets[idx];
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8),
|
|
child: Directionality(
|
|
textDirection: callConfig.textDirection,
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText(
|
|
itm.queueNo.toString(),
|
|
letterSpacing: -1,
|
|
fontHeight: 0.5,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 4,
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
width: 5,
|
|
height: SizeConfig.getHeightMultiplier() * 2,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
),
|
|
Expanded(
|
|
flex: 5,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
child: SizedBox(
|
|
width: SizeConfig.getWidthMultiplier() * 3.5,
|
|
child: itm.getCallType().icon(SizeConfig.getHeightMultiplier() * 2.5),
|
|
),
|
|
),
|
|
const SizedBox(width: 15),
|
|
AppText(
|
|
itm.getCallType().message(callConfig, isListView: true),
|
|
color: itm.getCallType().color(),
|
|
letterSpacing: -1,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3,
|
|
fontWeight: FontWeight.w600,
|
|
fontHeight: 0.5,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
width: 5,
|
|
height: SizeConfig.getHeightMultiplier() * 2,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
),
|
|
Expanded(
|
|
flex: 3,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AppText(
|
|
itm.roomNo, // callConfig.textDirection == TextDirection.ltr ? "${callConfig.roomText}: ${itm.roomNo}" : " ${itm.roomNo} ${callConfig.roomText}: ",
|
|
color: itm.getCallType().color(),
|
|
letterSpacing: -1.5,
|
|
fontSize: SizeConfig.getWidthMultiplier() * 3.3,
|
|
fontWeight: FontWeight.w600,
|
|
fontHeight: 0.5,
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
);
|
|
}
|