merge-update-with-lab-changes
devamirsaleemahmad 2 years ago
parent ed748a626b
commit cbc38940ea

@ -151,8 +151,8 @@ class BaseAppClient {
// body['IdentificationNo'] = 1023854217; // body['IdentificationNo'] = 1023854217;
// body['MobileNo'] = "531940021"; // body['MobileNo'] = "531940021";
body?['PatientID'] = 1231755; //3844083 // body?['PatientID'] = 1231755; //3844083
body?['TokenID'] = "@dm!n"; // body?['TokenID'] = "@dm!n";
// Patient ID: 3027574 // Patient ID: 3027574
// Mobile no.: 0502303285 // Mobile no.: 0502303285

@ -69,6 +69,9 @@ class _MyApp extends State<MyApp> {
//0537503378 //0537503378
//1231755 //1231755
//2466305493
//0567184134 mobile
// checkForUpdate() { // checkForUpdate() {
// // todo need to verify 'imp' // // todo need to verify 'imp'

@ -98,7 +98,7 @@ class _BookConfirmState extends State<BookConfirm> {
widget.doctor.projectName!, widget.doctor.projectName!,
null, null,
null, null,
widget.doctor.nationalityFlagURL!, widget.doctor.nationalityFlagURL ?? "",
widget.doctor.doctorRate, widget.doctor.doctorRate,
null, null,
widget.doctor.noOfPatientsRate, widget.doctor.noOfPatientsRate,
@ -212,7 +212,7 @@ class _BookConfirmState extends State<BookConfirm> {
disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12), disabledBackgroundColor: new Color(0xFFbcc2c4).withOpacity(0.12),
elevation: 0, elevation: 0,
onPressed: () async { onPressed: () async {
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false;
if (isLiveCareSchedule != null && isLiveCareSchedule) { if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } else {
@ -257,12 +257,12 @@ class _BookConfirmState extends State<BookConfirm> {
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) async {
ConfirmDialog.closeAlertDialog(context); ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService(); DoctorsListService service = DoctorsListService();
bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); bool isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false;
service.cancelAppointment(appo, context, isReschedule: true).then((res) { service.cancelAppointment(appo, context, isReschedule: true).then((res) {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
Future.delayed(new Duration(milliseconds: 1500), () async { Future.delayed(Duration(milliseconds: 1500), () async {
if (isLiveCareSchedule != null && isLiveCareSchedule) { if (isLiveCareSchedule != null && isLiveCareSchedule) {
insertLiveCareScheduledAppointment(context, widget.doctor); insertLiveCareScheduledAppointment(context, widget.doctor);
} else { } else {
@ -285,7 +285,7 @@ class _BookConfirmState extends State<BookConfirm> {
getPatientShare(context, appointmentNo, docObject.clinicID!, docObject.projectID!, docObject); getPatientShare(context, appointmentNo, docObject.clinicID!, docObject.projectID!, docObject);
getToDoCount(); getToDoCount();
} else { } else {
ConfirmDialog dialog = new ConfirmDialog( ConfirmDialog dialog = ConfirmDialog(
isDissmissable: false, isDissmissable: false,
context: context, context: context,
confirmMessage: res['ErrorEndUserMessage'], confirmMessage: res['ErrorEndUserMessage'],
@ -334,8 +334,7 @@ class _BookConfirmState extends State<BookConfirm> {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
Future.delayed(new Duration(milliseconds: 500), () { Future.delayed(Duration(milliseconds: 500), () {
// checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context); // checkPatientNphiesEligibility(docObject, res['AppointmentNo'], context);
getToDoCount(); getToDoCount();
getPatientShare(context, res['AppointmentNo'], docObject.clinicID!, docObject.projectID!, docObject); getPatientShare(context, res['AppointmentNo'], docObject.clinicID!, docObject.projectID!, docObject);
@ -350,7 +349,7 @@ class _BookConfirmState extends State<BookConfirm> {
projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor); projectViewModel.analytics.appointment.book_appointment_confirmation_success(appointment_type: 'regular', dateTime: timeSlot!, doctor: widget.doctor);
} else { } else {
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
appo = new AppoitmentAllHistoryResultList(); appo = AppoitmentAllHistoryResultList();
appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo']; appo.appointmentNo = res['SameClinicApptList'][0]['AppointmentNo'];
appo.clinicID = res['SameClinicApptList'][0]['DoctorID']; appo.clinicID = res['SameClinicApptList'][0]['DoctorID'];
appo.projectID = res['SameClinicApptList'][0]['ProjectID']; appo.projectID = res['SameClinicApptList'][0]['ProjectID'];
@ -362,13 +361,14 @@ class _BookConfirmState extends State<BookConfirm> {
appo.originalProjectID = 0; appo.originalProjectID = 0;
appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate']; appo.appointmentDate = res['SameClinicApptList'][0]['AppointmentDate'];
ConfirmDialog dialog = new ConfirmDialog( ConfirmDialog dialog = ConfirmDialog(
context: context, context: context,
confirmMessage: res['ErrorEndUserMessage'], confirmMessage: res['ErrorEndUserMessage'],
okText: TranslationBase.of(context).confirm, okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps, cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () => {cancelAppointment(docObject, appo, context)}, okFunction: () => {cancelAppointment(docObject, appo, context)},
cancelFunction: () => {}); cancelFunction: () => {},
);
dialog.showAlertDialog(context); dialog.showAlertDialog(context);
} }
}).catchError((err) { }).catchError((err) {
@ -382,10 +382,12 @@ class _BookConfirmState extends State<BookConfirm> {
insertLiveCareScheduledAppointment(context, DoctorList docObject) { insertLiveCareScheduledAppointment(context, DoctorList docObject) {
final timeSlot = DocAvailableAppointments.selectedAppoDateTime; final timeSlot = DocAvailableAppointments.selectedAppoDateTime;
widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0]; widget.selectedDate = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[0];
widget.selectedTime = timeSlot!.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5); widget.selectedTime = timeSlot.toUtc().add(Duration(hours: 3)).toString().split(" ")[1].substring(0, 5);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
AppoitmentAllHistoryResultList appo; AppoitmentAllHistoryResultList appo;
widget.service.insertLiveCareScheduleAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, context).then((res) { widget.service
.insertLiveCareScheduleAppointment(docObject.doctorID!, docObject.clinicID!, docObject.projectID!, docObject.serviceID, widget.selectedTime, widget.selectedDate, context)
.then((res) {
if (res['MessageStatus'] == 1) { if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess); AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
print(res['AppointmentNo']); print(res['AppointmentNo']);

@ -84,7 +84,7 @@ class _DocAvailableAppointmentsState extends State<DocAvailableAppointments> wit
WidgetsBinding.instance.addPostFrameCallback((_) async { WidgetsBinding.instance.addPostFrameCallback((_) async {
getCurrentLanguage(); getCurrentLanguage();
isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT); isLiveCareSchedule = await this.sharedPref.getBool(IS_LIVECARE_APPOINTMENT) ?? false;
if (isLiveCareSchedule != null && isLiveCareSchedule) if (isLiveCareSchedule != null && isLiveCareSchedule)
getDoctorScheduledFreeSlots(context, widget.doctor); getDoctorScheduledFreeSlots(context, widget.doctor);
else { else {
@ -471,7 +471,6 @@ class MeetingDataSource extends CalendarDataSource {
} }
return meetingData; return meetingData;
} }
} }
class Meeting { class Meeting {

@ -106,7 +106,7 @@ class _SchedulePageState extends State<SchedulePage> {
Expanded( Expanded(
flex: 1, flex: 1,
child: Padding( child: Padding(
padding: projectViewModel.isArabic ? EdgeInsets.only(right: 20) : EdgeInsets.only(left: 20), padding: projectViewModel.isArabic ? EdgeInsets.only(right: 17) : EdgeInsets.only(left: 17),
child: Row(children: [ child: Row(children: [
Column( Column(
children: [ children: [

@ -650,7 +650,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
: value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString(); : value['List_PatientDashboard'][0]['UnreadPatientNotificationCount'].toString();
model.setState(model.count, true, notificationCount); model.setState(model.count, true, notificationCount);
sharedPref.setString(NOTIFICATION_COUNT, notificationCount); sharedPref.setString(NOTIFICATION_COUNT, notificationCount);
FlutterAppIconBadge.updateBadge(int.parse(notificationCount)); FlutterAppIconBadge.updateBadge(int.parse(notificationCount.split("+").first));
} }
}), }),
}); });

@ -53,13 +53,13 @@ class ConfirmLogin extends StatefulWidget {
class _ConfirmLogin extends State<ConfirmLogin> { class _ConfirmLogin extends State<ConfirmLogin> {
final LocalAuthentication auth = LocalAuthentication(); final LocalAuthentication auth = LocalAuthentication();
var _availableBiometrics; var _availableBiometrics;
var sharedPref = new AppSharedPreferences(); var sharedPref = AppSharedPreferences();
late bool authenticated; bool authenticated = false;
final authService = new AuthProvider(); final authService = AuthProvider();
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>(); PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
late int mobileNumber; late int mobileNumber;
String errorMsg = ''; String errorMsg = '';
late SelectDeviceIMEIRES user; SelectDeviceIMEIRES user = SelectDeviceIMEIRES();
bool isLoading = false; bool isLoading = false;
var registerd_data; var registerd_data;
bool isMoreOption = false; bool isMoreOption = false;
@ -84,7 +84,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
late bool _loading; late bool _loading;
late int fingrePrintBefore; int fingrePrintBefore = 0;
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>(); AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>(); AppointmentRateViewModel appointmentRateViewModel = locator<AppointmentRateViewModel>();
@ -139,7 +139,7 @@ class _ConfirmLogin extends State<ConfirmLogin> {
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64), style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.64),
), ),
Text( Text(
user.name!.toLowerCase().capitalizeFirstofEach, user.name!.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44), style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: Color(0xff2B353E), height: 1, letterSpacing: -1.44),
), ),
SizedBox(height: 10), SizedBox(height: 10),
@ -632,7 +632,8 @@ class _ConfirmLogin extends State<ConfirmLogin> {
sharedPref.remove(FAMILY_FILE), sharedPref.remove(FAMILY_FILE),
result.list.isFamily = false, result.list.isFamily = false,
userData = result.list, userData = result.list,
sharedPref.setString(BLOOD_TYPE, result.patientBloodType), sharedPref.setString(BLOOD_TYPE, result.patientBloodType ?? "O+"),
//Remove o+ from here Added by Aamir
authenticatedUserObject.user = result.list, authenticatedUserObject.user = result.list,
projectViewModel.setPrivilege(privilegeList: res), projectViewModel.setPrivilege(privilegeList: res),
sharedPref.setObject(MAIN_USER, result.list), sharedPref.setObject(MAIN_USER, result.list),
@ -658,9 +659,9 @@ class _ConfirmLogin extends State<ConfirmLogin> {
} }
}) })
.catchError((err) { .catchError((err) {
print(err);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
print(err);
AppToast.showErrorToast(message: err); AppToast.showErrorToast(message: err);
startSMSService(tempType); startSMSService(tempType);
}); });

@ -38,7 +38,7 @@ class _LaboratoryResultPageState extends State<LaboratoryResultPage> {
clinicID: widget.patientLabOrders!.clinicID!, clinicID: widget.patientLabOrders!.clinicID!,
projectID: widget.patientLabOrders!.projectID!, projectID: widget.patientLabOrders!.projectID!,
orderNo: widget.patientLabOrders!.orderNo!, orderNo: widget.patientLabOrders!.orderNo!,
setupID: widget.patientLabOrders!.setupID!, setupID: widget.patientLabOrders!.setupID ?? "0",
isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)), isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrders!.projectID!)),
), ),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:diplomaticquarterapp/main.dart';
import 'package:diplomaticquarterapp/models/header_model.dart'; import 'package:diplomaticquarterapp/models/header_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart'; import 'package:diplomaticquarterapp/pages/medical/prescriptions/prescription_details_inp.dart';
@ -29,7 +30,7 @@ class PrescriptionItemsPage extends StatelessWidget {
final Prescriptions prescriptions; final Prescriptions prescriptions;
late ProjectViewModel projectViewModel; late ProjectViewModel projectViewModel;
PrescriptionItemsPage({ Key? key, required this.prescriptions}); PrescriptionItemsPage({Key? key, required this.prescriptions});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -42,373 +43,379 @@ class PrescriptionItemsPage extends StatelessWidget {
baseViewModel: model, baseViewModel: model,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: model.state != ViewState.Busy ? Column( body: model.state != ViewState.Busy
children: [ ? Column(
Expanded( children: [
child: SingleChildScrollView( Expanded(
physics: BouncingScrollPhysics(), child: SingleChildScrollView(
child: Column( physics: BouncingScrollPhysics(),
children: [ child: Column(
DoctorHeader( children: [
headerModel: HeaderModel( DoctorHeader(
prescriptions.doctorName!, headerModel: HeaderModel(
prescriptions.doctorID!, prescriptions.doctorName!,
prescriptions.doctorImageURL!, prescriptions.doctorID!,
prescriptions.speciality ?? [""], prescriptions.doctorImageURL!,
"", prescriptions.speciality ?? [""],
prescriptions.name!, "",
DateUtil.convertStringToDate(prescriptions.appointmentDate!), prescriptions.name!,
DateUtil.formatDateToTime(DateUtil.convertStringToDate(model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!)), DateUtil.convertStringToDate(prescriptions.appointmentDate!),
prescriptions.nationalityFlagURL!, DateUtil.formatDateToTime(
prescriptions.doctorRate, DateUtil.convertStringToDate(
prescriptions.actualDoctorRate, model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!,
prescriptions.noOfPatientsRate, ),
projectViewModel.user!.emailAddress!, ),
), prescriptions.nationalityFlagURL!,
isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false, prescriptions.doctorRate,
showConfirmMessageDialog: false, prescriptions.actualDoctorRate,
onTap: () { prescriptions.noOfPatientsRate,
showConfirmMessage(context, model); projectViewModel.user.emailAddress!,
}, ),
), isNeedToShowButton: (model.prescriptionReportListINP.length > 0 || model.prescriptionReportEnhList.length > 0) ? projectViewModel.havePrivilege(13) : false,
if (!prescriptions.isInOutPatient!) showConfirmMessageDialog: false,
model.prescriptionReportListINP.length > 0 onTap: () {
? ListView.separated( showConfirmMessage(context, model);
itemBuilder: (context, index) { },
return InkWell( ),
onTap: () { if (!prescriptions.isInOutPatient!)
Navigator.push( model.prescriptionReportListINP.length > 0
context, ? ListView.separated(
FadePage( itemBuilder: (context, index) {
page: PrescriptionDetailsPageINP( return InkWell(
prescriptionReport: model.prescriptionReportListINP[index], onTap: () {
prescriptions: prescriptions, Navigator.push(
), context,
), FadePage(
); page: PrescriptionDetailsPageINP(
}, prescriptionReport: model.prescriptionReportListINP[index],
child: Container( prescriptions: prescriptions,
width: double.infinity, ),
child: Container( ),
margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4), );
decoration: cardRadius(12), },
child: Padding( child: Container(
padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), width: double.infinity,
child: Row( child: Container(
children: [ margin: EdgeInsets.only(left: 16, right: 16, top: index == 0 ? 16 : 4, bottom: 4),
Flexible( decoration: cardRadius(12),
child: Column( child: Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12),
child: Row(
children: [ children: [
Text( Flexible(
model.prescriptionReportListINP[index].itemDescription!.isNotEmpty child: Column(
? model.prescriptionReportListINP[index].itemDescription! crossAxisAlignment: CrossAxisAlignment.start,
: model.prescriptionReportListINP[index].itemDescriptionN ?? '', children: [
style: TextStyle( Text(
fontSize: 16, model.prescriptionReportListINP[index].itemDescription!.isNotEmpty
letterSpacing: -0.64, ? model.prescriptionReportListINP[index].itemDescription!
fontWeight: FontWeight.w600, : model.prescriptionReportListINP[index].itemDescriptionN ?? '',
), style: TextStyle(
), fontSize: 16,
mHeight(10), letterSpacing: -0.64,
Row( fontWeight: FontWeight.w600,
children: [
// InkWell(
// child: Stack(
// alignment: Alignment.center,
// children: [
// Container(
// child: Image.network(
// model.prescriptionReportListINP[index].imageSRCUrl,
// fit: BoxFit.cover,
// width: 60,
// height: 60,
// ),
// margin: EdgeInsets.zero,
// clipBehavior: Clip.antiAlias,
// decoration: cardRadius(2000),
// ),
// Container(
// child: Icon(
// Icons.search,
// size: 18,
// color: Colors.white,
// ),
// padding: EdgeInsets.all(6),
// decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
// )
// ],
// ),
// onTap: () {
// showZoomImageDialog(
// context,
// model.prescriptionReportListINP[index].imageSRCUrl,
// );
// },
// ),
// mWidth(12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
TranslationBase.of(context).route + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportListINP[index].route!,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
), ),
Row( ),
children: [ mHeight(10),
Text( Row(
TranslationBase.of(context).dailyDoses + ": ", children: [
style: TextStyle( // InkWell(
color: Colors.grey, // child: Stack(
fontSize: 10, // alignment: Alignment.center,
letterSpacing: -0.4, // children: [
fontWeight: FontWeight.w600, // Container(
// child: Image.network(
// model.prescriptionReportListINP[index].imageSRCUrl,
// fit: BoxFit.cover,
// width: 60,
// height: 60,
// ),
// margin: EdgeInsets.zero,
// clipBehavior: Clip.antiAlias,
// decoration: cardRadius(2000),
// ),
// Container(
// child: Icon(
// Icons.search,
// size: 18,
// color: Colors.white,
// ),
// padding: EdgeInsets.all(6),
// decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
// )
// ],
// ),
// onTap: () {
// showZoomImageDialog(
// context,
// model.prescriptionReportListINP[index].imageSRCUrl,
// );
// },
// ),
// mWidth(12),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
TranslationBase.of(context).route + ": ",
style: TextStyle(
color: Colors.grey,
fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportListINP[index].route!,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
), ),
), Row(
Text( children: [
model.prescriptionReportListINP[index].doseDailyQuantity.toString(), Text(
style: TextStyle( TranslationBase.of(context).dailyDoses + ": ",
fontSize: 12, style: TextStyle(
letterSpacing: -0.48, color: Colors.grey,
fontWeight: FontWeight.w600, fontSize: 10,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
Text(
model.prescriptionReportListINP[index].doseDailyQuantity.toString(),
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
],
), ),
), mHeight(12),
], Text(
), model.prescriptionReportListINP[index].remarks!,
mHeight(12), style: TextStyle(
Text( color: Colors.grey,
model.prescriptionReportListINP[index].remarks!, fontSize: 10,
style: TextStyle( letterSpacing: -0.4,
color: Colors.grey, fontWeight: FontWeight.w600,
fontSize: 10, ),
letterSpacing: -0.4, ),
fontWeight: FontWeight.w600, ],
), )
), ],
], ),
) ],
], ),
),
Icon(
Icons.arrow_forward,
size: 16,
), ),
], ],
), ),
), ),
Icon( ),
Icons.arrow_forward,
size: 16,
),
],
),
),
),
),
);
},
separatorBuilder: (context, index) {
return mHeight(8);
},
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: model.prescriptionReportListINP.length)
: Padding(
padding: const EdgeInsets.only(top: 150.0),
child: getNoDataWidget(context),
)
else
model.prescriptionReportEnhList.length > 0
? ListView.separated(
padding: EdgeInsets.all(21),
itemBuilder: (context, index) {
return InkWell(
onTap: () {
PrescriptionReport prescriptionReport = PrescriptionReport(
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl,
itemDescription: model.prescriptionReportEnhList[index].itemDescription,
itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription,
routeN: model.prescriptionReportEnhList[index].route,
frequency: model.prescriptionReportEnhList[index].frequency,
frequencyN: model.prescriptionReportEnhList[index].frequency,
doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity,
days: model.prescriptionReportEnhList[index].days,
itemID: model.prescriptionReportEnhList[index].itemID,
orderDate: model.prescriptionReportEnhList[index].orderDate,
startDate: model.prescriptionReportEnhList[index].startDate,
remarks: model.prescriptionReportEnhList[index].remarks);
Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport: prescriptionReport,
prescriptions: prescriptions,
),
),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
), ),
], );
), },
child: Padding( separatorBuilder: (context, index) {
padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12), return mHeight(8);
child: Row( },
children: [ physics: NeverScrollableScrollPhysics(),
Flexible( shrinkWrap: true,
child: Column( itemCount: model.prescriptionReportListINP.length)
crossAxisAlignment: CrossAxisAlignment.start, : Padding(
padding: const EdgeInsets.only(top: 150.0),
child: getNoDataWidget(context),
)
else
model.prescriptionReportEnhList.length > 0
? ListView.separated(
padding: EdgeInsets.all(21),
itemBuilder: (context, index) {
return InkWell(
onTap: () {
PrescriptionReport prescriptionReport = PrescriptionReport(
imageSRCUrl: model.prescriptionReportEnhList[index].imageSRCUrl,
itemDescription: model.prescriptionReportEnhList[index].itemDescription,
itemDescriptionN: model.prescriptionReportEnhList[index].itemDescription,
routeN: model.prescriptionReportEnhList[index].route,
frequency: model.prescriptionReportEnhList[index].frequency,
frequencyN: model.prescriptionReportEnhList[index].frequency,
doseDailyQuantity: model.prescriptionReportEnhList[index].doseDailyQuantity,
days: model.prescriptionReportEnhList[index].days,
itemID: model.prescriptionReportEnhList[index].itemID,
orderDate: model.prescriptionReportEnhList[index].orderDate,
startDate: model.prescriptionReportEnhList[index].startDate,
remarks: model.prescriptionReportEnhList[index].remarks);
Navigator.push(
context,
FadePage(
page: PrescriptionDetailsPage(
prescriptionReport: prescriptionReport,
prescriptions: prescriptions,
),
),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
blurRadius: 27,
offset: Offset(0, -3),
),
],
),
child: Padding(
padding: EdgeInsets.only(top: 12, bottom: 20, left: projectViewModel.isArabic ? 12 : 20, right: projectViewModel.isArabic ? 20 : 12),
child: Row(
children: [ children: [
Text( Flexible(
(model.prescriptionReportEnhList[index].itemDescription!.isNotEmpty child: Column(
? model.prescriptionReportEnhList[index].itemDescription crossAxisAlignment: CrossAxisAlignment.start,
: model.prescriptionReportEnhList[index].itemDescriptionN ?? '') children: [
!.toLowerCase() Text(
.capitalizeFirstofEach, (model.prescriptionReportEnhList[index].itemDescription!.isNotEmpty
style: TextStyle( ? model.prescriptionReportEnhList[index].itemDescription
fontSize: 16, : model.prescriptionReportEnhList[index].itemDescriptionN ?? '')!
color: Color(0xff2E303A), .toLowerCase()
letterSpacing: -0.64, .capitalizeFirstofEach,
fontWeight: FontWeight.w600, style: TextStyle(
), fontSize: 16,
), color: Color(0xff2E303A),
mHeight(10), letterSpacing: -0.64,
Row( fontWeight: FontWeight.w600,
crossAxisAlignment: CrossAxisAlignment.start, ),
children: [ ),
// InkWell( mHeight(10),
// child: Stack( Row(
// alignment: Alignment.center,
// children: [
// Container(
// child: Image.network(
// model.prescriptionReportEnhList[index].imageSRCUrl,
// fit: BoxFit.cover,
// width: 60,
// height: 60,
// ),
// margin: EdgeInsets.zero,
// clipBehavior: Clip.antiAlias,
// decoration: cardRadius(2000),
// ),
// Container(
// child: Icon(
// Icons.search,
// size: 18,
// color: Colors.white,
// ),
// padding: EdgeInsets.all(6),
// decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
// )
// ],
// ),
// onTap: () {
// showZoomImageDialog(
// context,
// model.prescriptionReportEnhList[index].imageSRCUrl,
// );
// },
// ),
// mWidth(12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route!, projectViewModel.isArabic), // InkWell(
MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(), // child: Stack(
projectViewModel.isArabic), // alignment: Alignment.center,
mHeight(9), // children: [
Text( // Container(
model.prescriptionReportEnhList[index].remarks!, // child: Image.network(
style: TextStyle( // model.prescriptionReportEnhList[index].imageSRCUrl,
color: Color(0xff575757), // fit: BoxFit.cover,
fontSize: 12, // width: 60,
letterSpacing: -0.4, // height: 60,
fontWeight: FontWeight.w600, // ),
// margin: EdgeInsets.zero,
// clipBehavior: Clip.antiAlias,
// decoration: cardRadius(2000),
// ),
// Container(
// child: Icon(
// Icons.search,
// size: 18,
// color: Colors.white,
// ),
// padding: EdgeInsets.all(6),
// decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
// )
// ],
// ),
// onTap: () {
// showZoomImageDialog(
// context,
// model.prescriptionReportEnhList[index].imageSRCUrl,
// );
// },
// ),
// mWidth(12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MyRichText(TranslationBase.of(context).route + ": ", model.prescriptionReportEnhList[index].route!, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).dailyDoses + ": ", model.prescriptionReportEnhList[index].doseDailyQuantity.toString(),
projectViewModel.isArabic),
mHeight(9),
Text(
model.prescriptionReportEnhList[index].remarks!,
style: TextStyle(
color: Color(0xff575757),
fontSize: 12,
letterSpacing: -0.4,
fontWeight: FontWeight.w600,
),
),
],
), ),
), )
], ],
), ),
) ],
], ),
),
Icon(
Icons.arrow_forward,
size: 16,
), ),
], ],
), ),
), ),
Icon( ),
Icons.arrow_forward, );
size: 16, },
), separatorBuilder: (context, index) {
], return mHeight(12);
), },
), shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionReportEnhList.length)
: Padding(
padding: const EdgeInsets.only(top: 150.0),
child: getNoDataWidget(context),
), ),
); ],
},
separatorBuilder: (context, index) {
return mHeight(12);
},
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: model.prescriptionReportEnhList.length)
: Padding(
padding: const EdgeInsets.only(top: 150.0),
child: getNoDataWidget(context),
),
],
),
),
),
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
child: DefaultButton(
TranslationBase.of(context).resendOrder,
() {
if (model.isMedDeliveryAllowed == false) {
AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError);
} else {
Navigator.push(
context,
FadePage(
page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions,
prescriptionReportList: model.prescriptionReportList,
prescriptionReportEnhList: model.prescriptionReportEnhList,
),
), ),
); ),
} ),
}, Container(
color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846), color: Colors.white,
disabledColor: Color(0xff575757), padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
), child: DefaultButton(
), TranslationBase.of(context).resendOrder,
], () {
) : Container(), if (model.isMedDeliveryAllowed == false) {
AppToast.showErrorToast(message: TranslationBase.of(context).prescriptionDeliveryError);
} else {
Navigator.push(
context,
FadePage(
page: PrescriptionDeliveryAddressPage(
prescriptions: prescriptions,
prescriptionReportList: model.prescriptionReportList,
prescriptionReportEnhList: model.prescriptionReportEnhList,
),
),
);
}
},
color: model.isMedDeliveryAllowed == false ? Color(0xff575757) : Color(0xff359846),
disabledColor: Color(0xff575757),
),
),
],
)
: Container(),
), ),
); );
} }

@ -14,7 +14,7 @@ import '../show_zoom_image_dialog.dart';
/// [height] the avatar height /// [height] the avatar height
/// [onTap] on tap function /// [onTap] on tap function
class LargeAvatar extends StatelessWidget { class LargeAvatar extends StatelessWidget {
LargeAvatar({Key? key, this.name, this.url, this.disableProfileView= false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar= false}) : super(key: key); LargeAvatar({Key? key, this.name, this.url, this.disableProfileView = false, this.radius = 70.0, this.width = 70, this.height = 60, this.onTap, this.isAppointmentAvatar = false}) : super(key: key);
final String? name; final String? name;
final String? url; final String? url;
@ -41,7 +41,11 @@ class LargeAvatar extends StatelessWidget {
), ),
if (!disableProfileView && !isAppointmentAvatar) if (!disableProfileView && !isAppointmentAvatar)
Container( Container(
child: Icon(Icons.search,size: 18,color: Colors.white,), child: Icon(
Icons.search,
size: 18,
color: Colors.white,
),
padding: EdgeInsets.all(6), padding: EdgeInsets.all(6),
decoration: containerRadius(Colors.black.withOpacity(0.3), 200), decoration: containerRadius(Colors.black.withOpacity(0.3), 200),
) )
@ -63,10 +67,11 @@ class LargeAvatar extends StatelessWidget {
return InkWell( return InkWell(
onTap: disableProfileView onTap: disableProfileView
? null ? null
: isAppointmentAvatar ? onTap : () { : isAppointmentAvatar
print("ssssss " + url!.trim()); ? onTap
showZoomImageDialog(context, url!.trim() ?? ""); : () {
}, showZoomImageDialog(context, url!.trim() ?? "");
},
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
// gradient: LinearGradient( // gradient: LinearGradient(

@ -36,7 +36,8 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
return BaseView<LabsViewModel>( return BaseView<LabsViewModel>(
onModelReady: (model) => model.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!), onModelReady: (model) =>
model.getPatientLabResult(isVidaPlus: Utils.isVidaPlusProject(projectViewModel, int.parse(widget.patientLabOrder!.projectID!)), patientLabOrder: widget.patientLabOrder!),
builder: (_, model, w) => NetworkBaseView( builder: (_, model, w) => NetworkBaseView(
baseViewModel: model, baseViewModel: model,
child: Column( child: Column(
@ -45,7 +46,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
DoctorHeader( DoctorHeader(
headerModel: HeaderModel( headerModel: HeaderModel(
widget.patientLabOrder!.doctorName!, widget.patientLabOrder!.doctorName!,
widget.patientLabOrder!.doctorID!, widget.patientLabOrder!.doctorID ?? 0,
widget.patientLabOrder!.doctorImageURL!, widget.patientLabOrder!.doctorImageURL!,
widget.patientLabOrder!.speciality ?? [""], widget.patientLabOrder!.speciality ?? [""],
widget.billNo!, widget.billNo!,
@ -56,7 +57,7 @@ class _LaboratoryResultWidgetState extends State<LaboratoryResultWidget> {
widget.patientLabOrder!.doctorRate!, widget.patientLabOrder!.doctorRate!,
widget.patientLabOrder!.actualDoctorRate!, widget.patientLabOrder!.actualDoctorRate!,
widget.patientLabOrder!.noOfPatientsRate!, widget.patientLabOrder!.noOfPatientsRate!,
projectViewModel.user!.emailAddress!), projectViewModel.user.emailAddress!),
onTap: widget.onTap!, onTap: widget.onTap!,
), ),
SizedBox(height: 10), SizedBox(height: 10),

@ -16,7 +16,7 @@ class ConfirmDialog {
final Function? cancelFunction; final Function? cancelFunction;
final isDissmissable; final isDissmissable;
ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, required this.okFunction, @required this.cancelFunction, this.isDissmissable = true}); ConfirmDialog({required this.context, this.title, required this.confirmMessage, required this.okText, required this.cancelText, required this.okFunction, required this.cancelFunction, this.isDissmissable = true});
showAlertDialog(BuildContext context) { showAlertDialog(BuildContext context) {
Dialog alert = Dialog( Dialog alert = Dialog(
@ -28,8 +28,8 @@ class ConfirmDialog {
confirmMessage, confirmMessage,
okText, okText,
cancelText, cancelText,
cancelFunction: cancelFunction!, cancelFunction: cancelFunction,
okFunction: okFunction!, okFunction: okFunction,
), ),
), ),
); );

@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart'; import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
import 'package:diplomaticquarterapp/widgets/my_rich_text.dart'; import 'package:diplomaticquarterapp/widgets/my_rich_text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -41,7 +42,7 @@ class DoctorHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String _speciality = (headerModel?.speciality ?? []).length > 0 ? headerModel!.speciality.first : ""; String _speciality = (headerModel.speciality ?? []).length > 0 ? headerModel.speciality.first : "";
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
return Container( return Container(
color: Colors.white, color: Colors.white,
@ -53,7 +54,7 @@ class DoctorHeader extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.only(left: 21, right: 21, bottom: 12), padding: EdgeInsets.only(left: 21, right: 21, bottom: 12),
child: Text( child: Text(
headerModel!.doctorName!, headerModel.doctorName,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24), fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
@ -66,13 +67,15 @@ class DoctorHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LargeAvatar( LargeAvatar(
name: headerModel!.doctorName, name: headerModel.doctorName,
url: headerModel!.doctorImageURL, url: headerModel.doctorImageURL,
width: 51, width: 51,
height: 51, height: 51,
disableProfileView: headerModel.doctorImageURL.isEmpty && headerModel.doctorImageURL == null ? true : false,
), ),
SizedBox(width: 10), SizedBox(width: 10),
Expanded( Expanded(
flex: 4,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -101,10 +104,10 @@ class DoctorHeader extends StatelessWidget {
headerModel.time ?? DateUtil.formatDateToTime(headerModel.date!), headerModel.time ?? DateUtil.formatDateToTime(headerModel.date!),
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12), style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12),
), ),
if (headerModel?.nationalityFlagURL != null) if (headerModel.nationalityFlagURL != null)
Padding( Padding(
padding: const EdgeInsets.only(top: 8.0), padding: const EdgeInsets.only(top: 8.0),
child: Image.network(headerModel.nationalityFlagURL ?? "", height: 20), child: headerModel.nationalityFlagURL.isNotEmpty && headerModel.nationalityFlagURL != null ? Image.network(headerModel.nationalityFlagURL, height: 20) : SizedBox(),
), ),
], ],
) )
@ -291,25 +294,26 @@ class DoctorHeader extends StatelessWidget {
// filledIcon: Icons.star, // filledIcon: Icons.star,
// emptyIcon: Icons.star, // emptyIcon: Icons.star,
// ), // ),
RatingBar( RatingBar(
itemSize: 20.0, itemSize: 20.0,
allowHalfRating: true, allowHalfRating: true,
initialRating: this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(), initialRating:
ratingWidget: RatingWidget( this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(),
full: Icon( ratingWidget: RatingWidget(
Icons.star, full: Icon(
color: Color(0XFFD02127), Icons.star,
), color: Color(0XFFD02127),
half: Icon( ),
Icons.star_half, half: Icon(
color: Color(0XFFD02127), Icons.star_half,
), color: Color(0XFFD02127),
empty: Icon( ),
Icons.star_border, empty: Icon(
color: Color(0XFFD02127), Icons.star_border,
), color: Color(0XFFD02127),
), ),
onRatingUpdate: (double value) {}), ),
onRatingUpdate: (double value) {}),
// RatingBar( // RatingBar(
// initialRating: this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(), // initialRating: this.headerModel!.decimalDoctorRate! != null ? double.tryParse(this.headerModel!.decimalDoctorRate!)! : this.headerModel!.actualDoctorRate!.toDouble(),
// //size: 15.0, // //size: 15.0,

@ -23,7 +23,7 @@ class ProvidedPinBoxTextAnimation {
class OTPWidget extends StatefulWidget { class OTPWidget extends StatefulWidget {
final int maxLength; final int maxLength;
late TextEditingController? controller; late TextEditingController? controller;
final Color defaultBorderColor; final Color defaultBorderColor;
final Color pinBoxColor; final Color pinBoxColor;
@ -47,7 +47,7 @@ class OTPWidget extends StatefulWidget {
final TextInputType keyboardType; final TextInputType keyboardType;
final EdgeInsets pinBoxOuterPadding; final EdgeInsets pinBoxOuterPadding;
OTPWidget({ OTPWidget({
Key? key, Key? key,
this.maxLength = 4, this.maxLength = 4,
this.controller, this.controller,
@ -58,14 +58,14 @@ class OTPWidget extends StatefulWidget {
this.defaultBorderColor = Colors.black, this.defaultBorderColor = Colors.black,
this.textBorderColor = Colors.black, this.textBorderColor = Colors.black,
this.pinTextAnimatedSwitcherTransition, this.pinTextAnimatedSwitcherTransition,
this.pinTextAnimatedSwitcherDuration= const Duration(), this.pinTextAnimatedSwitcherDuration = const Duration(),
this.hasError= false, this.hasError = false,
this.errorBorderColor= Colors.red, this.errorBorderColor = Colors.red,
this.onTextChanged, this.onTextChanged,
this.autoFocus= false, this.autoFocus = false,
this.focusNode, this.focusNode,
this.textDirection= TextDirection.ltr, this.textDirection = TextDirection.ltr,
this.keyboardType= TextInputType.number, this.keyboardType = TextInputType.number,
this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0), this.pinBoxOuterPadding = const EdgeInsets.symmetric(horizontal: 4.0),
this.pinBoxColor = Colors.white, this.pinBoxColor = Colors.white,
this.pinBoxBorderWidth = 2.0, this.pinBoxBorderWidth = 2.0,
@ -80,7 +80,7 @@ class OTPWidget extends StatefulWidget {
} }
class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixin { class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixin {
late AnimationController _highlightAnimationController; late AnimationController _highlightAnimationController;
late FocusNode focusNode; late FocusNode focusNode;
String text = ""; String text = "";
int currentIndex = 0; int currentIndex = 0;
@ -121,11 +121,11 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
void initState() { void initState() {
super.initState(); super.initState();
focusNode = widget.focusNode ?? FocusNode(); focusNode = widget.focusNode ?? FocusNode();
_highlightAnimationController = AnimationController(vsync: this);
_initTextController(); _initTextController();
_calculateStrList(); _calculateStrList();
widget.controller?.addListener(_controllerListener); widget.controller!.addListener(_controllerListener);
focusNode?.addListener(_focusListener); focusNode.addListener(_focusListener);
} }
void _controllerListener() { void _controllerListener() {
@ -182,11 +182,11 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
@override @override
void dispose() { void dispose() {
if (widget.focusNode == null) { if (widget.focusNode == null) {
focusNode?.dispose(); focusNode.dispose();
} else { } else {
focusNode?.removeListener(_focusListener); focusNode.removeListener(_focusListener);
} }
_highlightAnimationController?.dispose(); _highlightAnimationController.dispose();
widget.controller?.removeListener(_controllerListener); widget.controller?.removeListener(_controllerListener);
super.dispose(); super.dispose();
@ -295,7 +295,11 @@ class OTPWidgetState extends State<OTPWidget> with SingleTickerProviderStateMixi
List<Widget> pinCodes = List.generate(widget.maxLength, (int i) { List<Widget> pinCodes = List.generate(widget.maxLength, (int i) {
return _buildPinCode(i, context); return _buildPinCode(i, context);
}); });
return Row(children: pinCodes, mainAxisSize: MainAxisSize.min,mainAxisAlignment: MainAxisAlignment.spaceBetween,); return Row(
children: pinCodes,
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
);
} }
Widget _buildPinCode(int i, BuildContext context) { Widget _buildPinCode(int i, BuildContext context) {

Loading…
Cancel
Save