update in progress

merge-update-with-lab-changes
Sultan khan 2 years ago
parent 49d3df8c87
commit 40656a65d8

@ -1,10 +1,10 @@
import 'PointsAmountPerMonth.dart';
class PointsAmountPerYear {
num? amountPerYear;
int? amountPerYear;
List<PointsAmountPerMonth>? pointsAmountPerMonth;
num? pointsPerYear;
num? year;
int? pointsPerYear;
int? year;
PointsAmountPerYear(
{this.amountPerYear,

@ -27,8 +27,9 @@ import 'package:diplomaticquarterapp/widgets/new_design/doctor_header.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'widgets/AppointmentActions.dart';
@ -37,22 +38,22 @@ class AppointmentDetails extends StatefulWidget {
static bool isLoading = false;
dynamic doctorSchedule;
static bool showFooterButton = false;
final int parentIndex;
final int? parentIndex;
AppointmentDetails({@required this.appo, this.parentIndex, this.doctorSchedule});
AppointmentDetails({required this.appo, this.parentIndex, this.doctorSchedule});
@override
_AppointmentDetailsState createState() => _AppointmentDetailsState();
}
class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTickerProviderStateMixin {
static TabController _tabController;
static TabController? _tabController;
AppSharedPreferences sharedPref = AppSharedPreferences();
List<DoctorRateDetails> doctorDetailsList =[];
ToDoCountProviderModel toDoProvider;
ProjectViewModel projectViewModel;
ToDoCountProviderModel? toDoProvider;
ProjectViewModel? projectViewModel;
DoctorList doctorList = new DoctorList();
@ -75,7 +76,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
@override
void dispose() {
super.dispose();
_tabController.dispose();
_tabController!.dispose();
AppointmentDetails.showFooterButton = false;
}
@ -86,7 +87,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
toDoProvider = Provider.of<ToDoCountProviderModel>(context);
return AppScaffold(
appBarTitle: widget.appo.doctorNameObj,
appBarTitle: widget.appo!.doctorNameObj!,
isShowAppBar: true,
showNewAppBar: true,
backgroundColor: Colors.white,
@ -99,15 +100,15 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
children: <Widget>[
DoctorHeader(
headerModel: HeaderModel(
widget.appo.doctorTitle + " " + widget.appo.doctorNameObj,
widget.appo.doctorID,
widget.appo.doctorImageURL,
widget.appo.doctorSpeciality,
widget.appo.doctorTitle! + " " + widget.appo.doctorNameObj!,
widget.appo.doctorID!,
widget.appo.doctorImageURL!,
widget.appo.doctorSpeciality!,
"",
widget.appo.projectName!,
DateUtil.convertStringToDate(widget.appo.appointmentDate!),
widget.appo.isLiveCareAppointment! ? DateUtil.convertStringToDate(widget.appo.appointmentDate!).toString().split(" ")[1].substring(0, 5) : widget.appo.startTime!.substring(0, 5),
"",
widget.appo.projectName,
DateUtil.convertStringToDate(widget.appo.appointmentDate),
widget.appo.isLiveCareAppointment ? DateUtil.convertStringToDate(widget.appo.appointmentDate).toString().split(" ")[1].substring(0, 5) : widget.appo.startTime.substring(0, 5),
null,
widget.appo.doctorRate,
widget.appo.actualDoctorRate,
widget.appo.noOfPatientsRate,
@ -119,8 +120,8 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
widget.appo.clinicID == 47 ||
widget.appo.clinicID == 23 ||
widget.appo.clinicID == 265 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment)
widget.appo.isExecludeDoctor! ||
widget.appo.isLiveCareAppointment!)
? false
: true,
buttonTitle: TranslationBase.of(context).schedule,
@ -135,8 +136,8 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
),
).then((value) {
setState(() {
if (_tabController.index == 0) {
_tabController.animateTo((_tabController.index + 1) % 2);
if (_tabController!.index == 0) {
_tabController!.animateTo((_tabController!.index + 1) % 2);
this.enableFooterButton();
}
widget.doctorSchedule = value;
@ -156,9 +157,9 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
widget.appo.clinicID == 23 ||
widget.appo.clinicID == 253 ||
widget.appo.clinicID == 265 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment) {
_tabController.index = _tabController.previousIndex;
widget.appo.isExecludeDoctor! ||
widget.appo.isLiveCareAppointment!) {
_tabController!.index = _tabController!.previousIndex;
AppointmentDetails.showFooterButton = false;
} else {
AppointmentDetails.showFooterButton = true;
@ -173,8 +174,8 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
widget.appo.clinicID == 47 ||
widget.appo.clinicID == 265 ||
widget.appo.clinicID == 253 ||
widget.appo.isExecludeDoctor ||
widget.appo.isLiveCareAppointment
widget.appo!.isExecludeDoctor! ||
widget.appo!.isLiveCareAppointment!
? Tab(
child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.grey)),
)
@ -191,8 +192,8 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
AppointmentActions(appo: widget.appo, tabController: _tabController, enableFooterButton: enableFooterButton, projectViewModel: projectViewModel),
DocAvailableAppointments(doctor: getDoctorObject(), doctorSchedule: widget.doctorSchedule, isLiveCareAppointment: widget.appo.isLiveCareAppointment)
AppointmentActions(appo: widget.appo, tabController: _tabController!, enableFooterButton: enableFooterButton, projectViewModel: projectViewModel!),
DocAvailableAppointments(doctor: getDoctorObject(), doctorSchedule: widget.doctorSchedule, isLiveCareAppointment: widget.appo.isLiveCareAppointment!)
],
controller: _tabController,
),
@ -205,10 +206,10 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
Widget _bottomButtons() {
if (widget.parentIndex == null) {
return null;
return SizedBox();
} else {
List<Widget> list = [];
if (widget.parentIndex == 0 && _tabController.index == 0) {
if (widget.parentIndex == 0 && _tabController!.index == 0) {
list.add(
Expanded(
child: DefaultButton(
@ -240,7 +241,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
),
),
);
} else if (widget.parentIndex == 1 && _tabController.index == 0) {
} else if (widget.parentIndex == 1 && _tabController!.index == 0) {
list.add(
Expanded(
child: DefaultButton(
@ -260,7 +261,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
),
),
);
} else if (_tabController.index == 1) {
} else if (_tabController!.index == 1) {
list.add(
Expanded(
child: DefaultButton(
@ -274,7 +275,7 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
);
}
if (list.isEmpty) {
return null;
return SizedBox();
} else
return Container(
color: Colors.white,
@ -306,15 +307,15 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
FadePage(
page: BookConfirm(
doctor: getDoctorObject(),
isLiveCareAppointment: widget.appo.isLiveCareAppointment,
selectedDate: DocAvailableAppointments.selectedDate,
selectedTime: DocAvailableAppointments.selectedTime)));
isLiveCareAppointment: widget.appo.isLiveCareAppointment!,
selectedDate: DocAvailableAppointments.selectedDate!,
selectedTime: DocAvailableAppointments.selectedTime!, initialSlotDuration: 0,)));
}
void getDoctorRatingsDetails() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.getDoctorsRatingDetails(widget.appo.doctorID, context).then((res) {
service.getDoctorsRatingDetails(widget.appo.doctorID!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
doctorDetailsList.clear();
@ -356,20 +357,39 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
margin: EdgeInsets.only(bottom: 5.0),
padding: EdgeInsets.all(10.0),
child: Text(TranslationBase.of(context).doctorRating, style: TextStyle(fontSize: 22.0, color: Colors.black))),
Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))),
Container(margin: EdgeInsets.only(top: 0.0), child: Text(this.widget.appo.actualDoctorRate!.ceilToDouble().toString(), style: TextStyle(fontSize: 32.0, color: Colors.black))),
Container(
margin: EdgeInsets.only(top: 5.0),
alignment: Alignment.center,
child: RatingBar.readOnly(
initialRating: this.widget.appo.actualDoctorRate.toDouble(),
size: 35.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
child:
// RatingBar.readOnly(
// initialRating: this.widget.appo.actualDoctorRate.toDouble(),
// size: 35.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
RatingBar(
initialRating: this.widget.appo.actualDoctorRate!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
),
Container(
margin: EdgeInsets.only(top: 10.0),
@ -514,11 +534,13 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {});
pageBuilder: (context, animation1, animation2) {
return SizedBox();
});
}
double getRatingWidth(int patientNumber) {
var width = (patientNumber / this.widget.appo.noOfPatientsRate) * 100;
var width = (patientNumber / this.widget.appo.noOfPatientsRate!) * 100;
return width;
}
@ -569,12 +591,12 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
confirmAppointment() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.confirmAppointment(widget.appo.appointmentNo, widget.appo.clinicID, widget.appo.projectID, widget.appo.isLiveCareAppointment, context).then((res) {
service.confirmAppointment(widget.appo.appointmentNo!, widget.appo.clinicID!, widget.appo.projectID!, widget.appo.isLiveCareAppointment!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
Navigator.of(context).pop();
projectViewModel.analytics.appointment.appointment_details_confirm(appointment: widget.appo);
projectViewModel!.analytics.appointment.appointment_details_confirm(appointment: widget.appo);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
@ -587,15 +609,15 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
checkIfHasReminder() async {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
DateTime startEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!);
DateTime endEventsDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!);
RetrieveEventsParams params = new RetrieveEventsParams(startDate: startEventsDate, endDate: endEventsDate);
await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id, params).then((value) {
await calendarUtils.retrieveEvents(calendarUtils.calendars[0].id!, params).then((value) {
Result<UnmodifiableListView<Event>> events = value;
events.data.forEach((element) {
if (element.title.contains(widget.appo.doctorNameObj)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element);
events.data!.forEach((element) {
if (element.title!.contains(widget.appo.doctorNameObj!)) calendarUtils.deleteEvent(calendarUtils.calendars[0], element);
});
});
}
@ -611,11 +633,11 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
getToDoCount();
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
Navigator.of(context).pop();
projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo);
projectViewModel!.analytics.appointment.appointment_details_cancel(appointment: widget.appo);
} else {
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
}
projectViewModel.analytics.appointment.appointment_details_cancel(appointment: widget.appo, appointment_type: widget.appo.isLiveCareAppointment ? "livecare" : "regular");
projectViewModel!.analytics.appointment.appointment_details_cancel(appointment: widget.appo, appointment_type: widget.appo!.isLiveCareAppointment! ? "livecare" : "regular");
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
@ -623,11 +645,11 @@ class _AppointmentDetailsState extends State<AppointmentDetails> with SingleTick
}
getToDoCount() {
toDoProvider.setState(0, true, toDoProvider.notificationsCount);
toDoProvider!.setState(0, true, toDoProvider!.notificationsCount);
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
if (res['MessageStatus'] == 1) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
toDoProvider!.setState(res['AppointmentActiveNumber'], true, toDoProvider!.notificationsCount);
} else {}
}).catchError((err) {
print(err);

@ -48,7 +48,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
List<ImagesInfo> imagesInfo =[];
FilterType filterType;
FilterType? filterType;
int _currentPage = 0;
@ -83,7 +83,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
dropdownIndexValue: _currentPage,
dropDownIndexChange: (index) {
setState(() {
_currentPage = index;
_currentPage = index!;
});
},
dropDownList: [
@ -96,10 +96,10 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
child: Column(children: [
Row(
children: [
MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, filterType, () {
MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, filterType!, () {
setFilterType(FilterType.Clinic);
}),
MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, filterType, () {
MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, filterType!, () {
setFilterType(FilterType.Hospital);
}),
],
@ -205,7 +205,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByClinic.length != 0) {
widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
@ -217,7 +217,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByHospital.length != 0) {
widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
@ -231,7 +231,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByClinic.length != 0) {
widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
@ -243,7 +243,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByHospital.length != 0) {
widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
@ -257,7 +257,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByClinic.length != 0) {
widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
@ -269,7 +269,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
.toList();
if (doctorByHospital.length != 0) {
widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
@ -280,7 +280,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
openAppointmentsTab() async {
var flag = await this.sharedPref.getInt(IS_SEARCH_APPO);
int index;
int? index;
if (flag == 1) {
index = 0;
} else if (flag == 2) {
@ -298,7 +298,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
}
}
_currentPage = index;
_currentPage = index!;
}
Widget getBookedAppointments() {
@ -346,7 +346,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
);
},
itemBuilder: (context, index) {
List<AppoitmentAllHistoryResultList> _appointmentAllHistoryResultList = _patientAppointmentList[index].patientDoctorAppointmentList;
List<AppoitmentAllHistoryResultList> _appointmentAllHistoryResultList = _patientAppointmentList[index].patientDoctorAppointmentList!;
return AppExpandableNotifier(
title: _patientAppointmentList[index].filterName,
bodyWidget: ListView.separated(
@ -370,15 +370,15 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
getPatientAppointmentHistory();
}),
isInOutPatient: _appointmentResult.isInOutPatient,
name: _appointmentResult.doctorTitle + " " + _appointmentResult.doctorNameObj,
name: _appointmentResult.doctorTitle! + " " + _appointmentResult.doctorNameObj!,
// billNo: _appointmentResult.invoiceNo,
profileUrl: _appointmentResult.doctorImageURL,
subName: _isSortByClinic ? _appointmentResult.projectName : _appointmentResult.clinicName,
isLiveCareAppointment: _appointmentResult.isLiveCareAppointment,
date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate),
date: DateUtil.convertStringToDate(_appointmentResult.appointmentDate!),
isSortByClinic: _isSortByClinic,
rating: _appointmentResult.actualDoctorRate + 0.0,
appointmentTime: _appointmentResult.isLiveCareAppointment ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime.substring(0, 5),
rating: _appointmentResult.actualDoctorRate! + 0.0,
appointmentTime: _appointmentResult.isLiveCareAppointment! ? DateUtil.convertStringToDate(_appointmentResult.appointmentDate!).toString().split(" ")[1].substring(0, 5) : _appointmentResult.startTime!.substring(0, 5),
// appointmentTime: _appointmentResult.startTime.substring(0, 5),
remainingTimeInMinutes: (_appointmentResult.patientStatusType == AppointmentType.BOOKED || _appointmentResult.patientStatusType == AppointmentType.CONFIRMED)
? _appointmentResult.remaniningHoursTocanPay
@ -428,7 +428,7 @@ class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProvid
groupValue: _currentPage,
onChanged: (index) {
setState(() {
_currentPage = index;
_currentPage = index!;
});
//_pageController.animateToPage(index, duration: Duration(milliseconds: 250), curve: Curves.easeInOut);
},

@ -17,8 +17,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class SchedulePage extends StatefulWidget {
DoctorList doctorList;
AppoitmentAllHistoryResultList appo;
DoctorList? doctorList;
AppoitmentAllHistoryResultList? appo;
SchedulePage({
this.appo,
@ -30,14 +30,14 @@ class SchedulePage extends StatefulWidget {
}
class _SchedulePageState extends State<SchedulePage> {
DoctorsListService service;
DoctorsListService? service;
PageController _pageController = PageController();
double currentPage = 0;
int selectedindex = 0;
List weeks = [];
List<DoctorScheduleResponse> doctorScheduleResponse = [];
int weekMS = 604800 * 1000;
DoctorList doctorList;
DoctorList? doctorList;
List<String> freeSlots = [];
bool isPageChange = false;
@ -54,10 +54,10 @@ class _SchedulePageState extends State<SchedulePage> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<MedicalViewModel>(
onModelReady: (model) => model.getDoctorSchedule(doctorList),
onModelReady: (model) => model.getDoctorSchedule(doctorList!),
allowAny: true,
builder: (_, model, widget) => BaseView<MedicalViewModel>(
onModelReady: (model2) => model2.getFreeSlots(doctorList),
onModelReady: (model2) => model2.getFreeSlots(doctorList!),
allowAny: true,
builder: (_, model2, widget2) {
if (model2.freeSlots.length > 0 && isPageChange == false && model2.state == ViewState.Idle) {
@ -99,7 +99,7 @@ class _SchedulePageState extends State<SchedulePage> {
onTap: () {
final weekDay = weeks[index][index2]['DayName'];
openBookAppointment(weeks[index][index2]);
projectViewModel.analytics.appointment.book_appointment_date_selection(appointment_type: 'regular', day: weekDay, doctor: doctorList);
projectViewModel.analytics.appointment.book_appointment_date_selection(appointment_type: 'regular', day: weekDay, doctor: doctorList!);
},
child: Row(
children: [
@ -139,7 +139,7 @@ class _SchedulePageState extends State<SchedulePage> {
DateUtil.convertStringToDate(weeks[index][index2]['Date']).toString().substring(0, 10) == DateTime.now().toString().substring(0, 10)
? BoxShadow(color: Colors.green, offset: Offset(projectViewModel.isArabic ? 5 : -5, 0))
: BoxShadow(
color: Colors.grey[100],
color: Colors.grey[100]!,
blurRadius: 5,
spreadRadius: 4,
offset: Offset(0, 10),
@ -206,7 +206,7 @@ class _SchedulePageState extends State<SchedulePage> {
var newWeekSchedule = [];
for (var workDay in this.doctorScheduleResponse) {
Map<String, dynamic> newWorkDay = Map();
newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date).millisecondsSinceEpoch + weekMSOffset);
newWorkDay['Date'] = DateUtil.convertDateMSToJsonDate(DateUtil.convertStringToDate(workDay.date!).millisecondsSinceEpoch + weekMSOffset);
newWorkDay['DayName'] = workDay.dayName;
newWorkDay['WorkingHours'] = workDay.workingHours;
newWeekSchedule.add(newWorkDay);

@ -1,24 +1,24 @@
class AskDocRequestType {
String setupID;
int parameterGroup;
int parameterType;
int parameterCode;
String description;
String descriptionN;
String alias;
String aliasN;
String prefix;
String suffix;
String isColorCodingRequired;
String backColor;
String foreColor;
bool isBuiltIn;
bool isActive;
int createdBy;
String createdOn;
String editedBy;
String editedOn;
String rowVer;
String? setupID;
int? parameterGroup;
int? parameterType;
int? parameterCode;
String? description;
String? descriptionN;
String? alias;
String? aliasN;
String? prefix;
String? suffix;
String? isColorCodingRequired;
String? backColor;
String? foreColor;
bool? isBuiltIn;
bool? isActive;
int? createdBy;
String? createdOn;
String? editedBy;
String? editedOn;
String? rowVer;
AskDocRequestType(
{this.setupID,

@ -1,9 +1,9 @@
class DoctorScheduleResponse {
String clinicName;
String date;
String dayName;
String projectName;
String workingHours;
String? clinicName;
String? date;
String? dayName;
String? projectName;
String? workingHours;
DoctorScheduleResponse(
{this.clinicName,

@ -43,10 +43,10 @@ class AppointmentActions extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
TabController tabController;
final Function enableFooterButton;
MyInAppBrowser browser;
final ProjectViewModel projectViewModel;
MyInAppBrowser? browser;
final ProjectViewModel? projectViewModel;
AppointmentActions({@required this.appo, @required this.tabController, @required this.enableFooterButton, this.projectViewModel});
AppointmentActions({required this.appo, required this.tabController, required this.enableFooterButton, this.projectViewModel});
@override
_AppointmentActionsState createState() => _AppointmentActionsState();
@ -73,7 +73,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
shrinkWrap: true,
itemBuilder: (context, index) {
// bool shouldEnable = ((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc") || appoButtonsList[index].caller == "openReschedule");
bool shouldEnable = (((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) && appoButtonsList[index].caller == "openReschedule") || (widget.appo.isLiveCareAppointment && appoButtonsList[index].caller == "askDoc"));
bool shouldEnable = (((widget.appo.clinicID == 17 || widget.appo.clinicID == 47) && appoButtonsList[index].caller == "openReschedule") || (widget.appo.isLiveCareAppointment! && appoButtonsList[index].caller == "askDoc"));
return InkWell(
onTap: shouldEnable
? null
@ -81,9 +81,9 @@ class _AppointmentActionsState extends State<AppointmentActions> {
_handleButtonClicks(appoButtonsList[index], model);
},
child: MedicalProfileItem(
title: appoButtonsList[index].title,
imagePath: appoButtonsList[index].icon,
subTitle: appoButtonsList[index].subtitle,
title: appoButtonsList[index].title!,
imagePath: appoButtonsList[index].icon!,
subTitle: appoButtonsList[index].subtitle!,
hasBadge: true,
isEnable: !shouldEnable,
imgColor: Color(0xff28323A),
@ -104,7 +104,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'reschedule appointment');
break;
case "navigateToProject":
openMap(double.parse(widget.appo.latitude), double.parse(widget.appo.longitude));
openMap(double.parse(widget.appo.latitude!), double.parse(widget.appo.longitude!));
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'hospital location');
break;
case "addReminder":
@ -112,14 +112,14 @@ class _AppointmentActionsState extends State<AppointmentActions> {
showReminderDialog(
context,
new DateFormat("dd MMM yyyy hh:mm")
.parse(DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate), widget.projectViewModel.isArabic) + " " + widget.appo.startTime),
.parse(DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate!), widget.projectViewModel!.isArabic) + " " + widget.appo.startTime!),
//DateUtil.convertStringToDate(widget.appo.appointmentDate),
widget.appo.doctorNameObj,
widget.appo.doctorNameObj!,
"",
DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate), widget.projectViewModel.isArabic),
DateUtil.formatDateToDate(DateUtil.convertStringToDate(widget.appo.appointmentDate!), widget.projectViewModel!.isArabic),
// DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.appo.appointmentDate)),
widget.appo.startTime,
widget.appo.startTime!,
onSuccess: () {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
},
@ -152,12 +152,12 @@ class _AppointmentActionsState extends State<AppointmentActions> {
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'survey');
break;
case "Insurance":
navigateToInsuranceApprovals(widget.appo.appointmentNo);
navigateToInsuranceApprovals(widget.appo.appointmentNo!);
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'insurance');
break;
case "VitalSigns":
navigateToVitalSigns(widget.appo.appointmentNo, widget.appo.projectID);
navigateToVitalSigns(widget.appo.appointmentNo!, widget.appo.projectID!);
locator<GAnalytics>().appointment.appointment_detail_action(appointment: widget.appo, action: 'vital sign');
break;
@ -171,7 +171,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
_getAppointmentActionButtons() {
if (widget.appo != null) {
if (isConfirmed()) {
if (widget.appo.isOnlineCheckedIN) {
if (widget.appo.isOnlineCheckedIN!) {
_getConfirmedCheckInAppoActionsList();
} else {
_getConfirmedAppoActionsList();
@ -180,7 +180,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
print("isConfirmed Null");
}
if (isBooked()) {
if (widget.appo.isOnlineCheckedIN) {
if (widget.appo.isOnlineCheckedIN!) {
_getBookedCheckInAppoActionsList();
} else {
_getBookedAppoActionsList();
@ -211,14 +211,14 @@ class _AppointmentActionsState extends State<AppointmentActions> {
}
bool isCheckedIn() {
return widget.appo.isOnlineCheckedIN;
return widget.appo.isOnlineCheckedIN!;
}
bool isBooked() {
return AppointmentType.isBooked(widget.appo);
}
Future<List<AppoDetailsButton>> _getBookedAppoActionsList() async {
Future<List<AppoDetailsButton>?>? _getBookedAppoActionsList() async {
print("_getBookedAppoActionsList");
BookedButtons bookedButtons = new BookedButtons();
print(bookedButtons.buttons);
@ -236,7 +236,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
});
}
Future<List<AppoDetailsButton>> _getBookedCheckInAppoActionsList() async {
Future<List<AppoDetailsButton>?>? _getBookedCheckInAppoActionsList() async {
print("_getBookedCheckInAppoActionsList");
BookedButtonsAllowCheckIn bookedButtonsAllowCheckIn = new BookedButtonsAllowCheckIn();
print(bookedButtonsAllowCheckIn.buttons);
@ -254,7 +254,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
});
}
Future<List<AppoDetailsButton>> _getConfirmedAppoActionsList() async {
Future<List<AppoDetailsButton>?> _getConfirmedAppoActionsList() async {
print("_getConfirmedAppoActionsList");
ConfirmedButtons confirmedButtons = new ConfirmedButtons();
print(confirmedButtons.buttons);
@ -272,7 +272,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
});
}
Future<List<AppoDetailsButton>> _getConfirmedCheckInAppoActionsList() async {
Future<List<AppoDetailsButton>?> _getConfirmedCheckInAppoActionsList() async {
print("_getConfirmedAllowCheckInAppoActionsList");
ConfirmedButtonsAllowCheckIn confirmedButtonsAllowCheckIn = new ConfirmedButtonsAllowCheckIn();
print(confirmedButtonsAllowCheckIn.buttons);
@ -290,7 +290,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
});
}
Future<List<AppoDetailsButton>> _getArrivedAppoActionsList() async {
Future<List<AppoDetailsButton>?> _getArrivedAppoActionsList() async {
print("_getArrivedAppoActionsList");
ArrivedButtons arrivedButtons = new ArrivedButtons();
print(arrivedButtons.buttons);
@ -308,7 +308,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
});
}
Future<List<AppoDetailsButton>> _getArrivedInvoiceAppoActionsList() async {
Future<List<AppoDetailsButton>?> _getArrivedInvoiceAppoActionsList() async {
print("_getArrivedInvoiceAppoActionsList");
ArrivedButtons arrivedButtons = new ArrivedButtons();
List<AppoDetailsButton> buttonsList = [];
@ -375,7 +375,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
patientLabOrders.doctorImageURL = widget.appo.doctorImageURL;
patientLabOrders.speciality = widget.appo.doctorSpeciality;
patientLabOrders.projectName = widget.appo.projectName;
patientLabOrders.orderDate = DateUtil.convertStringToDate(widget.appo.appointmentDate);
patientLabOrders.orderDate = DateUtil.convertStringToDate(widget.appo.appointmentDate!);
patientLabOrders.doctorRate = widget.appo.doctorRate;
patientLabOrders.actualDoctorRate = widget.appo.actualDoctorRate;
patientLabOrders.noOfPatientsRate = widget.appo.noOfPatientsRate;
@ -461,7 +461,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
askYourDoc() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.isAllowedToAskDoctor(widget.appo.doctorID, context).then((res) {
service.isAllowedToAskDoctor(widget.appo.doctorID!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
print(res['PatientDoctorAppointmentResultList']);
if (res['PatientDoctorAppointmentResultList'].length != 0) {
@ -481,7 +481,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
DoctorsListService service = new DoctorsListService();
service.getCallRequestType(context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
List<AskDocRequestType> requestData = new List<AskDocRequestType>();
List<AskDocRequestType> requestData = [];
res['ListReqTypes'].forEach((element) {
requestData.add(new AskDocRequestType.fromJson(element));
});
@ -511,12 +511,12 @@ class _AppointmentActionsState extends State<AppointmentActions> {
barrierDismissible: true,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {})
pageBuilder: (context, animation1, animation2) =>SizedBox())
.then((value) {
print("Dialog Closed");
print(value);
if (value != null) {
sendAskDocRequest(value);
sendAskDocRequest(value as int);
}
});
}
@ -581,7 +581,7 @@ class _AppointmentActionsState extends State<AppointmentActions> {
}
navigateToToDoPage(BuildContext context, ToDoCountProviderModel model) {
if (widget.projectViewModel.isLogin) {
if (widget.projectViewModel!.isLogin) {
if (model.count != 0) {
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true)));
} else {

@ -9,8 +9,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_countdown_timer/countdown_timer_controller.dart';
import 'package:flutter_countdown_timer/current_remaining_time.dart';
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../AppointmentDetails.dart';
@ -19,14 +19,14 @@ class AppointmentCard extends StatefulWidget {
final Function onReloadAppointmentHistory;
AppointmentCard(
{@required this.appo, @required this.onReloadAppointmentHistory});
{required this.appo, required this.onReloadAppointmentHistory});
@override
_ApointmentCardState createState() => _ApointmentCardState();
}
class _ApointmentCardState extends State<AppointmentCard> {
CountdownTimerController controller;
CountdownTimerController? controller;
@override
void initState() {
@ -62,9 +62,9 @@ class _ApointmentCardState extends State<AppointmentCard> {
height: projectViewModel.isArabic ? 165 : 140,
decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545)
color: widget.appo.isLiveCareAppointment
color: widget.appo.isLiveCareAppointment!
? Color(0xff404545)
: !widget.appo.isInOutPatient
: !widget.appo.isInOutPatient!
? Colors.red[900]
: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
@ -86,9 +86,9 @@ class _ApointmentCardState extends State<AppointmentCard> {
quarterTurns: 3,
child: Center(
child: Text(
widget.appo.isLiveCareAppointment
widget.appo.isLiveCareAppointment!
? TranslationBase.of(context).liveCare.toUpperCase()
: !widget.appo.isInOutPatient
: !widget.appo.isInOutPatient!
? TranslationBase.of(context)
.inPatient
.toUpperCase()
@ -104,7 +104,7 @@ class _ApointmentCardState extends State<AppointmentCard> {
),
ClipRRect(
borderRadius: BorderRadius.circular(100.0),
child: Image.network(widget.appo.doctorImageURL,
child: Image.network(widget.appo.doctorImageURL!,
fit: BoxFit.fill, height: 60.0, width: 60.0),
),
Expanded(
@ -115,16 +115,16 @@ class _ApointmentCardState extends State<AppointmentCard> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.appo.doctorTitle +
widget.appo.doctorTitle! +
" " +
widget.appo.doctorNameObj,
widget.appo.doctorNameObj!,
style: TextStyle(
fontSize: 14.0,
color: Colors.grey[700],
letterSpacing: 1.0)),
Container(
margin: EdgeInsets.only(top: 3.0),
child: Text(widget.appo.clinicName,
child: Text(widget.appo.clinicName!,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
@ -132,7 +132,7 @@ class _ApointmentCardState extends State<AppointmentCard> {
),
Container(
margin: EdgeInsets.only(top: 3.0),
child: Text(widget.appo.projectName,
child: Text(widget.appo.projectName!,
style: TextStyle(
fontSize: 12.0,
color: Colors.grey[600],
@ -143,7 +143,7 @@ class _ApointmentCardState extends State<AppointmentCard> {
child: Text(
DateUtil.getWeekDayMonthDayYearDateFormatted(
DateUtil.convertStringToDate(
widget.appo.appointmentDate),
widget.appo.appointmentDate!),
projectViewModel.isArabic ? "ar" : "en")
.trim(),
style: TextStyle(
@ -155,16 +155,34 @@ class _ApointmentCardState extends State<AppointmentCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
RatingBar.readOnly(
initialRating:
widget.appo.actualDoctorRate.toDouble(),
size: 20.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
// RatingBar.readOnly(
// initialRating:
// widget.appo.actualDoctorRate.toDouble(),
// size: 20.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
RatingBar(
initialRating: widget.appo.actualDoctorRate!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
),
Container(
transform:
@ -190,10 +208,10 @@ class _ApointmentCardState extends State<AppointmentCard> {
controller: new CountdownTimerController(
endTime: DateTime.now()
.millisecondsSinceEpoch +
(widget.appo.remaniningHoursTocanPay *
(widget.appo.remaniningHoursTocanPay! *
1000) *
60),
widgetBuilder: (_, CurrentRemainingTime time) {
widgetBuilder: (_, CurrentRemainingTime? time) {
return time != null
? Text(
'${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours : "0"}:${time.min}:${time.sec} ' +

@ -17,9 +17,9 @@ class PrescriptionReportPage extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
PrescriptionReportPage(
{@required this.prescriptionReportEnhList,
@required this.listPres,
@required this.appo});
{required this.prescriptionReportEnhList,
required this.listPres,
required this.appo});
@override
_PrescriptionReportState createState() => _PrescriptionReportState();
@ -53,14 +53,14 @@ class _PrescriptionReportState extends State<PrescriptionReportPage> {
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
border: Border.all(color: Colors.grey[200]!, width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
widget.prescriptionReportEnhList[index].imageSRCUrl,
widget.prescriptionReportEnhList[index]!.imageSRCUrl!,
fit: BoxFit.cover,
width: 60,
height: 70,
@ -117,7 +117,7 @@ class _PrescriptionReportState extends State<PrescriptionReportPage> {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service
.sendPrescriptionEmail(widget.appo.appointmentDate, widget.appo.setupID,
.sendPrescriptionEmail(widget.appo.appointmentDate!, widget.appo.setupID!,
widget.listPres, context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);

@ -12,7 +12,7 @@ class AskDocDialog extends StatefulWidget {
static int selectedParameterCode = 0;
AskDocDialog({@required this.requestData});
AskDocDialog({required this.requestData});
@override
_AskDocDialogState createState() => _AskDocDialogState();

@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
class CustomRadio extends StatefulWidget {
List<AskDocRequestType> requestData;
List<AskDocRequestType>? requestData;
CustomRadio({this.requestData});
@ -17,7 +17,7 @@ class CustomRadio extends StatefulWidget {
}
class CustomRadioState extends State<CustomRadio> {
List<RadioModel> sampleData = new List<RadioModel>();
List<RadioModel>? sampleData = [];
@override
void initState() {
@ -25,14 +25,14 @@ class CustomRadioState extends State<CustomRadio> {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (widget.requestData != null) {
widget.requestData.forEach((element) {
sampleData.add(new RadioModel(false, element.description, element.parameterCode));
widget.requestData!.forEach((element) {
sampleData!.add(new RadioModel(false, element.description!, element.parameterCode!));
});
} else {
sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder30, 30));
sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder60, 60));
sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder90, 90));
sampleData.add(new RadioModel(false, TranslationBase.of(context).appoReminder120, 120));
sampleData!.add(new RadioModel(false, TranslationBase.of(context).appoReminder30, 30));
sampleData!.add(new RadioModel(false, TranslationBase.of(context).appoReminder60, 60));
sampleData!.add(new RadioModel(false, TranslationBase.of(context).appoReminder90, 90));
sampleData!.add(new RadioModel(false, TranslationBase.of(context).appoReminder120, 120));
}
});
}
@ -43,24 +43,24 @@ class CustomRadioState extends State<CustomRadio> {
children: <Widget>[
ListView.builder(
shrinkWrap: true,
itemCount: sampleData.length,
itemCount: sampleData!.length,
itemBuilder: (BuildContext context, int index) {
return new InkWell(
//highlightColor: Colors.red,
splashColor: Colors.transparent,
onTap: () {
setState(() {
sampleData.forEach((element) => element.isSelected = false);
sampleData[index].isSelected = true;
sampleData!.forEach((element) => element.isSelected = false);
sampleData![index].isSelected = true;
if (widget.requestData != null) {
AskDocDialog.selectedParameterCode = sampleData[index].duration;
AskDocDialog.selectedParameterCode = sampleData![index].duration;
} else {
ReminderDialog.selectedDuration = sampleData[index].duration * 60000;
PrescriptionReminderDialog.selectedDuration = sampleData[index].duration * 60000;
ReminderDialog.selectedDuration = sampleData![index].duration * 60000;
PrescriptionReminderDialog.selectedDuration = sampleData![index].duration * 60000;
}
});
},
child: new RadioItem(sampleData[index]),
child: new RadioItem(sampleData![index]),
);
},
),

@ -5,9 +5,9 @@ class PageViewIndicator extends StatelessWidget {
final int length;
final double currentPage;
PageViewIndicator({
@required this.isActive,
@required this.length,
@required this.currentPage,
required this.isActive,
required this.length,
required this.currentPage,
});
@override

@ -17,7 +17,7 @@ class ReminderDialog extends StatefulWidget {
final String endDate;
final String location;
ReminderDialog({@required this.eventId, @required this.title, @required this.description, @required this.startDate, @required this.endDate, @required this.location});
ReminderDialog({required this.eventId, required this.title, required this.description, required this.startDate, required this.endDate, required this.location});
@override
_ReminderDialogState createState() => _ReminderDialogState();
@ -76,10 +76,10 @@ class _ReminderDialogState extends State<ReminderDialog> {
createCalendarEvent() {
_myPlugin.hasPermissions().then((value) {
if (!value) {
if (!value!) {
_myPlugin.requestPermissions();
} else {
_myPlugin.getCalendars().then((value) => {print(value.length)});
_myPlugin.getCalendars().then((value) => {print(value!.length)});
}
});
@ -97,7 +97,7 @@ class _ReminderDialogState extends State<ReminderDialog> {
_myPlugin.createEvent(calendarId: "207749556", event: calendarEvent).then((value) {
print("Cal event");
print(value);
if (int.parse(value) == int.parse(widget.eventId)) {
if (int.parse(value!) == int.parse(widget.eventId)) {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
}
Navigator.of(context).pop();

@ -20,13 +20,13 @@ class PrescriptionReminderDialog extends StatefulWidget {
List<DateTime> _scheduleList =[];
PrescriptionReminderDialog({
@required this.eventId,
@required this.title,
@required this.description,
@required this.startDate,
@required this.endDate,
@required this.location,
@required this.days,
required this.eventId,
required this.title,
required this.description,
required this.startDate,
required this.endDate,
required this.location,
required this.days,
});
@override

@ -26,27 +26,27 @@ import 'package:syncfusion_flutter_calendar/calendar.dart';
class ObGyneTimeSlots extends StatefulWidget {
int projectID;
static bool areSlotsAvailable = false;
static DateTime selectedAppoDateTime;
static String selectedDate;
static String selectedTime;
static late DateTime selectedAppoDateTime;
static late String selectedDate;
static late String selectedTime;
int selectedClinicID;
int selectedDoctorID;
late int? selectedClinicID;
late int? selectedDoctorID;
OBGyneProcedureListResponse obGyneProcedureListResponse;
late OBGyneProcedureListResponse? obGyneProcedureListResponse;
var language;
ObGyneTimeSlots({@required this.projectID, this.selectedClinicID, this.selectedDoctorID, this.obGyneProcedureListResponse});
ObGyneTimeSlots({required this.projectID, this.selectedClinicID, this.selectedDoctorID, this.obGyneProcedureListResponse});
@override
_CovidTimeSlotsState createState() => _CovidTimeSlotsState();
}
class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderStateMixin {
Map<DateTime, List> _events;
AnimationController _animationController;
CalendarController _calendarController;
Map<DateTime, List>? _events;
AnimationController? _animationController;
CalendarController? _calendarController;
AppSharedPreferences sharedPref = new AppSharedPreferences();
@ -61,10 +61,10 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
dynamic freeSlotsResponse;
ScrollController _scrollController;
ScrollController? _scrollController;
ToDoCountProviderModel toDoProvider;
ProjectViewModel projectViewModel;
ToDoCountProviderModel? toDoProvider;
ProjectViewModel? projectViewModel;
@override
void initState() {
@ -84,14 +84,14 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
duration: const Duration(milliseconds: 50),
);
_animationController.forward();
_animationController!.forward();
super.initState();
}
@override
void dispose() {
_animationController.dispose();
_calendarController.dispose();
_animationController!.dispose();
_calendarController!.dispose();
super.dispose();
}
@ -101,7 +101,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
this.selectedDate = DateUtil.getWeekDayMonthDayYearDateFormatted(day, projectViewModel.isArabic ? "ar" : "en");
openTimeSlotsPickerForDate(day, docFreeSlots);
ObGyneTimeSlots.selectedDate = formatter.format(day);
_calendarController.selectedDate = day;
_calendarController!.selectedDate = day;
print(ObGyneTimeSlots.selectedDate);
});
}
@ -142,7 +142,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
mHeight(12),
Container(
decoration: cardRadius(12),
child: _buildTableCalendarWithBuilders(projectViewModel),
child: _buildTableCalendarWithBuilders(projectViewModel!),
),
mHeight(12),
Text(
@ -209,8 +209,8 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
height: 45.0,
child: CustomTextButton(
backgroundColor: CustomColors.green,
disabledForegroundColor: Colors.grey[500].withOpacity(0.38),
disabledBackgroundColor: Colors.grey[500].withOpacity(0.12),
disabledForegroundColor: Colors.grey[500]!.withOpacity(0.38),
disabledBackgroundColor: Colors.grey[500]!.withOpacity(0.12),
elevation: 0,
onPressed: () {
bookCovidTestAppointment();
@ -242,15 +242,15 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
dataSource: MeetingDataSource(_getDataSource()),
monthViewSettings: const MonthViewSettings(appointmentDisplayMode: MonthAppointmentDisplayMode.indicator, showTrailingAndLeadingDates: false, appointmentDisplayCount: 1),
onTap: (CalendarTapDetails details) {
_calendarController.selectedDate = details.date;
_onDaySelected(details.date, projectViewModel);
_calendarController!.selectedDate = details.date;
_onDaySelected(details.date!, projectViewModel);
},
);
}
List<Meeting> _getDataSource() {
final List<Meeting> meetings = <Meeting>[];
_events.forEach((key, value) {
_events!.forEach((key, value) {
final DateTime startTime = DateTime(key.year, key.month, key.day, 9, 0, 0);
final DateTime endTime = startTime.add(const Duration(minutes: 20));
meetings.add(Meeting("", startTime, endTime, CustomColors.green, false));
@ -270,7 +270,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
if (dayEvents.length != 0) {
ObGyneTimeSlots.areSlotsAvailable = true;
selectedButtonIndex = 0;
ObGyneTimeSlots.selectedTime = dayEvents[selectedButtonIndex].isoTime;
ObGyneTimeSlots.selectedTime = dayEvents![selectedButtonIndex]!.isoTime!;
} else
ObGyneTimeSlots.areSlotsAvailable = false;
});
@ -294,7 +294,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
selectedDateJSON = freeSlotsResponse[0];
});
openTimeSlotsPickerForDate(DateUtil.convertStringToDate(selectedDateJSON), docFreeSlots);
_calendarController.selectedDate = DateUtil.convertStringToDate(selectedDateJSON);
_calendarController!.selectedDate = DateUtil.convertStringToDate(selectedDateJSON);
return _eventsParsed;
}
@ -305,11 +305,11 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
onPressed: () {
setState(() {
selectedButtonIndex = index;
ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime;
ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime!;
print(ObGyneTimeSlots.selectedTime);
});
},
child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Color(0xFF60686b))),
child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Color(0xFF60686b))),
);
}
@ -320,11 +320,11 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
onPressed: () {
setState(() {
selectedButtonIndex = index;
ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime;
ObGyneTimeSlots.selectedTime = dayEvents[index].isoTime!;
print(ObGyneTimeSlots.selectedTime);
});
},
child: Text(dayEvents[index].isoTime, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Colors.white)),
child: Text(dayEvents[index].isoTime!, style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.bold, color: Colors.white)),
);
}
@ -353,7 +353,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
AppoitmentAllHistoryResultList appo;
service
.insertAppointment(
docObject.doctorID, docObject.clinicID, docObject.projectID, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, context, widget.obGyneProcedureListResponse.procedureId)
docObject.doctorID!, docObject.clinicID!, docObject.projectID!, ObGyneTimeSlots.selectedTime, ObGyneTimeSlots.selectedDate, 0, context, widget.obGyneProcedureListResponse!.procedureId!)
.then((res) {
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: TranslationBase.of(context).bookedSuccess);
@ -393,8 +393,8 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
updateObGyneAppointment(String appoNo) {
DoctorsListService service = new DoctorsListService();
service
.updateObGyneAppointment(widget.obGyneProcedureListResponse.episodeID, int.parse(appoNo), widget.obGyneProcedureListResponse.orderNo, widget.obGyneProcedureListResponse.procedureId,
widget.obGyneProcedureListResponse.lineItemNo, widget.obGyneProcedureListResponse.uniqueRowID)
.updateObGyneAppointment(widget.obGyneProcedureListResponse!.episodeID!, int.parse(appoNo), widget.obGyneProcedureListResponse!.orderNo!, widget.obGyneProcedureListResponse!.procedureId!,
widget.obGyneProcedureListResponse!.lineItemNo!, widget.obGyneProcedureListResponse!.uniqueRowID!)
.then((res) {})
.catchError((err) {
print(err);
@ -402,13 +402,13 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
}
getToDoCount() {
toDoProvider.setState(0, true, toDoProvider.notificationsCount);
toDoProvider!.setState(0, true, toDoProvider!.notificationsCount!);
ClinicListService service = new ClinicListService();
service.getActiveAppointmentNo(context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
print(res['AppointmentActiveNumber']);
if (res['MessageStatus'] == 1) {
toDoProvider.setState(res['AppointmentActiveNumber'], true, toDoProvider.notificationsCount);
toDoProvider!.setState(res['AppointmentActiveNumber'], true, toDoProvider!.notificationsCount);
} else {}
Navigator.pushAndRemoveUntil(
context,
@ -465,7 +465,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
getCovidFreeSlots(BuildContext context, int projectID) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.getDoctorFreeSlots(widget.selectedDoctorID, widget.selectedClinicID, widget.projectID, context).then((res) {
service.getDoctorFreeSlots(widget.selectedDoctorID!, widget.selectedClinicID!, widget.projectID, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
if (res['FreeTimeSlots'].length != 0) {
@ -473,7 +473,7 @@ class _CovidTimeSlotsState extends State<ObGyneTimeSlots> with TickerProviderSta
freeSlotsResponse = res['FreeTimeSlots'];
_getJSONSlots().then((value) => {
setState(() => {
_events.clear(),
_events!.clear(),
_events = value,
// if (widget.doctorSchedule != null)
// {_onDaySelected(DateUtil.convertStringToDate(widget.doctorSchedule['Date'])), _calendarController.selectedDate = DateUtil.convertStringToDate(widget.doctorSchedule['Date'])}
@ -499,36 +499,36 @@ class MeetingDataSource extends CalendarDataSource {
@override
DateTime getStartTime(int index) {
return _getMeetingData(index).from;
return _getMeetingData(index)!.from!;
}
@override
DateTime getEndTime(int index) {
return _getMeetingData(index).to;
return _getMeetingData(index)!.to!;
}
@override
String getSubject(int index) {
return _getMeetingData(index).eventName;
return _getMeetingData(index)!.eventName;
}
@override
Color getColor(int index) {
return _getMeetingData(index).background;
return _getMeetingData(index)!.background;
}
@override
bool isAllDay(int index) {
return _getMeetingData(index).isAllDay;
return _getMeetingData(index)!.isAllDay;
}
Meeting _getMeetingData(int index) {
final dynamic meeting = appointments[index];
Meeting meetingData;
Meeting? _getMeetingData(int index) {
final dynamic meeting = appointments![index];
Meeting? meetingData;
if (meeting is Meeting) {
meetingData = meeting;
}
return meetingData;
return meetingData!;
}
}

@ -41,22 +41,22 @@ import 'package:flutter_countdown_timer/countdown_timer_controller.dart';
import 'package:flutter_countdown_timer/current_remaining_time.dart';
import 'package:flutter_countdown_timer/flutter_countdown_timer.dart';
import 'package:flutter_nfc_kit/flutter_nfc_kit.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class ToDo extends StatefulWidget {
PatientShareResponse patientShareResponse;
late PatientShareResponse patientShareResponse;
List<AppoitmentAllHistoryResultList> appoList = [];
List<AncillaryOrdersListModel> ancillaryLists = [];
List<OBGyneProcedureListResponse> obGyneAppoList = [];
var languageID;
MyInAppBrowser browser;
late var languageID;
late MyInAppBrowser browser;
bool isShowAppBar = true;
Function onBackClick;
Function? onBackClick;
ToDo({@required this.isShowAppBar, this.onBackClick});
ToDo({required this.isShowAppBar, this.onBackClick});
@override
_ToDoState createState() => _ToDoState();
@ -66,16 +66,16 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
AppSharedPreferences sharedPref = AppSharedPreferences();
List<ImagesInfo> imagesInfo =[];
ToDoCountProviderModel toDoProvider;
CountdownTimerController controller;
late ToDoCountProviderModel toDoProvider;
late CountdownTimerController controller;
ProjectViewModel projectViewModel;
TabController _tabController;
late ProjectViewModel projectViewModel;
late TabController _tabController;
String selectedPaymentMethod = "";
String selectedInstallments = "";
String tamaraPaymentStatus;
String tamaraOrderID;
late String tamaraPaymentStatus;
late String tamaraOrderID;
bool dataLoaded = false;
@ -116,7 +116,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
showNewAppBarTitle: true,
icon: "assets/images/new/bottom_nav/todo.svg",
description: TranslationBase.of(context).infoTodo,
onTap: widget.onBackClick,
onTap: widget!.onBackClick,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: Column(
children: <Widget>[
@ -192,7 +192,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
margin: EdgeInsets.only(left: 5.0, right: 5.0),
child: SvgPicture.asset("assets/images/new/CoronaIcon.svg", width: 35.0, height: 35.0),
)
: widget.appoList[index].isLiveCareAppointment
: widget.appoList[index].isLiveCareAppointment!
? SvgPicture.asset("assets/images/new/virtual.svg")
: SvgPicture.asset("assets/images/new/hospital-visit.svg"),
),
@ -204,7 +204,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
child: Text(
widget.appoList[index].clinicID == 265
? TranslationBase.of(context).covidTestTodo
: widget.appoList[index].isLiveCareAppointment
: widget.appoList[index].isLiveCareAppointment!
? TranslationBase.of(context).liveCareAppo
: TranslationBase.of(context).walkinAppo,
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48)),
@ -213,8 +213,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: CountdownTimer(
controller: new CountdownTimerController(
endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay * 1000) * 60),
widgetBuilder: (_, CurrentRemainingTime time) {
endTime: DateTime.now().millisecondsSinceEpoch + (widget.appoList[index].remaniningHoursTocanPay! * 1000) * 60),
widgetBuilder: (_, CurrentRemainingTime? time) {
return time != null
? Text(
'${time.days != null ? time.days : "0"}:${time.hours != null ? time.hours.toString().length == 1 ? "0" + time.hours.toString() : time.hours : "00"}:${time.min}:${time.sec} \n' +
@ -256,7 +256,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj,
widget.appoList[index].doctorTitle! + " " + widget.appoList[index].doctorNameObj!,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
),
@ -264,7 +264,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LargeAvatar(
name: widget.appoList[index].doctorTitle + " " + widget.appoList[index].doctorNameObj,
name: widget.appoList[index].doctorTitle! + " " + widget.appoList[index].doctorNameObj!,
url: widget.appoList[index].doctorImageURL,
width: 52,
height: 52,
@ -275,39 +275,60 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).clinic + ": ", widget.appoList[index].clinicName!, projectViewModel.isArabic),
// MyRichText(TranslationBase.of(context).appointmentDate + ": ",
// DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) + " " + widget.appoList[index].startTime.substring(0, 5), projectViewModel.isArabic),
// Timezone changes
widget.appoList[index].isLiveCareAppointment
widget.appoList[index].isLiveCareAppointment!
? MyRichText(
TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) +
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!)) +
" " +
DateUtil.convertStringToDate(widget.appoList[index].appointmentDate).toString().split(" ")[1].substring(0, 5),
DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!).toString().split(" ")[1].substring(0, 5),
projectViewModel.isArabic)
: MyRichText(
TranslationBase.of(context).appointmentDate + ": ",
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate)) +
DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.appoList[index].appointmentDate!)) +
" " +
widget.appoList[index].startTime.substring(0, 5),
widget.appoList[index].startTime!.substring(0, 5),
projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.appoList[index].projectName!, projectViewModel.isArabic),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
RatingBar.readOnly(
initialRating: widget.appoList[index].actualDoctorRate.toDouble(),
size: 16.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
// RatingBar.readOnly(
// initialRating: widget.appoList[index].actualDoctorRate!.toDouble(),
// size: 16.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
RatingBar(
initialRating: widget.appoList[index].actualDoctorRate!.toDouble(),
ratingWidget: RatingWidget(
full: Icon(
Icons.star,
color: Colors.yellow[700],
),
half: Icon(
Icons.star_half,
color: Colors.yellow[700],
),
empty: Icon(
Icons.star_border,
color: Colors.grey[500],
),
),
onRatingUpdate: (double value) {},
unratedColor: Colors.grey[500],
updateOnDrag: false,
tapOnlyMode: false,
),
],
),
@ -354,7 +375,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
child: AppExpandableNotifier(
isExpand: true,
hasCounter: true,
counter: (widget.ancillaryLists.isNotEmpty) ? widget.ancillaryLists[0].ancillaryOrderList.length.toString() : "0",
counter: (widget.ancillaryLists.isNotEmpty) ? widget.ancillaryLists[0].ancillaryOrderList!.length.toString() : "0",
title: TranslationBase.of(context).anicllaryOrders,
bodyWidget: widget.ancillaryLists.length != 0
? Container(
@ -365,18 +386,18 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
reverse: true,
itemBuilder: (context, index) {
return DoctorCard(
onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList[index], widget.ancillaryLists[0].projectID),
onTap: () => ancillaryOrdersDetails(widget.ancillaryLists[0].ancillaryOrderList![index], widget.ancillaryLists[0].projectID),
isInOutPatient: true,
name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList[index].doctorName ?? ""),
billNo: widget.ancillaryLists[0].ancillaryOrderList[index].orderNo.toString(),
name: TranslationBase.of(context).dr.toString() + " " + (widget.ancillaryLists[0].ancillaryOrderList![index].doctorName ?? ""),
billNo: widget.ancillaryLists[0].ancillaryOrderList![index].orderNo.toString(),
profileUrl: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
subName: widget.ancillaryLists[0].projectName,
isLiveCareAppointment: false,
date: DateUtil.convertStringToDate(widget.ancillaryLists[0].ancillaryOrderList[index].orderDate),
date: DateUtil.convertStringToDate(widget.ancillaryLists[0]!.ancillaryOrderList![index].orderDate!),
isSortByClinic: true,
);
},
itemCount: widget.ancillaryLists[0].ancillaryOrderList.length,
itemCount: widget.ancillaryLists[0].ancillaryOrderList!.length,
separatorBuilder: (context, index) => SizedBox(height: 14),
),
)
@ -430,7 +451,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
Container(
child: InkWell(
onTap: () {
getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID, widget.obGyneAppoList[index].setupID, widget.obGyneAppoList[index]);
getOBGyneDoctorsList(widget.obGyneAppoList[index].projectID!, widget.obGyneAppoList[index].setupID!, widget.obGyneAppoList[index]);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
@ -451,7 +472,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(
TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName,
TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName!,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
),
),
@ -459,7 +480,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LargeAvatar(
name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName,
name: TranslationBase.of(context).dr + " " + widget.obGyneAppoList[index].doctorName!,
url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown.png",
width: 52,
height: 52,
@ -470,12 +491,12 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).clinic + ": ", widget.obGyneAppoList[index].clinicDescription!, projectViewModel.isArabic),
MyRichText(
TranslationBase.of(context).orderDate + ": ",
DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate)).split(" ")[0],
DateUtil.getDayMonthYearHourMinuteDateFormatted(DateUtil.convertStringToDate(widget.obGyneAppoList[index].orderDate!)).split(" ")[0],
projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription, projectViewModel.isArabic),
MyRichText(TranslationBase.of(context).branch, widget.obGyneAppoList[index].projectDescription!, projectViewModel.isArabic),
],
),
),
@ -781,7 +802,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
List<PatientDoctorAppointmentList> doctorByHospital = _patientDoctorAppointmentListHospital.where((elementClinic) => elementClinic.filterName == element.projectName).toList();
if (doctorByHospital.length != 0) {
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
_patientDoctorAppointmentListHospital[_patientDoctorAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList!.add(element);
} else {
_patientDoctorAppointmentListHospital
.add(PatientDoctorAppointmentList(filterName: element.projectName, distanceInKMs: element.projectDistanceInKiloMeters.toString(), patientDoctorAppointment: element));
@ -848,7 +869,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
checkPatientNphiesEligibility(context, AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.checkPatientNphiesEligibility(appo.projectID).then((res) {
service.checkPatientNphiesEligibility(appo.projectID!).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["isNphiesMatchedWithVida"]) {
getPatientShare(context, appo);
@ -878,7 +899,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
void continueAsCash(AppoitmentAllHistoryResultList appo) {
DoctorsListService service = new DoctorsListService();
GifLoaderDialogUtils.showMyDialog(context);
service.convertPatientToCash(appo.projectID).then((res) {
service.convertPatientToCash(appo.projectID!).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["MessageStatus"] == 1) {
getPatientShare(context, appo);
@ -895,11 +916,11 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
getPatientShare(context, AppoitmentAllHistoryResultList appo) {
String errorMsg = "";
DoctorsListService service = new DoctorsListService();
if (appo.isLiveCareAppointment) {
if (appo.isLiveCareAppointment!) {
getLiveCareAppointmentPatientShare(context, service, appo);
} else {
GifLoaderDialogUtils.showMyDialog(context);
service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) {
service.getPatientShare(appo.appointmentNo.toString(), appo.clinicID!, appo.projectID!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
widget.patientShareResponse = new PatientShareResponse.fromJson(res['OnlineCheckInAppointments'][0]);
isInsured = res["IsInsured"];
@ -938,7 +959,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
getLiveCareAppointmentPatientShare(context, DoctorsListService service, AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID, appo.projectID, context).then((res) {
service.getLiveCareAppointmentPatientShare(appo.appointmentNo.toString(), appo.clinicID!, appo.projectID!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
widget.patientShareResponse = new PatientShareResponse.fromJson(res);
openPaymentDialog(appo, widget.patientShareResponse);
@ -1002,7 +1023,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
child: Opacity(
opacity: a1.value,
child: PaymentDialog(appo: appo, patientShareResponse: patientShareResponse),
child: PaymentDialog(appo: appo, patientShareResponse: patientShareResponse, onPaymentMethodSelected: (){},),
),
);
},
@ -1010,10 +1031,10 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
barrierDismissible: false,
barrierLabel: '',
context: context,
pageBuilder: (context, animation1, animation2) {})
pageBuilder: (context, animation1, animation2) { return SizedBox();})
.then((value) {
if (value != null) {
navigateToPaymentMethod(context, value, appo);
navigateToPaymentMethod(context, value as PatientShareResponse, appo);
projectViewModel.analytics.todoList.to_do_list_confirm_payment_details(appo);
} else {
projectViewModel.analytics.todoList.to_do_list_cancel_payment_details(appo);
@ -1029,18 +1050,18 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
widget.browser.openPaymentBrowser(
amount,
"Appointment check in",
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo),
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!),
appo.projectID.toString(),
authenticatedUser.emailAddress,
authenticatedUser.emailAddress!,
paymentMethod[0],
authenticatedUser.patientType,
authenticatedUser.firstName,
authenticatedUser.firstName!,
authenticatedUser.patientID,
authenticatedUser,
widget.browser,
appo.isLiveCareAppointment,
appo.isLiveCareAppointment!,
"2",
appo.isLiveCareAppointment ? widget.patientShareResponse.clinicID.toString() : "",
appo.isLiveCareAppointment! ? widget.patientShareResponse.clinicID.toString() : "",
context,
appo.appointmentDate,
appo.appointmentNo,
@ -1056,12 +1077,12 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
if (selectedPaymentMethod == "TAMARA") {
if (Platform.isAndroid) {
Uri uri = new Uri.dataFromString(url);
tamaraPaymentStatus = uri.queryParameters['status'];
tamaraOrderID = uri.queryParameters['AuthorizePaymentId'];
tamaraPaymentStatus = uri.queryParameters['status']!;
tamaraOrderID = uri.queryParameters['AuthorizePaymentId']!;
} else {
Uri uri = new Uri.dataFromString(url);
tamaraPaymentStatus = uri.queryParameters['paymentStatus'];
tamaraOrderID = uri.queryParameters['orderId'];
tamaraPaymentStatus = uri.queryParameters['paymentStatus']!;
tamaraOrderID = uri.queryParameters['orderId']!;
}
}
@ -1089,7 +1110,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!");
if (selectedPaymentMethod == "TAMARA") {
checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), appo);
checkTamaraPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), appo);
// if (tamaraPaymentStatus != null && tamaraPaymentStatus.toLowerCase() == "approved") {
// updateTamaraRequestStatus("success", "14", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID, num.parse(selectedInstallments), appo);
// } else {
@ -1106,10 +1127,10 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
service.getTamaraPaymentStatus(orderID).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res["status"].toString().toLowerCase() == "success") {
updateTamaraRequestStatus("success", "14", orderID, res["tamara_order_id"], num.parse(selectedInstallments), appo);
updateTamaraRequestStatus("success", "14", orderID, res["tamara_order_id"], int.parse(selectedInstallments!), appo);
} else {
updateTamaraRequestStatus(
"Failed", "00", Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), tamaraOrderID != null ? tamaraOrderID : "", num.parse(selectedInstallments), appo);
"Failed", "00", Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), tamaraOrderID != null ? tamaraOrderID : "", int.parse(selectedInstallments!), appo);
}
}).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
@ -1158,9 +1179,9 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
"AppointmentDate": appo.appointmentDate.toString(),
};
DoctorsListService service = new DoctorsListService();
service.markAppointmentForTamara(appo.projectID, appo.appointmentNo.toString()).then((res) {
service.markAppointmentForTamara(appo.projectID!, appo.appointmentNo.toString()).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (appo.isLiveCareAppointment)
if (appo.isLiveCareAppointment!)
addVIDARequestInsert("0", tamaraOrderID, appo);
else
getAppoQR(context, appo);
@ -1173,12 +1194,12 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
checkPaymentStatus(AppoitmentAllHistoryResultList appo) {
String txn_ref;
num amount;
String payment_method;
final currency = projectViewModel.user.outSA == 0 ? "sar" : 'aed';
num? amount;
String? payment_method;
final currency = projectViewModel.user!.outSA == 0 ? "sar" : 'aed';
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), false, context).then((res) {
service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), false, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
String paymentInfo = res['Response_Message'];
if (paymentInfo == 'Success') {
@ -1192,10 +1213,10 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
AppToast.showErrorToast(message: res['Response_Message']);
projectViewModel.analytics.appointment.payment_fail(
appointment_type: 'regular',
payment_method: payment_method,
payment_method: payment_method!,
clinic: appo.clinicName,
hospital: appo.projectName,
txn_amount: "$amount",
txn_amount: "$amount!",
txn_currency: currency,
error_type: res['Response_Message']);
}
@ -1212,7 +1233,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
service.createAdvancePayment(appo, appo.projectID.toString(), res['Amount'], res['Fort_id'], res['PaymentMethod'], context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
addAdvancedNumberRequest(
Utils.isVidaPlusProject(projectViewModel, appo.projectID)
Utils.isVidaPlusProject(projectViewModel, appo.projectID!)
? res['OnlineCheckInAppointments'][0]['AdvanceNumber_VP'].toString()
: res['OnlineCheckInAppointments'][0]['AdvanceNumber'].toString(),
paymentReference,
@ -1230,7 +1251,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
DoctorsListService service = new DoctorsListService();
service.addAdvancedNumberRequest(advanceNumber, paymentReference, appointmentID, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (appo.isLiveCareAppointment)
if (appo.isLiveCareAppointment!)
addVIDARequestInsert(advanceNumber, paymentReference, appo);
else
getAppoQR(context, appo);
@ -1244,8 +1265,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service
.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate,
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context)
.insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!,
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
getPatientAppointmentHistory();
@ -1260,7 +1281,7 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
context,
FadePage(
page: PaymentMethod(
onSelectedMethod: (String metohd, [String selectedInstallmentPlan]) {
onSelectedMethod: (String metohd, [String? selectedInstallmentPlan]) {
setState(() {});
},
patientShare: widget.patientShareResponse.patientShareWithTax)))
@ -1271,8 +1292,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
getPatientAppointmentHistory();
if (value != null) {
final appType = appo.isLiveCareAppointment ? 'livecare' : 'regular';
openPayment(value, projectViewModel.user, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo);
final appType = appo.isLiveCareAppointment! ? 'livecare' : 'regular';
openPayment(value, projectViewModel.user!, double.parse(patientShareResponse.patientShareWithTax.toString()), patientShareResponse, appo);
projectViewModel.analytics.appointment.payment_method(appointment_type: appType, clinic: appo.clinicName, payment_method: value[0], payment_type: 'appointment');
}
});
@ -1281,11 +1302,11 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
confirmAppointment(AppoitmentAllHistoryResultList appo) {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.confirmAppointment(appo.appointmentNo, appo.clinicID, appo.projectID, appo.isLiveCareAppointment, context).then((res) {
service.confirmAppointment(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.isLiveCareAppointment!, context).then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {
AppToast.showSuccessToast(message: res['ErrorEndUserMessage']);
if (appo.isLiveCareAppointment) {
if (appo.isLiveCareAppointment!) {
insertLiveCareVIDARequest(appo);
} else {
getPatientAppointmentHistory();
@ -1304,8 +1325,8 @@ class _ToDoState extends State<ToDo> with SingleTickerProviderStateMixin {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service
.insertVIDARequest(appo.appointmentNo, appo.clinicID, appo.projectID, appo.serviceID, appo.doctorID, appo.appointmentDate,
Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context)
.insertVIDARequest(appo.appointmentNo!, appo.clinicID!, appo.projectID!, appo.serviceID!, appo.doctorID!, appo.appointmentDate!,
Utils.getAppointmentTransID(appo.projectID!, appo.clinicID!, appo.appointmentNo!), context)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
if (res['MessageStatus'] == 1) {

@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';
import 'package:diplomaticquarterapp/core/model/my_balance/tamara_installment_details.dart';
@ -14,10 +15,10 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
class PaymentMethod extends StatefulWidget {
Function onSelectedMethod;
bool isShowInstallments;
num patientShare;
bool isFromAdvancePayment;
Function? onSelectedMethod;
bool? isShowInstallments;
num? patientShare;
bool? isFromAdvancePayment;
PaymentMethod({this.onSelectedMethod, this.isShowInstallments = false, this.patientShare, this.isFromAdvancePayment = false});
@ -27,13 +28,13 @@ class PaymentMethod extends StatefulWidget {
class _PaymentMethodState extends State<PaymentMethod> {
String selectedPaymentMethod = "MADA";
TamaraInstallmentDetails tamaraInstallmentDetails;
String selectedInstallmentPlan;
TamaraInstallmentDetails? tamaraInstallmentDetails;
String? selectedInstallmentPlan;
num minTamaraLimit = 0;
num maxTamaraLimit = 0;
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
void initState() {
@ -64,7 +65,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
margin: EdgeInsets.fromLTRB(4, 15.0, 4, 0.0),
child: Text(TranslationBase.of(context).selectPaymentOption, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold)),
),
if (projectViewModel.havePrivilege(86))
if (projectViewModel!.havePrivilege(86))
Container(
width: double.infinity,
child: InkWell(
@ -114,7 +115,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
),
),
),
if (projectViewModel.havePrivilege(87))
if (projectViewModel!.havePrivilege(87))
Container(
width: double.infinity,
child: InkWell(
@ -164,7 +165,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
),
),
),
if (projectViewModel.havePrivilege(88))
if (projectViewModel!.havePrivilege(88))
Container(
width: double.infinity,
child: InkWell(
@ -214,7 +215,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
),
),
),
if (projectViewModel.havePrivilege(90) && !widget.isFromAdvancePayment && widget.patientShare >= minTamaraLimit && widget.patientShare <= maxTamaraLimit)
if (projectViewModel!.havePrivilege(90) && !widget.isFromAdvancePayment! && widget.patientShare! >= minTamaraLimit && widget.patientShare! <= maxTamaraLimit)
Container(
width: double.infinity,
child: InkWell(
@ -243,7 +244,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
height: 60.0,
padding: EdgeInsets.all(0.0),
width: 60,
child: projectViewModel.isArabic ? Image.asset("assets/images/new/payment/tamara_ar.png") : Image.asset("assets/images/new/payment/tamara_en.png"),
child: projectViewModel!.isArabic ? Image.asset("assets/images/new/payment/tamara_ar.png") : Image.asset("assets/images/new/payment/tamara_en.png"),
),
mFlex(1),
if (selectedPaymentMethod == "TAMARA")
@ -264,7 +265,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
),
),
),
if (widget.isShowInstallments && projectViewModel.havePrivilege(91))
if (widget.isShowInstallments! && projectViewModel!.havePrivilege(91))
Container(
width: double.infinity,
child: InkWell(
@ -315,7 +316,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
),
),
),
(Platform.isIOS && projectViewModel.havePrivilege(89))
(Platform.isIOS && projectViewModel!.havePrivilege(89))
? Container(
width: double.infinity,
child: InkWell(
@ -402,7 +403,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
Column(
children: [
...List.generate(
tamaraInstallmentDetails.supportedInstalments.length,
tamaraInstallmentDetails!.supportedInstalments!.length,
(index) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -416,14 +417,14 @@ class _PaymentMethodState extends State<PaymentMethod> {
child: InkWell(
onTap: () {
setState(() {
selectedInstallmentPlan = tamaraInstallmentDetails.supportedInstalments[index].instalments.toString();
selectedInstallmentPlan = tamaraInstallmentDetails!.supportedInstalments![index].instalments.toString();
// getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID);
});
},
child: Row(
children: [
Radio(
value: tamaraInstallmentDetails.supportedInstalments[index].instalments.toString(),
value: tamaraInstallmentDetails!.supportedInstalments![index].instalments.toString(),
groupValue: selectedInstallmentPlan,
activeColor: Colors.red[800],
toggleable: true,
@ -435,7 +436,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
},
),
Text(
tamaraInstallmentDetails.supportedInstalments[index].instalments.toString() + " " + TranslationBase.of(context).installments,
tamaraInstallmentDetails!.supportedInstalments![index].instalments.toString() + " " + TranslationBase.of(context).installments,
style: TextStyle(
fontSize: 12.0,
letterSpacing: -0.48,
@ -467,7 +468,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
disabledBackgroundColor: Color(0xFFbcc2c4).withOpacity(0.12),
elevation: 0,
onPressed: () {
widget.onSelectedMethod(selectedPaymentMethod, selectedInstallmentPlan);
widget.onSelectedMethod!(selectedPaymentMethod, selectedInstallmentPlan);
Navigator.pop(context, [selectedPaymentMethod, selectedInstallmentPlan]);
},
child: Text(TranslationBase.of(context).confirm.toUpperCase(), style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, color: Colors.white)),
@ -494,7 +495,7 @@ class _PaymentMethodState extends State<PaymentMethod> {
disabledBackgroundColor: Color(0xFFbcc2c4).withOpacity(0.12),
elevation: 0,
onPressed: () {
widget.onSelectedMethod(selectedPaymentMethod, selectedInstallmentPlan);
widget.onSelectedMethod!(selectedPaymentMethod, selectedInstallmentPlan);
Navigator.pop(context, [selectedPaymentMethod, selectedInstallmentPlan]);
},
child: Text(TranslationBase.of(context).confirm.toUpperCase(), style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, color: Colors.white)),
@ -517,15 +518,15 @@ class _PaymentMethodState extends State<PaymentMethod> {
getTamaraPaymentDetails() {
GifLoaderDialogUtils.showMyDialog(context);
DoctorsListService service = new DoctorsListService();
service.getTamaraPaymentDetails(context).then((res) {
service.getTamaraPaymentDetails(context).then((Map<String, dynamic> res) {
tamaraInstallmentDetails = TamaraInstallmentDetails.fromJson(res);
print(tamaraInstallmentDetails.name);
minTamaraLimit = tamaraInstallmentDetails.supportedInstalments[0].minLimit.amount;
maxTamaraLimit = tamaraInstallmentDetails.supportedInstalments[0].maxLimit.amount;
selectedInstallmentPlan = tamaraInstallmentDetails.supportedInstalments[0].instalments.toString();
print(tamaraInstallmentDetails!.name!);
minTamaraLimit = tamaraInstallmentDetails!.supportedInstalments![0].minLimit!.amount!;
maxTamaraLimit = tamaraInstallmentDetails!.supportedInstalments![0].maxLimit!.amount!;
selectedInstallmentPlan = tamaraInstallmentDetails!.supportedInstalments![0].instalments.toString();
GifLoaderDialogUtils.hideDialog(context);
setState(() {});
}).catchError((err) {
} as FutureOr Function(Map value)).catchError((err) {
GifLoaderDialogUtils.hideDialog(context);
print(err);
});

@ -11,12 +11,12 @@ import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:flutter/material.dart';
class PaymentDialog extends StatefulWidget {
AppoitmentAllHistoryResultList appo;
PatientShareResponse patientShareResponse;
late AppoitmentAllHistoryResultList appo;
late PatientShareResponse? patientShareResponse;
final Function onPaymentMethodSelected;
late final Function onPaymentMethodSelected;
PaymentDialog({@required this.appo, @required this.onPaymentMethodSelected, this.patientShareResponse});
PaymentDialog({required this.appo, required this.onPaymentMethodSelected, this.patientShareResponse});
@override
_PaymentDialogState createState() => _PaymentDialogState();
@ -41,9 +41,9 @@ class _PaymentDialogState extends State<PaymentDialog> {
color: Color(0xff2B353E),
),
),
Text(widget.appo.doctorTitle + " " + widget.appo.doctorNameObj, style: TextStyle(color: Color(0xff2E303A), fontSize: 16.0, fontWeight: FontWeight.w600,letterSpacing: -0.64)),
Text(getDate(widget.appo.appointmentDate), style: getTextStyle()),
Text(widget.appo.projectName, style: getTextStyle()),
Text(widget.appo.doctorTitle! + " " + widget.appo.doctorNameObj!, style: TextStyle(color: Color(0xff2E303A), fontSize: 16.0, fontWeight: FontWeight.w600,letterSpacing: -0.64)),
Text(getDate(widget.appo.appointmentDate!), style: getTextStyle()),
Text(widget.appo.projectName!, style: getTextStyle()),
Divider(
color: Colors.grey,
),
@ -51,15 +51,15 @@ class _PaymentDialogState extends State<PaymentDialog> {
children: [
TableRow(decoration: BoxDecoration(), children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShare.toString())),
TableCell(child: _getNormalText(widget.patientShareResponse!.patientShare!.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientTaxToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientTaxAmount.toString())),
TableCell(child: _getNormalText(widget.patientShareResponse!.patientTaxAmount!.toString())),
]),
TableRow(children: [
TableCell(child: _getNormalText(TranslationBase.of(context).patientShareTotalToDo)),
TableCell(child: _getNormalText(widget.patientShareResponse.patientShareWithTax.toString())),
TableCell(child: _getNormalText(widget.patientShareResponse!.patientShareWithTax!.toString())),
]),
],
),

@ -6,9 +6,9 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/avatar/large_avatar.dart';
import 'package:diplomaticquarterapp/widgets/my_rich_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class TodoListCard extends StatefulWidget {
TodoListCard();
@ -111,16 +111,34 @@ class _TodoListCardState extends State<TodoListCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
RatingBar.readOnly(
initialRating: 4.5,
size: 16.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
),
RatingBar(
initialRating: 4.6,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
// RatingBar.readOnly(
// initialRating: 4.5,
// size: 16.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
],
),
],

@ -48,7 +48,7 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
});
}
changeCurrentTab(int tab) {
void changeCurrentTab(int tab) {
if (pageController.hasClients) {
setState(() {
currentTab = tab;

@ -28,9 +28,9 @@ import 'package:provider/provider.dart';
class PrescriptionDetailsPage extends StatefulWidget {
final PrescriptionReport? prescriptionReport;
final Prescriptions prescriptions;
final Prescriptions? prescriptions;
PrescriptionDetailsPage({Key? key, this.prescriptionReport, required this.prescriptions});
PrescriptionDetailsPage({Key? key, this.prescriptionReport, this.prescriptions});
@override
_PrescriptionDetailsPageState createState() => _PrescriptionDetailsPageState();
@ -61,18 +61,18 @@ class _PrescriptionDetailsPageState extends State<PrescriptionDetailsPage> {
children: <Widget>[
DoctorHeader(
headerModel: HeaderModel(
widget.prescriptions.doctorName!,
widget.prescriptions.doctorID!,
widget.prescriptions.doctorImageURL!,
widget.prescriptions.speciality!,
widget.prescriptions!.doctorName!,
widget.prescriptions!.doctorID!,
widget.prescriptions!.doctorImageURL!,
widget.prescriptions!.speciality!,
"",
widget.prescriptions.name!,
DateUtil.convertStringToDate(widget.prescriptions.appointmentDate!),
DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions.appointmentDate!)),
widget.prescriptions.nationalityFlagURL!,
widget.prescriptions.doctorRate,
widget.prescriptions.actualDoctorRate,
widget.prescriptions.noOfPatientsRate,
widget.prescriptions!.name!,
DateUtil.convertStringToDate(widget.prescriptions!.appointmentDate!),
DateUtil.formatDateToTime(DateUtil.convertStringToDate(widget.prescriptions!.appointmentDate!)),
widget.prescriptions!.nationalityFlagURL!,
widget.prescriptions!.doctorRate,
widget.prescriptions!.actualDoctorRate,
widget.prescriptions!.noOfPatientsRate,
"",
),
isNeedToShowButton: false,

@ -17,7 +17,7 @@ class WorkplaceUpdatePage extends StatefulWidget {
final String setupID;
final int projectID;
WorkplaceUpdatePage({@required this.requestNumber, @required this.setupID, @required this.projectID});
WorkplaceUpdatePage({required this.requestNumber, required this.setupID, required this.projectID});
@override
_WorkplaceUpdatePageState createState() => _WorkplaceUpdatePageState();
@ -25,8 +25,8 @@ class WorkplaceUpdatePage extends StatefulWidget {
class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
TextEditingController workplaceName = new TextEditingController();
bool _isButtonDisabled;
ProjectViewModel projectViewModel;
bool? _isButtonDisabled;
ProjectViewModel? projectViewModel;
@override
void initState() {
@ -83,7 +83,7 @@ class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
height: 50,
elevation: 0,
color: CustomColors.accentColor,
disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25),
disabledColor:Colors.grey.withOpacity(0.25),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
child: Text(
TranslationBase.of(context).submit,
@ -109,7 +109,7 @@ class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
@ -145,7 +145,7 @@ class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
keyboardType: TextInputType.name,
controller: _controller,
inputFormatters: [
projectViewModel.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")),
projectViewModel!.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")),
],
onChanged: (value) => {_onPassportTextChanged(value)},
style: TextStyle(
@ -211,7 +211,7 @@ class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
var messageAr = "اسم مكان العمل الذي أدخلته هو: " + workplaceName.text + ". يرجى تأكيد!";
ConfirmDialog dialog = new ConfirmDialog(
context: context,
confirmMessage: projectViewModel.isArabic ? messageAr : messageEn,
confirmMessage: projectViewModel!.isArabic ? messageAr : messageEn,
okText: TranslationBase.of(context).confirm,
cancelText: TranslationBase.of(context).cancel_nocaps,
okFunction: () {
@ -227,7 +227,7 @@ class _WorkplaceUpdatePageState extends State<WorkplaceUpdatePage> {
GifLoaderDialogUtils.showMyDialog(context);
service
.updateWorkplaceName(projectViewModel.isArabic ? "-" : workplaceName.text, projectViewModel.isArabic ? workplaceName.text : "-", widget.requestNumber, widget.setupID, widget.projectID)
.updateWorkplaceName(projectViewModel!.isArabic ? "-" : workplaceName.text, projectViewModel!.isArabic ? workplaceName.text : "-", widget.requestNumber, widget.setupID, widget.projectID)
.then((res) {
GifLoaderDialogUtils.hideDialog(context);
Navigator.of(context).pop(true);

@ -11,7 +11,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart' as grid_view;
import 'CreateCustomerDailogPage.dart';
@ -20,24 +20,24 @@ dynamic languageID;
class ClinicPackagesPage extends StatefulWidget {
List<PackagesResponseModel> products;
ClinicPackagesPage({@required this.products});
ClinicPackagesPage({required this.products});
@override
_ClinicPackagesPageState createState() => _ClinicPackagesPageState();
}
class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayoutMixin<ClinicPackagesPage> {
AppScaffold appScaffold;
AppScaffold? appScaffold;
List<PackagesResponseModel> get _products => widget.products;
PackagesViewModel viewModel;
PackagesViewModel? viewModel;
onProductCartClick(PackagesResponseModel product) async {
if (viewModel.service.customer == null) viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
if (viewModel!.service.customer == null) viewModel!.service.customer = await CreateCustomerDialogPage(context: context).show();
if (viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response) {
if (viewModel!.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel!.service!.customer!.id);
await viewModel!.service.addProductToCart(request, context: context).then((response) {
}).catchError((error) {
utils.Utils.showErrorToast(error);
});
@ -74,7 +74,7 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayou
showNewAppBarTitle: true,
body: Padding(
padding: const EdgeInsets.all(12),
child: StaggeredGridView.countBuilder(
child:grid_view.AlignedGridView.count(
crossAxisCount: 4,
itemCount: _products.length,
itemBuilder: (BuildContext context, int index) => new Container(
@ -82,9 +82,9 @@ class _ClinicPackagesPageState extends State<ClinicPackagesPage> with AfterLayou
child: PackagesItemCard(
itemContentPadding: 10,
itemModel: _products[index],
onCartClick: OFFERS_VIEW_ONLY ? onProductCartClick : null,
onCartClick: OFFERS_VIEW_ONLY ? onProductCartClick : (PackagesResponseModel){},
)),
staggeredTileBuilder: (int index) => StaggeredTile.fit(2),
// staggeredTileBuilder: (int index) => StaggeredTile.fit(2),
mainAxisSpacing: 20,
crossAxisSpacing: 10,
)),

@ -16,17 +16,17 @@ dynamic languageID;
var emailRegex = RegExp(r'^[^\s@]+@[^\s@]+\.[^\s@]+$');
class CreateCustomerDialogPage extends StatefulWidget {
final BuildContext context;
final BuildContext? context;
CreateCustomerDialogPage({this.context});
PackagesViewModel viewModel;
PackagesViewModel? viewModel;
Future<PackagesCustomerResponseModel> show() async{
await showDialog(context: context, builder: (context ){
Future<PackagesCustomerResponseModel?> show() async{
await showDialog(context: context!, builder: (context ){
return AlertDialog(content: this, shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20)
), elevation: 5, );
});
return viewModel.service.customer;
return viewModel!.service!.customer;
}
@override
@ -35,8 +35,8 @@ class CreateCustomerDialogPage extends StatefulWidget {
}
class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> with AfterLayoutMixin<CreateCustomerDialogPage>, TickerProviderStateMixin{
AnimationController _loadingController;
AnimationController _submitController;
AnimationController? _loadingController;
AnimationController? _submitController;
bool _enableInput = true;
Interval _nameTextFieldLoadingAnimationInterval = const Interval(0, .85);
@ -61,7 +61,7 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
bool verifyPin = false;
PackagesViewModel viewModel() => widget.viewModel;
PackagesViewModel viewModel() => widget.viewModel!;
@override
Widget build(BuildContext context) {
@ -74,14 +74,14 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
}
Widget verifyPinWidget(){
return SizedBox();
}
Widget userDetailWidget(){
return
Container(
width: SizeConfig.realScreenWidth * 0.8,
width: SizeConfig.realScreenWidth! * 0.8,
height: 270,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -105,7 +105,7 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
FocusScope.of(context).requestFocus(_phoneFocusNode);
},
validator: (value){
return (value.isEmpty || !emailRegex.hasMatch(value))
return (value!.isEmpty || !emailRegex.hasMatch(value))
? 'Invalid email!'
: null;
},
@ -126,7 +126,7 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
FocusScope.of(context).requestFocus(_phoneFocusNode);
},
validator: (value){
return (value.isEmpty || !emailRegex.hasMatch(value))
return (value!.isEmpty || !emailRegex.hasMatch(value))
? 'Invalid email!'
: null;
},
@ -136,7 +136,7 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
AnimatedButton(
color: Theme.of(context).primaryColor,
loadingColor: Theme.of(context).primaryColor,
controller: _submitController,
controller: _submitController!,
text: TranslationBase.of(context).done,
onPressed: (){
createCustomer();
@ -173,7 +173,7 @@ class _CreateCustomerDialogPageState extends State<CreateCustomerDialogPage> wit
}
loading(bool can){
can ? _submitController.forward() : _submitController.reverse();
can ? _submitController!.forward() : _submitController!.reverse();
}
}

@ -9,22 +9,23 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:expandable/expandable.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:html/parser.dart';
import 'package:rating_bar/rating_bar.dart';
class OfferAndPackagesDetail extends StatefulWidget {
final PackagesResponseModel itemModel;
final Function(PackagesResponseModel product) onCartClick;
bool showAddToCartFooter = true;
OfferAndPackagesDetail({@required this.itemModel, @required this.onCartClick, Key key}) : super(key: key);
OfferAndPackagesDetail({required this.itemModel, required this.onCartClick, Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => OfferAndPackagesDetailState();
}
class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
PackagesViewModel viewModel;
PackagesViewModel? viewModel;
bool expandFlag = false;
var controller = new ExpandableController();
@ -34,7 +35,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
final images = widget.itemModel.images ?? [];
String image = "";
if(images.isNotEmpty)
image = widget.itemModel.images.first.src ?? "";
image = widget.itemModel.images!.first.src ?? "";
return BaseView<PackagesViewModel>(
onModelReady: (model) {
@ -79,28 +80,46 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.itemModel.name,
widget.itemModel.name!,
maxLines: 1,
style: TextStyle(fontSize: 19.0, fontWeight: FontWeight.bold, color: Color(0xff2E303A), letterSpacing: -1.14),
),
Text(
widget.itemModel.shortDescription,
widget.itemModel.shortDescription!,
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -.56),
),
SizedBox(height: 9),
Row(
children: [
RatingBar.readOnly(
// RatingBar.readOnly(
// initialRating: 4.5,
// // todo ask haroon about rating value
// size: 18.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
RatingBar(
initialRating: 4.5,
// todo ask haroon about rating value
size: 18.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
],
),
SizedBox(height: 16),
@ -110,12 +129,12 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemCount: widget.itemModel.storeNames.length,
itemCount: widget.itemModel.storeNames!.length,
separatorBuilder: (context, index) {
return mWidth(5.0);
},
itemBuilder: (BuildContext context, int index) {
return contactButton(widget.itemModel.storeNames[index].toString());
return contactButton(widget.itemModel.storeNames![index].toString());
},
),
),
@ -133,7 +152,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
scrollOnExpand: true,
scrollOnCollapse: false,
child: ExpandablePanel(
hasIcon: false,
theme: const ExpandableThemeData(
headerAlignment: ExpandablePanelHeaderAlignment.center,
tapBodyToCollapse: true,
@ -170,7 +189,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
collapsed: collapsed,
expanded: Padding(
padding: const EdgeInsets.only(bottom: 21, left: 21, right: 21),
child: Text(parseHtmlString(widget.itemModel.fullDescription),
child: Text(parseHtmlString(widget.itemModel.fullDescription!),
style: TextStyle(
fontSize: 14.0,
fontWeight: FontWeight.w600,
@ -181,7 +200,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
),
theme: const ExpandableThemeData(crossFadePoint: 0),
);
},
}, collapsed: SizedBox(), expanded: SizedBox(),
),
),
],
@ -199,7 +218,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.itemModel.hasDiscountsApplied)
if (widget.itemModel.hasDiscountsApplied!)
Text(widget.itemModel.oldPrice.toString() + " " + TranslationBase.of(context).sar,
style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600, letterSpacing: -0.6, decoration: TextDecoration.lineThrough, color: CustomColors.grey2)),
Text(widget.itemModel.price.toString().trim() + " " + TranslationBase.of(context).sar,
@ -228,7 +247,7 @@ class OfferAndPackagesDetailState extends State<OfferAndPackagesDetail> {
String parseHtmlString(String htmlString) {
var document = parse(htmlString);
String parsedString = parse(document.body.text).documentElement.text;
String parsedString = parse(document.body!.text!).documentElement!.text!;
return parsedString;
}

@ -24,13 +24,15 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import '../../core/model/packages_offers/responses/PackagesCartItemsResponseModel.dart';
dynamic languageID;
const _columnCount = 1;
bool _agreeTerms = false;
String _selectedPaymentMethod;
Map<dynamic, dynamic> _selectedPaymentParams;
String? _selectedPaymentMethod;
Map<dynamic, dynamic>? _selectedPaymentParams;
AnimationController _animationController;
AnimationController? _animationController;
class PackagesCartPage extends StatefulWidget {
PackagesCartPage();
@ -44,9 +46,9 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
languageID = await sharedPref.getString(APP_LANGUAGE);
}
double subtotal, tax, total;
double? subtotal, tax, total;
int _selectedHospitalIndex = -1;
HospitalsModel _selectedHospital;
HospitalsModel? _selectedHospital;
@override
void initState() {
@ -58,12 +60,12 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
@override
void dispose() {
_animationController.dispose();
viewModel.cartItemList.clear();
_animationController!.dispose();
viewModel!.cartItemList.clear();
super.dispose();
}
PackagesViewModel viewModel;
PackagesViewModel? viewModel;
bool loadWidgets = false;
@ -76,10 +78,10 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
}
onPayNowClick() async {
await viewModel.service.placeOrder(context: context, projectID: _selectedHospital.iD, paymentParams: _selectedPaymentParams).then((orderId) {
await viewModel!.service.placeOrder(context: context, projectID: _selectedHospital!.iD, paymentParams: _selectedPaymentParams!).then((orderId) {
if (orderId.runtimeType == int) {
var browser = MyInAppBrowser(context: context, onExitCallback: (data, isDone) => paymentClosed(orderId: orderId, withStatus: isDone, data: data));
browser.openPackagesPaymentBrowser(customer_id: viewModel.service.customer.id, order_id: orderId);
browser.openPackagesPaymentBrowser(customer_id: viewModel!.service.customer!.id, order_id: orderId);
} else {
utils.Utils.showErrorToast('Failed to place order, please try again later');
}
@ -91,7 +93,7 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
@override
void afterFirstLayout(BuildContext context) {
fetchData();
viewModel.service.getHospitals();
viewModel!.service.getHospitals();
}
@override
@ -111,7 +113,7 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
isShowDecPage: false,
showNewAppBar: true,
showNewAppBarTitle: true,
body: viewModel.cartItemList.length > 0
body: viewModel!.cartItemList.length > 0
? Column(
children: [
Expanded(
@ -119,17 +121,17 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
padding: EdgeInsets.all(21),
physics: BouncingScrollPhysics(),
itemBuilder: (cxt, index) {
var item = viewModel.cartItemList[index];
var item = viewModel!.cartItemList[index];
return PackagesCartItemCard(
itemModel: item,
viewModel: viewModel,
viewModel: viewModel!,
getCartItems: fetchData,
shouldStepperChangeApply: (apply, total) async {
var request = AddProductToCartRequestModel(product_id: item.productId, quantity: apply);
ResponseModel response = await viewModel.service.addProductToCart(request, context: context, showLoading: false).catchError((error) {
ResponseModel<PackagesCartItemsResponseModel>? response = await viewModel!.service!.addProductToCart!(request, context: context, showLoading: false)!.catchError((error) {
utils.Utils.showErrorToast(error);
});
if (response.status) {
if (response!.status!) {
fetchData();
}
return response.status ?? false;
@ -137,13 +139,13 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
);
},
separatorBuilder: (cxt, index) => SizedBox(height: 12),
itemCount: viewModel.cartItemList.length),
itemCount: viewModel!.cartItemList.length),
),
Container(
height: 1,
color: Color(0xffEFEFEF),
),
if (viewModel.cartItemList.length > 0)
if (viewModel!.cartItemList.length > 0)
Container(
padding: EdgeInsets.only(left: 21, right: 21, top: 15, bottom: 15),
width: double.infinity,
@ -182,7 +184,7 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
child: Checkbox(
value: _agreeTerms,
onChanged: (v) {
setState(() => _agreeTerms = v);
setState(() => _agreeTerms = v!);
}),
),
SizedBox(width: 10),
@ -238,7 +240,7 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
void confirmSelectHospitalDialog(List<HospitalsModel> hospitals) {
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i),
for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name! + ' ${hospitals[i].distanceInKilometers} ' + TranslationBase.of(context).km, i),
];
showDialog(
context: context,
@ -257,31 +259,31 @@ class _PackagesCartPageState extends State<PackagesCartPage> with AfterLayoutMix
String getHospitalName() {
if (_selectedHospital != null)
return _selectedHospital.name;
return _selectedHospital!.name!;
else
return TranslationBase.of(context).selectHospital;
}
fetchData() async {
final cartResponse = await viewModel.service.cartItems(context: context).catchError((error) {});
final cartResponse = await viewModel!.service.cartItems(context: context).catchError((error) {});
if(cartResponse != null){
subtotal = cartResponse['subtotal'] ?? 0.0;
tax = cartResponse['tax'] ?? 0.0;
total = cartResponse['total'] ?? 0.0;
viewModel.service.getTamaraOptions(context: context, showLoading: true).then((tamara_options){
viewModel!.service!.getTamaraOptions(context: context, showLoading: true).then((tamara_options){
if(tamara_options != null || tamara_options.isNotEmpty) {
viewModel.setTamaraIllegablity(total);
viewModel!.setTamaraIllegablity(total!);
setState(() {});
}
});
}
}
paymentClosed({@required int orderId, @required bool withStatus, dynamic data}) async {
viewModel.service.getOrderById(orderId, context: context).then((value) {
paymentClosed({required int orderId, required bool withStatus, dynamic data}) async {
viewModel!.service.getOrderById(orderId, context: context).then((value) {
var heading = withStatus ? "Success" : "Failed";
var title = withStatus ? "Your order has been placed successfully" : "Failed to place your order";
var subTitle = "Order# ${value.data.customOrderNumber}";
var subTitle = "Order# ${value!.data!.customOrderNumber}";
Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (context) => PackageOrderCompletedPage(heading: heading, title: title, subTitle: subTitle)));
}).catchError((error) {
print(error);
@ -371,10 +373,10 @@ _getNormalText(text, {bool isBold = false, bool isTotal = false}) {
}
Widget _cartItemDeleteContainer() {
_animationController.duration = Duration(milliseconds: 500);
_animationController.repeat(reverse: true);
_animationController!.duration = Duration(milliseconds: 500);
_animationController!.repeat(reverse: true);
return FadeTransition(
opacity: _animationController,
opacity: _animationController!,
child: Padding(
padding: const EdgeInsets.all(5),
child: Container(
@ -382,7 +384,7 @@ Widget _cartItemDeleteContainer() {
color: Colors.red,
boxShadow: [
BoxShadow(
color: Colors.grey[500],
color: Colors.grey[500]!,
blurRadius: 2,
spreadRadius: 1,
),

@ -43,14 +43,14 @@ class PackagesHomePage extends StatefulWidget {
}
class _PackagesHomePageState extends State<PackagesHomePage> {
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
viewModel.service.patientUser = widget.user;
viewModel.service.loadOffersPackagesDataForMainPage(
viewModel!.service.patientUser = widget.user;
viewModel!.service.loadOffersPackagesDataForMainPage(
context: context,
completion: () {
setState(() {});
@ -61,13 +61,13 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
// Controllers
var _searchTextController = TextEditingController();
ListView _listViewLatestOffers;
ListView _listViewBestSeller;
ListView? _listViewLatestOffers;
ListView? _listViewBestSeller;
PackagesViewModel viewModel;
PackagesViewModel? viewModel;
onCartClick() {
if (viewModel.service.customer == null) {
if (viewModel!.service.customer == null) {
utils.Utils.showErrorToast("Cart is empty for your current session");
return;
}
@ -75,21 +75,21 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
}
onProductCartClick(PackagesResponseModel product) async {
if (viewModel.service.customer == null) {
if (viewModel!.service.customer == null) {
// viewModel.service.customer = await CreateCustomerDialogPage(context: context).show();
loginCheck(context);
}
if (viewModel.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel.service.customer.id);
await viewModel.service.addProductToCart(request, context: context).then((response) {}).catchError((error) {
if (viewModel!.service.customer != null) {
var request = AddProductToCartRequestModel(product_id: product.id, customer_id: viewModel!.service.customer!.id);
await viewModel!.service.addProductToCart(request, context: context).then((response) {}).catchError((error) {
utils.Utils.showErrorToast(error.toString());
});
}
}
PackagesCategoriesResponseModel selectedClinic;
OfferProject selectedProject;
PackagesCategoriesResponseModel? selectedClinic;
OfferProject? selectedProject;
@override
Widget build(BuildContext context) {
@ -128,14 +128,14 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
shrinkWrap: true,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21),
itemCount: viewModel.bestSellerList.length,
itemCount: viewModel!.bestSellerList.length,
separatorBuilder: (context, index) {
return mWidth(9.0);
},
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(
itemModel: viewModel.bestSellerList[index],
onCartClick: OFFERS_VIEW_ONLY ? onProductCartClick : null,
itemModel: viewModel!.bestSellerList[index],
onCartClick: OFFERS_VIEW_ONLY! ? onProductCartClick : (PackagesResponseModel){}, itemContentPadding: null,
);
},
),
@ -149,14 +149,14 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
shrinkWrap: true,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21),
itemCount: viewModel.latestOffersList.length,
itemCount: viewModel!.latestOffersList.length,
separatorBuilder: (context, index) {
return mWidth(9.0);
},
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(
itemModel: viewModel.latestOffersList[index],
onCartClick: OFFERS_VIEW_ONLY ? onProductCartClick : null,
itemModel: viewModel!.latestOffersList[index],
onCartClick: OFFERS_VIEW_ONLY ? onProductCartClick : (PackagesResponseModel){}, itemContentPadding: null,
);
},
),
@ -182,9 +182,9 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
int _selectedClinic = -1;
showClinicSelectionList() async {
var clinics = await viewModel.service.getAllCategories(OffersCategoriesRequestModel());
var clinics = await viewModel!.service.getAllCategories(OffersCategoriesRequestModel());
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < clinics.length; i++) RadioSelectionDialogModel(clinics[i].name, i),
for (int i = 0; i < clinics.length; i++) RadioSelectionDialogModel(clinics![i].name!, i),
];
showDialog(
context: context,
@ -195,7 +195,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
onValueSelected: (index) async {
_selectedClinic = index;
selectedClinic = clinics[index];
var clinicProducts = await viewModel.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic.id), context: context, showLoading: true);
var clinicProducts = await viewModel!.service.getAllProducts(request: OffersProductsRequestModel(categoryId: selectedClinic!.id), context: context, showLoading: true);
if (clinicProducts.isNotEmpty)
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => ClinicPackagesPage(products: clinicProducts)));
else
@ -210,11 +210,11 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
showHospitalSelectionList() async {
GifLoaderDialogUtils.showMyDialog(context);
var hospitals = await viewModel.service.getAllStores();
var hospitals = await viewModel!.service.getAllStores();
GifLoaderDialogUtils.hideDialog(context);
List<RadioSelectionDialogModel> list = [
for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name, i),
for (int i = 0; i < hospitals.length; i++) RadioSelectionDialogModel(hospitals[i].name!, i),
];
showDialog(
context: context,
@ -225,9 +225,9 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
onValueSelected: (index) async {
_selectedHospital = index;
selectedProject = hospitals[index];
var request = OffersProductsRequestModel(storeId: selectedProject.id);
var request = OffersProductsRequestModel(storeId: selectedProject!.id);
request.sinceId = 0;
var products = await viewModel.service.getAllProducts(request: request, context: context, showLoading: true);
var products = await viewModel!.service.getAllProducts(request: request, context: context, showLoading: true);
if (products.isNotEmpty)
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => ClinicPackagesPage(products: products)));
else
@ -242,16 +242,16 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
// Main Widgets of Page
//----------------------------------
Widget latestOfferListView({@required double itemWidth, @required double itemContentPadding}) {
Widget latestOfferListView({required double itemWidth, required double itemContentPadding}) {
return _listViewLatestOffers = ListView.separated(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: viewModel.bestSellerList.length,
itemCount: viewModel!.bestSellerList.length,
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(
itemWidth: itemWidth,
itemContentPadding: itemContentPadding,
itemModel: viewModel.bestSellerList[index],
itemModel: viewModel!.bestSellerList[index],
onCartClick: onProductCartClick,
);
},
@ -259,15 +259,15 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
);
}
Widget bestSellerListView({@required double itemWidth, @required double itemContentPadding}) {
Widget bestSellerListView({required double itemWidth, required double itemContentPadding}) {
return _listViewLatestOffers = ListView.separated(
scrollDirection: Axis.horizontal,
itemCount: viewModel.bestSellerList.length,
itemCount: viewModel!.bestSellerList.length,
itemBuilder: (BuildContext context, int index) {
return PackagesItemCard(
itemWidth: itemWidth,
itemContentPadding: itemContentPadding,
itemModel: viewModel.bestSellerList[index],
itemModel: viewModel!.bestSellerList[index],
onCartClick: onProductCartClick,
);
},
@ -280,7 +280,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
width: 1,
decoration: BoxDecoration(
gradient:
LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 4.0), colors: [Colors.grey, Colors.grey[100], Colors.grey[200], Colors.grey[300], Colors.grey[400], Colors.grey[500]])),
LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 4.0), colors: [Colors.grey, Colors.grey[100]!, Colors.grey[200]!, Colors.grey[300]!, Colors.grey[400]!, Colors.grey[500]!])),
);
}
@ -312,7 +312,7 @@ class _PackagesHomePageState extends State<PackagesHomePage> {
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller,
{VoidCallback suffixTap, bool isEnable = true, bool hasSelection = false, int lines, bool isInputTypeNum = false}) {
{VoidCallback? suffixTap, bool isEnable = true, bool hasSelection = false, int? lines, bool isInputTypeNum = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
margin: const EdgeInsets.only(left: 21, right: 21),

@ -11,15 +11,15 @@ import 'package:flutter_svg/svg.dart';
dynamic languageID;
class PackageOrderCompletedPage extends StatelessWidget {
double buttonHeight;
double buttonWidth;
Widget icon;
String heading;
String title;
String subTitle;
String actionTitle;
double? buttonHeight;
double? buttonWidth;
Widget? icon;
String? heading;
String? title;
String? subTitle;
String? actionTitle;
PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, @required this.heading, @required this.title, @required this.subTitle, this.actionTitle});
PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, required this.heading, required this.title, required this.subTitle, this.actionTitle});
@override
Widget build(BuildContext context) {
@ -110,7 +110,7 @@ class PackageOrderCompletedPage extends StatelessWidget {
width: buttonWidth,
child: CustomTextButton(
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(buttonHeight / 2),
borderRadius: new BorderRadius.circular(buttonHeight! / 2),
),
child: Texts(
actionTitle,

@ -21,8 +21,8 @@ class PackagesOfferTabPage extends StatefulWidget{
}
class PackagesOfferTabPageState extends State<PackagesOfferTabPage> with SingleTickerProviderStateMixin{
TabController _tabController;
ProjectViewModel _projectViewModel;
TabController? _tabController;
ProjectViewModel? _projectViewModel;
@override
void initState() {
@ -58,13 +58,13 @@ class PackagesOfferTabPageState extends State<PackagesOfferTabPage> with SingleT
unselectedLabelColor: Color(0xff575757),
labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: _projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontFamily: _projectViewModel!.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: _projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontFamily: _projectViewModel!.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,

@ -21,15 +21,15 @@ class PackagesOrdersHistory extends StatefulWidget{
}
class PackagesOrdersHistorySatate extends State<PackagesOrdersHistory>{
ProjectViewModel projectViewModel;
PackagesViewModel packagesViewModel;
ProjectViewModel? projectViewModel;
PackagesViewModel? packagesViewModel;
List<PackagesResponseModel> orders;
List<PackagesResponseModel>? orders;
@override
void initState() {
Future.delayed(Duration(milliseconds: 200)).then((value) async{
final orders_ = await packagesViewModel.service.orderHistory(context: context);
final orders_ = await packagesViewModel!.service.orderHistory(context: context);
setState(() => orders = orders_ ?? []);
});
}
@ -49,29 +49,29 @@ class PackagesOrdersHistorySatate extends State<PackagesOrdersHistory>{
Widget content(BuildContext context){
if(orders == null){
return SizedBox();
}else if(orders.isEmpty){
}else if(orders!.isEmpty){
return getNoDataWidget(context);
}else {
return ListView.separated(
padding: EdgeInsets.all(20),
itemCount: orders.length,
itemBuilder: (ctx, idx) => item(ctx, order: orders[idx]),
itemCount: orders!.length,
itemBuilder: (ctx, idx) => item(ctx, order: orders![idx]),
separatorBuilder: (ctx, idx) => SizedBox(height: 10),
);
}
}
Widget item(BuildContext context, {@required PackagesResponseModel order}){
Widget item(BuildContext context, {required PackagesResponseModel order}){
return InkWell(
child: PackagesOrderHistoryItemCard(itemModel: order, viewModel: packagesViewModel),
child: PackagesOrderHistoryItemCard(itemModel: order, viewModel: packagesViewModel!),
onTap: (){
final detailPage = OfferAndPackagesDetail(itemModel: order, onCartClick: null)..showAddToCartFooter = false;
final detailPage = OfferAndPackagesDetail(itemModel: order, onCartClick: (PackagesResponseModel){})..showAddToCartFooter = false;
Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => detailPage));
},
);
}
void showConfirmMessage(BuildContext context, {@required PackagesResponseModel order}){
void showConfirmMessage(BuildContext context, {required PackagesResponseModel order}){
showDialog(
context: context,
builder: (cxt) => ConfirmWithMessageDialog(

@ -15,8 +15,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PaymentService extends StatelessWidget {
ToDoCountProviderModel model;
ProjectViewModel projectViewModel;
ToDoCountProviderModel? model;
ProjectViewModel? projectViewModel;
@override
Widget build(BuildContext context) {
@ -62,7 +62,7 @@ class PaymentService extends StatelessWidget {
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: AdvancePaymentPage()));
projectViewModel.analytics.advancePayments.payment_services(service_type: 'payment service');
projectViewModel!.analytics.advancePayments.payment_services(service_type: 'payment service');
},
child: MedicalProfileItem(
title: TranslationBase.of(context).payment,
@ -79,7 +79,7 @@ class PaymentService extends StatelessWidget {
InkWell(
onTap: () {
navigateToToDoPage(context);
projectViewModel.analytics.advancePayments.payment_services(service_type: 'online check-in appointment');
projectViewModel!.analytics.advancePayments.payment_services(service_type: 'online check-in appointment');
},
child: Stack(
children: [
@ -91,20 +91,20 @@ class PaymentService extends StatelessWidget {
width: 45.0,
height: 45.0,
),
projectViewModel.isArabic
projectViewModel!.isArabic
? Positioned(
left: 8,
top: 4,
child: badge_import.Badge(
toAnimate: false,
elevation: 0,
// toAnimate: false,
// elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
// shape: badge_import.BadgeShape.circle,
// badgeColor: secondaryColor.withOpacity(1.0),
// borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
child: Text(model.count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
child: Text(model!.count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
),
),
)
@ -112,15 +112,15 @@ class PaymentService extends StatelessWidget {
right: 8,
top: 4,
child: badge_import.Badge(
toAnimate: false,
elevation: 0,
// toAnimate: false,
// elevation: 0,
position: badge_import.BadgePosition.topEnd(),
shape: badge_import.BadgeShape.circle,
badgeColor: secondaryColor.withOpacity(1.0),
borderRadius: BorderRadius.circular(8),
// shape: badge_import.BadgeShape.circle,
// badgeColor: secondaryColor.withOpacity(1.0),
// borderRadius: BorderRadius.circular(8),
badgeContent: Container(
padding: EdgeInsets.all(2.0),
child: Text(model.count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
child: Text(model!.count.toString(), style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold, fontSize: 12.0)),
),
),
)
@ -133,7 +133,7 @@ class PaymentService extends StatelessWidget {
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: MyBalancePage()));
projectViewModel.analytics.advancePayments.payment_services(service_type: 'alhabib wallet');
projectViewModel!.analytics.advancePayments.payment_services(service_type: 'alhabib wallet');
},
child: MedicalProfileItem(
title: TranslationBase.of(context).hmg,
@ -149,7 +149,7 @@ class PaymentService extends StatelessWidget {
}
navigateToToDoPage(BuildContext context) {
if (projectViewModel.isLogin) {
if (projectViewModel!.isLogin) {
// if (model.count != 0) {
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: true)));
// } else {

@ -7,7 +7,7 @@ import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:provider/provider.dart';
class ProductCheckTypeWidget extends StatefulWidget {
final WishListViewModel model;
final WishListViewModel? model;
ProductCheckTypeWidget({this.model});
@ -21,23 +21,23 @@ class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return ListView.builder(
itemCount: widget.model.wishListList.length,
itemCount: widget.model!.wishListList.length,
itemBuilder: (BuildContext context, int index) {
return Column(
children: [
Container(
child: productTile(
productName: projectViewModel.isArabic
? widget.model.wishListList[index].product.namen
: widget.model.wishListList[index].product.name,
productPrice: widget.model.wishListList[index].subtotal,
? widget.model!.wishListList[index].product.namen
: widget.model!.wishListList[index].product.name,
productPrice: widget.model!.wishListList[index].subtotal,
// productRate: double.parse(widget.model.wishListList[index].subtotalVatRate),
productRate: widget.model.wishListList[index].product.approvedRatingSum.toDouble(),
approvedTotalReviews:widget.model.wishListList[index].product.approvedTotalReviews,
productImage: widget.model.wishListList[index].product.images[0].src,
productID: widget.model.wishListList[index].product.id,
productRate: widget.model!.wishListList[index].product.approvedRatingSum.toDouble(),
approvedTotalReviews:widget.model!.wishListList[index].product.approvedTotalReviews,
productImage: widget.model!.wishListList[index].product.images[0].src,
productID: widget.model!.wishListList[index].product.id,
onDelete: deleteWishListItem,
isRx:widget.model.wishListList[index].product.isRx,
isRx:widget.model!.wishListList[index].product.isRx,
),
),
@ -51,7 +51,7 @@ class _ProductCheckTypeWidgetState extends State<ProductCheckTypeWidget> {
ProductDetailViewModel x = new ProductDetailViewModel();
GifLoaderDialogUtils.showMyDialog(context);
await x.deleteWishlistData(itemID, context);
await widget.model.getWishlistData(isLocalLoader: true);
await widget.model!.getWishlistData(isLocalLoader: true);
GifLoaderDialogUtils.hideDialog(context);
}

@ -141,7 +141,7 @@ class _slideDetailState extends State<slideDetail> {
height: 20,
),
Image.network(
widget.data[index].images[0].src.trim(),
widget.data[index].images![0].src!.trim(),
fit: BoxFit.cover,
width: 100,
height: 60,
@ -208,7 +208,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[0].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![0].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -216,7 +216,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[0].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![0].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -227,7 +227,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[0].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![0].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -235,7 +235,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[0].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![0].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
@ -254,7 +254,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![1].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -262,7 +262,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![1].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -273,7 +273,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![1].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -281,7 +281,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![1].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
@ -300,7 +300,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![2].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -308,7 +308,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![2].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -319,7 +319,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![2].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -327,7 +327,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![2].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
@ -346,7 +346,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![3].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -354,7 +354,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![3].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -365,7 +365,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![3].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -373,7 +373,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![3].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
@ -392,7 +392,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![4].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -400,7 +400,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![4].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -411,7 +411,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![4].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -419,7 +419,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![4].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
@ -438,7 +438,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].nameN : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![5].nameN : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)
@ -446,7 +446,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].name : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![5].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
@ -457,7 +457,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topRight,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].defaultValuen : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![5].defaultValuen : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)
@ -465,7 +465,7 @@ class _slideDetailState extends State<slideDetail> {
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].defaultValue : "",
text: widget.data[index].specifications != null ? widget.data[index].specifications![5].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),

@ -23,7 +23,7 @@ class MedicineSearch extends StatelessWidget {
return BaseView<PharmacyViewModel>(
allowAny: true,
onModelReady: (model) => model.clearMedicineSearch(),
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
builder: (BuildContext context, PharmacyViewModel model, Widget? child) =>
AppScaffold(
baseViewModel: model,
appBarTitle: TranslationBase.of(context).searchMedicine,
@ -35,10 +35,10 @@ class MedicineSearch extends StatelessWidget {
children: <Widget>[
Padding(
padding: EdgeInsets.only(
bottom: SizeConfig.heightMultiplier * 1,
right: SizeConfig.heightMultiplier * 2.5,
top: SizeConfig.heightMultiplier * 4,
left: SizeConfig.heightMultiplier * 2.5,
bottom: SizeConfig.heightMultiplier! * 1,
right: SizeConfig.heightMultiplier! * 2.5,
top: SizeConfig.heightMultiplier! * 4,
left: SizeConfig.heightMultiplier! * 2.5,
),
child: Form(
key: _formKey,
@ -64,10 +64,10 @@ class MedicineSearch extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(
bottom: SizeConfig.heightMultiplier * 0.0,
right: SizeConfig.heightMultiplier * 5,
top: SizeConfig.heightMultiplier * 1,
left: SizeConfig.heightMultiplier * 5,
bottom: SizeConfig.heightMultiplier! * 0.0,
right: SizeConfig.heightMultiplier! * 5,
top: SizeConfig.heightMultiplier! * 1,
left: SizeConfig.heightMultiplier! * 5,
),
child: Wrap(
children: <Widget>[
@ -86,7 +86,7 @@ class MedicineSearch extends StatelessWidget {
if(model.pharmacy.isNotEmpty)
Container(
margin: EdgeInsets.only(
left: SizeConfig.heightMultiplier * 2),
left: SizeConfig.heightMultiplier! * 2),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
@ -104,7 +104,7 @@ class MedicineSearch extends StatelessWidget {
),
Expanded(
child: Container(
width: SizeConfig.screenWidth * 0.85,
width: SizeConfig.screenWidth! * 0.85,
//child: _getHospitals(model.pharmacy),
child: ListView.builder(
//physics: NeverScrollableScrollPhysics(),
@ -116,7 +116,7 @@ class MedicineSearch extends StatelessWidget {
itemBuilder: (BuildContext context, int index) {
return InkWell(
child: MedicineItemWidget(
label: model.pharmacy[index].itemDes,
label: model.pharmacy[index].itemDes!,
url: model.pharmacy[index].productImage),
onTap: () {
Navigator.push(
@ -144,7 +144,7 @@ class MedicineSearch extends StatelessWidget {
searchMedicine(PharmacyViewModel model, BuildContext context) {
Utils.hideKeyboard(context);
if (_formKey.currentState.validate())
if (_formKey.currentState!.validate())
model.getMedicine(name: textController.text);
}
}

@ -4,7 +4,8 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:rating_bar/rating_bar.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
class MyReviewsPage extends StatefulWidget {
@override
@ -66,7 +67,7 @@ class _MyReviewsPageState extends State<MyReviewsPage> {
Container(
child: reviewDetails(
model.reviewListList[index],
double.parse(model.reviewListList[index].product.approvedTotalReviews.toString()),
double.parse(model.reviewListList[index].product!.approvedTotalReviews!.toString()),
double.parse(model.reviewListList[index].rating.toString()),
),
),
@ -139,16 +140,37 @@ reviewDetails(data, rate, myRate) {
margin: EdgeInsets.all(5),
child: Align(
alignment: languageID == 'ar' ? Alignment.topRight : Alignment.topLeft,
child: RatingBar.readOnly(
child:
RatingBar(
initialRating: rate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
// RatingBar.readOnly(
// initialRating: rate,
// size: 15.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
),
),
],
@ -177,16 +199,35 @@ reviewDetails(data, rate, myRate) {
children: [
Container(
padding: languageID == 'ar' ? EdgeInsets.only(right: 60) : EdgeInsets.only(left: 60),
child: RatingBar.readOnly(
child:
RatingBar(
initialRating: myRate,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
// RatingBar.readOnly(
// initialRating: myRate,
// size: 15.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
),
],
),

@ -15,9 +15,9 @@ import 'package:url_launcher/url_launcher.dart';
import '../base/base_view.dart';
class PharmaciesList extends StatelessWidget {
final int medicineID;
final String imageURL;
final String medicineDescription;
final int? medicineID;
final String? imageURL;
final String? medicineDescription;
PharmaciesList({this.medicineID, this.imageURL, this.medicineDescription});
@ -26,7 +26,7 @@ class PharmaciesList extends StatelessWidget {
return BaseView<PharmacyViewModel>(
allowAny: true,
onModelReady: (model) => model.getPharmacies(id: medicineID),
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
builder: (BuildContext context, PharmacyViewModel model, Widget? child) =>
AppScaffold(
appBarTitle: TranslationBase.of(context).pharmaciesList,
baseViewModel: model,
@ -49,9 +49,9 @@ class PharmaciesList extends StatelessWidget {
Radius.circular(7),
),
child: Image.memory(
dataFromBase64String(imageURL),
height: SizeConfig.imageSizeMultiplier * 19,
width: SizeConfig.imageSizeMultiplier * 18,
dataFromBase64String(imageURL!),
height: SizeConfig.imageSizeMultiplier! * 19,
width: SizeConfig.imageSizeMultiplier! * 18,
fit: BoxFit.cover,
),
),
@ -90,10 +90,10 @@ class PharmaciesList extends StatelessWidget {
),
Container(
margin: EdgeInsets.only(
top: SizeConfig.widthMultiplier * 2.0,
bottom: SizeConfig.widthMultiplier * 3.0,
right: SizeConfig.widthMultiplier * 4.0,
left: SizeConfig.widthMultiplier * 2.5,
top: SizeConfig.widthMultiplier! * 2.0,
bottom: SizeConfig.widthMultiplier! * 3.0,
right: SizeConfig.widthMultiplier! * 4.0,
left: SizeConfig.widthMultiplier! * 2.5,
),
child: Align(
alignment: Alignment.center,
@ -104,7 +104,7 @@ class PharmaciesList extends StatelessWidget {
alignment: Alignment.topRight,
),
Container(
width: SizeConfig.screenWidth * 1.0,
width: SizeConfig.screenWidth! * 1.0,
child: ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
@ -120,9 +120,9 @@ class PharmaciesList extends StatelessWidget {
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: Image.network(
model.pharmacyList[index].imageLocation,
height: SizeConfig.imageSizeMultiplier * 13.0,
width: SizeConfig.imageSizeMultiplier * 11.0,
model.pharmacyList[index].imageLocation!,
height: SizeConfig.imageSizeMultiplier! * 13.0,
width: SizeConfig.imageSizeMultiplier! * 11.0,
fit: BoxFit.cover,
),
),
@ -151,7 +151,7 @@ class PharmaciesList extends StatelessWidget {
color: Theme.of(context).primaryColor,
),
onTap: () => launch("tel://" +
model.pharmacyList[index].phoneNumber),
model.pharmacyList[index].phoneNumber!),
),
),
Padding(
@ -164,9 +164,9 @@ class PharmaciesList extends StatelessWidget {
onTap: () {
MapsLauncher.launchCoordinates(
double.parse(
model.pharmacyList[index].latitude),
model.pharmacyList[index].latitude!),
double.parse(model
.pharmacyList[index].longitude),
.pharmacyList[index].longitude!),
);
},
),

@ -126,8 +126,8 @@ class _ProductBrandsPageState extends State<ProductBrandsPage> {
mainAxisAlignment: MainAxisAlignment.start,
children: [
languageID == 'ar'
? Text(model.brandsListList[index].namen)
: Text(model.brandsListList[index].name),
? Text(model.brandsListList[index].namen!)
: Text(model.brandsListList[index].name!),
SizedBox(
height: 3,
),
@ -191,12 +191,12 @@ topBrand(BuildContext context) {
),
child: model.topBrandsListList[index].image != null
? Image.network(
model.topBrandsListList[index].image.src,
model.topBrandsListList[index].image!.src!,
fit: BoxFit.cover,
width: 60,
height: 40,
)
: Text(model.topBrandsListList[index].name)),
: Text(model.topBrandsListList[index].name!)),
),
),
),
@ -243,7 +243,7 @@ class SearchBar extends SearchDelegate<String> {
progress: transitionAnimation,
),
onPressed: () {
close(context, null);
close(context, "");
},
);
}

@ -22,9 +22,9 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class CartOrderPage extends StatefulWidget {
final Function(int) changeTab;
final VoidCallbackAction? changeTab;
const CartOrderPage({Key key, this.changeTab}) : super(key: key);
const CartOrderPage({Key? key, this.changeTab}) : super(key: key);
@override
_CartOrderPageState createState() => _CartOrderPageState();
@ -32,8 +32,8 @@ class CartOrderPage extends StatefulWidget {
class _CartOrderPageState extends State<CartOrderPage> {
bool isLoading = true;
String customerId;
String customerGUID;
late String customerId;
late String customerGUID;
@override
void initState() {
@ -57,14 +57,14 @@ class _CartOrderPageState extends State<CartOrderPage> {
isMainPharmacyPages: true,
showPharmacyCart: false,
baseViewModel: model,
backButtonTab: () {
widget.changeTab(0);
},
backButtonTab:
widget.changeTab!,
backgroundColor: Colors.white,
body: NetworkBaseView(
isLoading: isLoading,
isLocalLoader: true,
child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0)
child: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts!.length == 0)
? Container(
height: height * 0.85,
width: double.infinity,
@ -91,17 +91,17 @@ class _CartOrderPageState extends State<CartOrderPage> {
),
Container(
child: ListView.builder(
itemCount: model.cartResponse.shoppingCarts.length,
itemCount: model.cartResponse.shoppingCarts!.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
// physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
return ProductOrderItem(
item: model.cartResponse.shoppingCarts[index],
item: model.cartResponse.shoppingCarts![index],
changeCartItems: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.changeProductQuantity(model.cartResponse.shoppingCarts[index]);
await model.changeProductQuantity(model.cartResponse.shoppingCarts![index]);
if (model.state != ViewState.Error) {}
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
@ -110,7 +110,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
},
deleteCartItems: () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.deleteProduct(model.cartResponse.shoppingCarts[index]).then((value) {
await model.deleteProduct(model.cartResponse.shoppingCarts![index]).then((value) {
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
}
@ -138,7 +138,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotal)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -162,7 +162,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalVatAmount)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -186,7 +186,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
fontWeight: FontWeight.bold,
),
Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model.cartResponse.subtotalWithVat)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
@ -249,7 +249,7 @@ class _CartOrderPageState extends State<CartOrderPage> {
),
),
bottomSheet: Container(
height: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts.length == 0) ? height * 0.15 : 0,
height: !(model.cartResponse.shoppingCarts == null || model.cartResponse.shoppingCarts!.length == 0) ? height * 0.15 : 0,
color: Colors.white,
child: OrderBottomWidget(model.addresses, height, model, isLoading),
),
@ -297,7 +297,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return !widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || widget.model.cartResponse.shoppingCarts.length == 0)
return !widget.isLoading && !(widget.model.cartResponse.shoppingCarts == null || widget.model.cartResponse.shoppingCarts!.length == 0)
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -382,7 +382,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
child: Row(
children: [
Texts(
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalWithVat)!.toStringAsFixed(2)}",
fontSize: projectProvider.isArabic ? 12 : 14,
fontWeight: FontWeight.bold,
),
@ -416,7 +416,7 @@ class _OrderBottomWidgetState extends State<OrderBottomWidget> {
if (widget.model.isCartItemsOutOfStock())
{AppToast.showErrorToast(message: TranslationBase.of(context).outOfStockMsg)}
else
{_navigateToAddressPage(projectProvider.user.patientIdentificationNo)}
{_navigateToAddressPage(projectProvider.user!.patientIdentificationNo!)}
}
: null,
child: new Text(

@ -16,8 +16,8 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class OrderPreviewPage extends StatefulWidget {
final List<Addresses> addresses;
final OrderPreviewViewModel model;
final List<Addresses>? addresses;
final OrderPreviewViewModel? model;
OrderPreviewPage({this.addresses, this.model});
@ -26,7 +26,7 @@ class OrderPreviewPage extends StatefulWidget {
}
class _OrderPreviewPageState extends State<OrderPreviewPage> {
MyInAppBrowser browser;
MyInAppBrowser? browser;
bool isLoading = true;
bool isChecked = false;
@ -66,8 +66,8 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
child: Column(
children: [
SelectAddressWidget(
widget.model,
widget.addresses,
widget.model!,
widget.addresses!,
changeMainState,
isUpdating: true,
),
@ -75,14 +75,14 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
height: 10,
),
SelectPaymentOptionWidget(
widget.model,
widget.model!,
changeMainState,
isUpdating: true,
),
SizedBox(
height: 10,
),
widget.model.paymentCheckoutData.lacumInformation != null
widget.model!.paymentCheckoutData.lacumInformation != null
? Stack(
children: [
Container(
@ -101,10 +101,10 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
child: Checkbox(
activeColor: CustomColors.green,
value: isChecked,
onChanged: (bool value) {
onChanged: (bool? value) {
setState(() {
isChecked = value;
if (value) {
isChecked = value!;
if (value!) {
PaymentBottomWidget.isChecked = true;
} else {
PaymentBottomWidget.isChecked = false;
@ -118,7 +118,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Text(
TranslationBase.of(context).useLakumPoints +
" (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})",
" (${widget.model!.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalance.toString() + " " + TranslationBase.of(context).points})",
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)),
),
],
@ -141,7 +141,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.bold,
),
Text(
"${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}",
"${TranslationBase.of(context).sar + " " + widget.model!.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount.toString()}",
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)),
],
),
@ -182,8 +182,8 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
color: Colors.black,
),
...List.generate(
widget.model.cartResponse.shoppingCarts != null ? widget.model.cartResponse.shoppingCarts.length : 0,
(index) => ProductOrderPreviewItem(widget.model.cartResponse.shoppingCarts[index]),
widget.model!.cartResponse.shoppingCarts != null ? widget.model!.cartResponse.shoppingCarts!.length : 0,
(index) => ProductOrderPreviewItem(widget.model!.cartResponse.shoppingCarts![index]),
),
],
),
@ -191,7 +191,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
child: widget.model.cartResponse.subtotal != null
child: widget.model!.cartResponse.subtotal != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -214,7 +214,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotal).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(widget.model!.cartResponse.subtotal)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -238,7 +238,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(widget.model.totalAdditionalShippingCharge).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(widget.model!.totalAdditionalShippingCharge).toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -262,7 +262,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.w500,
),
Texts(
"${TranslationBase.of(context).sar} ${(widget.model.cartResponse.subtotalVatAmount).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(widget.model!.cartResponse.subtotalVatAmount)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.w500,
@ -287,7 +287,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.w500,
),
Texts(
"- ${TranslationBase.of(context).sar} ${(widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}",
"- ${TranslationBase.of(context).sar} ${(widget.model!.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.green,
fontWeight: FontWeight.w500,
@ -316,7 +316,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
),
Texts(
" ${TranslationBase.of(context).sar}"
"${(widget.model.cartResponse.totalAmount - widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount).toStringAsFixed(2)}",
"${(widget.model!.cartResponse.totalAmount! - widget.model!.paymentCheckoutData!.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount!)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
@ -333,7 +333,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
fontWeight: FontWeight.bold,
),
Texts(
" ${TranslationBase.of(context).sar} ${(widget.model.cartResponse.totalAmount).toStringAsFixed(2)}",
" ${TranslationBase.of(context).sar} ${(widget.model!.cartResponse.totalAmount)!.toStringAsFixed(2)}",
fontSize: 14,
color: Colors.black,
fontWeight: FontWeight.bold,
@ -348,7 +348,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
: Container(),
),
SizedBox(
height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
height: widget.model!.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
)
],
),
@ -356,7 +356,7 @@ class _OrderPreviewPageState extends State<OrderPreviewPage> {
),
),
bottomSheet: Container(
height: widget.model.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
height: widget.model!.cartResponse.shoppingCarts != null ? height * 0.10 : 0,
color: Colors.white,
child: PaymentBottomWidget(widget.model),
),

@ -26,7 +26,7 @@ class _LakumWidgetState extends State<LakumWidget> {
@override
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
_pointsController.text = widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString();
_pointsController.text = widget.model.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount.toString();
return Container(
color: Colors.white,
@ -41,9 +41,9 @@ class _LakumWidgetState extends State<LakumWidget> {
child: Checkbox(
activeColor: CustomColors.green,
value: useLakumWidgets,
onChanged: (bool value) {
onChanged: (bool? value) {
setState(() {
useLakumWidgets = value;
useLakumWidgets = value!;
print(useLakumWidgets);
// if (value){
// // isChecked;
@ -62,7 +62,7 @@ class _LakumWidgetState extends State<LakumWidget> {
padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: Text(
TranslationBase.of(context).useLakumPoints +
" (${widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalance.toString() + " " + TranslationBase.of(context).points})",
" (${widget.model.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalance.toString() + " " + TranslationBase.of(context).points})",
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)),
),
],
@ -85,7 +85,7 @@ class _LakumWidgetState extends State<LakumWidget> {
fontWeight: FontWeight.bold,
),
Text(
"${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount.toString()}",
"${TranslationBase.of(context).sar + " " + widget.model.paymentCheckoutData.lacumInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount.toString()}",
style: TextStyle(fontSize: 12.0, fontWeight: FontWeight.w600, letterSpacing: -0.56)
),
],

@ -17,11 +17,11 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class PaymentBottomWidget extends StatelessWidget {
final OrderPreviewViewModel model;
final OrderPreviewViewModel? model;
static bool isChecked = true;
BuildContext context;
MyInAppBrowser browser;
BuildContext? context;
MyInAppBrowser? browser;
PaymentBottomWidget(this.model);
@ -32,7 +32,7 @@ class PaymentBottomWidget extends StatelessWidget {
OrderPreviewViewModel orderPreviewViewModel = Provider.of(context);
return Container(
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
child: orderPreviewViewModel.paymentCheckoutData.cartDataVisible
child: orderPreviewViewModel!.paymentCheckoutData!.cartDataVisible!
? Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -47,13 +47,13 @@ class PaymentBottomWidget extends StatelessWidget {
children: [
isChecked
? Texts(
"${TranslationBase.of(context).sar} ${model.cartResponse.totalAmount}",
"${TranslationBase.of(context).sar} ${model!.cartResponse.totalAmount}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
)
: Texts(
"${TranslationBase.of(context).sar} ${(model.cartResponse.totalAmount).toStringAsFixed(2)}",
"${TranslationBase.of(context).sar} ${(model!.cartResponse.totalAmount)!.toStringAsFixed(2)}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Color(0xff929295),
@ -71,7 +71,7 @@ class PaymentBottomWidget extends StatelessWidget {
),
),
Texts(
"${model.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
"${model!.cartResponse.quantityCount} ${TranslationBase.of(context).items}",
fontSize: 10,
color: Colors.grey,
fontWeight: FontWeight.bold,
@ -99,13 +99,13 @@ class PaymentBottomWidget extends StatelessWidget {
onPressed: (orderPreviewViewModel.paymentCheckoutData.address != null && orderPreviewViewModel.paymentCheckoutData.paymentOption != null)
? () async {
GifLoaderDialogUtils.showMyDialog(context);
await model.makeOrder(projectViewModel.havePrivilege(83));
if (model.state == ViewState.Idle) {
await model!.makeOrder(projectViewModel.havePrivilege(83));
if (model!.state == ViewState.Idle) {
AppToast.showSuccessToast(message: TranslationBase.of(context).compeleteOrderMsg);
GifLoaderDialogUtils.hideDialog(context);
openPayment(model.orderListModel[0], model.authenticatedUserObject.user);
openPayment(model!.orderListModel[0], model!.authenticatedUserObject.user!);
} else {
AppToast.showErrorToast(message: model.error);
AppToast.showErrorToast(message: model!.error);
}
navigateToCartPage();
// Navigator.pop(context);
@ -140,8 +140,8 @@ class PaymentBottomWidget extends StatelessWidget {
) {
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser);
browser!.openPharmacyPaymentBrowser!(order, order.orderTotal, 'ePharmacy Order', order.id!, order!.billingAddress!.email!, order.customValuesXml!,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser!);
}
onBrowserLoadStart(String url) {
@ -150,7 +150,7 @@ class PaymentBottomWidget extends StatelessWidget {
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
if (browser!.isOpened()) browser!.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
@ -158,7 +158,7 @@ class PaymentBottomWidget extends StatelessWidget {
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
if (browser!.isOpened()) browser!.close();
MyInAppBrowser.isPaymentDone = false;
return;
}
@ -166,7 +166,7 @@ class PaymentBottomWidget extends StatelessWidget {
}
navigateToCartPage() {
Navigator.pushAndRemoveUntil(locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 0)), (Route<dynamic> r) => false);
Navigator.pushAndRemoveUntil(locator<NavigationService>().navigatorKey.currentContext!, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: 0)), (Route<dynamic> r) => false);
}
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {

@ -23,14 +23,14 @@ class SelectAddressWidget extends StatefulWidget {
}
class _SelectAddressWidgetState extends State<SelectAddressWidget> {
AddressInfo address;
AddressInfo? address;
_navigateToAddressPage(String identificationNo) {
Navigator.push(context, FadePage(page: PharmacyAddressesPage(orderPreviewViewModel: widget.model,isUpdate: widget.isUpdating,changeMainState: widget.changeMainState,))).then((result) async {
if (result != null) {
GifLoaderDialogUtils.showMyDialog(context);
address = result;
widget.model.paymentCheckoutData.address = Addresses.fromJson(address.toJson());
widget.model.paymentCheckoutData.address = Addresses.fromJson(address!.toJson());
await widget.model.getInformationsByAddress(identificationNo);
await widget.model.getShoppingCart();
widget.changeMainState();
@ -48,13 +48,13 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Widget build(BuildContext context) {
OrderPreviewViewModel model = Provider.of(context);
if (widget.model.paymentCheckoutData.address != null) {
address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address.toJson());
address = AddressInfo.fromJson(widget.model.paymentCheckoutData.address!.toJson());
}
return Container(
color: Colors.white,
child: address == null
? InkWell(
onTap: () => {_navigateToAddressPage(model.user.patientIdentificationNo)},
onTap: () => {_navigateToAddressPage(model.user!.patientIdentificationNo!)},
child: Container(
margin: EdgeInsets.symmetric(vertical: 12, horizontal: 12),
child: Row(
@ -111,7 +111,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
),
),
InkWell(
onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user.patientIdentificationNo)},
onTap: () => {_navigateToAddressPage(model.authenticatedUserObject.user!.patientIdentificationNo!)},
child: Texts(
TranslationBase.of(context).changeAddress,
fontSize: 12,
@ -124,7 +124,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.firstName} ${address.lastName}",
"${address!.firstName} ${address!.lastName!}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
@ -133,7 +133,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Texts(
"${address.address1} ${address.address2} ${address.address2},, ${address.city}, ${address.country} ${address.zipPostalCode}",
"${address!.address1} ${address!.address2} ${address!.address2},, ${address!.city}, ${address!.country} ${address!.zipPostalCode}",
fontSize: 12,
fontWeight: FontWeight.normal,
color: Colors.grey.shade500,
@ -150,7 +150,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
),
),
Texts(
"${address.phoneNumber}",
"${address!.phoneNumber}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.grey,
@ -188,7 +188,7 @@ class _SelectAddressWidgetState extends State<SelectAddressWidget> {
child: Image.asset(
model.paymentCheckoutData.shippingOption == null
? ""
: model.paymentCheckoutData.shippingOption.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
: model.paymentCheckoutData.shippingOption!.shippingRateComputationMethodSystemName == "Shipping.FixedOrByWeight"
? "assets/images/pharmacy_module/payment/LogoParmacyGreen.png"
: "assets/images/pharmacy_module/payment/aramex_shipping_logo.png",
fit: BoxFit.contain,

@ -8,7 +8,7 @@ import 'package:flutter/material.dart';
class SelectPaymentOptionWidget extends StatefulWidget {
final OrderPreviewViewModel model;
final Function changeMainState;
final VoidCallback? changeMainState;
final bool isUpdating;
@ -19,7 +19,7 @@ class SelectPaymentOptionWidget extends StatefulWidget {
}
class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
PaymentOption paymentOption;
PaymentOption? paymentOption;
_navigateToPaymentOption() {
Navigator.push(context, FadePage(page: PaymentMethodSelectPage(model: widget.model,changeMainState:widget.changeMainState,isUpdating: widget.isUpdating,)))
@ -30,7 +30,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
widget.model.paymentCheckoutData.paymentOption =
paymentOption;
}
widget.changeMainState();
widget.changeMainState!();
})
});
}
@ -98,7 +98,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
shape: BoxShape.rectangle,
),
child: Image.asset(
widget.model.getPaymentOptionImage(paymentOption),
widget.model.getPaymentOptionImage(paymentOption!),
width: 30.0,
height: 30.0,
fit: BoxFit.scaleDown,
@ -108,7 +108,7 @@ class _SelectPaymentOptionWidgetState extends State<SelectPaymentOptionWidget> {
child: Container(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 6),
child: Texts(
widget.model.getPaymentOptionName(paymentOption),
widget.model.getPaymentOptionName(paymentOption!),
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,

@ -12,7 +12,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class LakumActivationVidaPage extends StatelessWidget {
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
TextEditingController _identificationNumberController = new TextEditingController();
@override
@ -73,14 +73,14 @@ class LakumActivationVidaPage extends StatelessWidget {
? () {
model.checkLacumAccountActivation(_identificationNumberController.text).then((_) {
if (model.state == ViewState.Idle) {
if (model.lacumInformation.status != "Hold") {
if (model.lacumInformation!.status != "Hold") {
AppToast.showErrorToast(message: TranslationBase.of(context).lakumUnhold);
if (model.lacumInformation.status != "Discontinue") {
if (model.lacumInformation!.status != "Discontinue") {
AppToast.showErrorToast(message: TranslationBase.of(context).lakumDiscontinue);
}
} else {
if (model.lacumInformation.status == "Hold") {
model.makeAccountActivate(projectViewModel.user.patientIdentificationNo).then((value) {
if (model.lacumInformation!.status == "Hold") {
model.makeAccountActivate(projectViewModel!.user!.patientIdentificationNo!).then((value) {
AppToast.showSuccessToast(message: TranslationBase.of(context).lakumSuccess);
Navigator.of(context).pop();
});

@ -29,7 +29,7 @@ class _LakumRegistrationPageState extends State<LakumRegistrationPage> {
List<IdNamePair> languages =[];
IdNamePair selectedLanguage;
IdNamePair? selectedLanguage;
@override
Widget build(BuildContext context) {
@ -162,7 +162,7 @@ class _LakumRegistrationPageState extends State<LakumRegistrationPage> {
enabled: false,
decoration: InputDecoration(
suffixIcon: Icon(Icons.arrow_drop_down),
hintText: selectedLanguage == null ? "${TranslationBase.of(context).prefferedLanguage}" : "${selectedLanguage.name}",
hintText: selectedLanguage == null ? "${TranslationBase.of(context).prefferedLanguage}" : "${selectedLanguage!.name!}",
hintStyle: TextStyle(
fontSize: 16,
color: Colors.black,
@ -194,7 +194,7 @@ class _LakumRegistrationPageState extends State<LakumRegistrationPage> {
context,
FadePage(
page: LakumTermsConditions(
widget.patientIdentificationNo, _firstNameController.text, _lastNameController.text, _mobileNumberController.text, selectedLanguage.id)))
widget.patientIdentificationNo, _firstNameController.text, _lastNameController.text, _mobileNumberController.text, selectedLanguage!.id)))
.then(
(status) => {
if (status == 200) {Navigator.pop(context, "")}

@ -28,16 +28,16 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
TextEditingController _nameController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController();
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
void initState() {
_lakumAccountActivated = widget.lacumGroupInformation
.lakumInquiryInformationObjVersion.accountStatus ==
.lakumInquiryInformationObjVersion!.accountStatus ==
"Active";
super.initState();
_nameController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName;
_phoneController.text = widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber;
_nameController.text = widget.lacumGroupInformation!.lakumInquiryInformationObjVersion!.memberName!;
_phoneController.text = widget.lacumGroupInformation!.lakumInquiryInformationObjVersion!.mobileNumber!;
}
@override
@ -73,8 +73,8 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
_buildSettingScreen(MediaQueryData mediaQuery, LacumViewModel model) {
bool canUpdate = (_nameController.text != "" &&
_phoneController.text != "" &&
(_nameController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName ||
_phoneController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber));
(_nameController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion!.memberName ||
_phoneController.text != widget.lacumGroupInformation.lakumInquiryInformationObjVersion!.mobileNumber));
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -131,9 +131,9 @@ class _LakumSettingPageState extends State<LakumSettingPage> {
value: _lakumAccountActivated,
onChanged: (val) {
if (_lakumAccountActivated) {
model.makeAccountDeactivate(projectViewModel.user.patientIdentificationNo);
model.makeAccountDeactivate(projectViewModel!.user!.patientIdentificationNo!);
} else {
model.makeAccountActivate(projectViewModel.user.patientIdentificationNo);
model.makeAccountActivate(projectViewModel!.user!.patientIdentificationNo!);
}
setState(() {
_lakumAccountActivated = val;

@ -99,7 +99,7 @@ class _LacumTransferPageState extends State<LacumTransferPage> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Texts(
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance}",
"${model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.pointsBalance}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
@ -153,7 +153,7 @@ class _LacumTransferPageState extends State<LacumTransferPage> {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Texts(
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount}",
"${model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount}",
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
@ -196,7 +196,7 @@ class _LacumTransferPageState extends State<LacumTransferPage> {
: () {},
),
),
(model.lacumReceiverInformation != null && model.lacumReceiverInformation.lakumInquiryInformationObjVersion != null)
(model.lacumReceiverInformation != null && model.lacumReceiverInformation!.lakumInquiryInformationObjVersion != null)
? Container(
margin: EdgeInsets.only(top: 8),
child: Column(
@ -211,7 +211,7 @@ class _LacumTransferPageState extends State<LacumTransferPage> {
child: TextField(
enabled: false,
decoration: new InputDecoration(
hintText: "${model.lacumReceiverInformation.lakumInquiryInformationObjVersion.memberName}",
hintText: "${model.lacumReceiverInformation!.lakumInquiryInformationObjVersion!.memberName}",
hintStyle: TextStyle(
fontSize: 16,
color: Colors.grey.shade600,
@ -252,7 +252,7 @@ class _LacumTransferPageState extends State<LacumTransferPage> {
: Container()
],
),
if (model.lacumReceiverInformation != null && model.lacumReceiverInformation.lakumInquiryInformationObjVersion != null)
if (model.lacumReceiverInformation != null && model.lacumReceiverInformation!.lakumInquiryInformationObjVersion != null)
Container(
margin: EdgeInsets.all(8),
child: BorderedButton(

@ -18,7 +18,7 @@ import 'package:provider/provider.dart';
import 'lacum-activitaion-vida-page.dart';
class LakumMainPage extends StatelessWidget {
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
Widget build(BuildContext context) {
@ -27,11 +27,11 @@ class LakumMainPage extends StatelessWidget {
return BaseView<LacumViewModel>(
onModelReady: (model) async {
await model.getLacumData(projectViewModel.user.patientIdentificationNo);
if (model.lacumInformation.yahalaAccountNo == 0 || model.lacumInformation.yahalaAccountNo == null) {
await model.getLacumData(projectViewModel!.user!.patientIdentificationNo!);
if (model.lacumInformation!.yahalaAccountNo == 0 || model.lacumInformation!.yahalaAccountNo == null) {
navigateToLakumRegister(context);
} else {
if (model.lacumInformation.status == "Hold") {
if (model.lacumInformation!.status == "Hold") {
Navigator.pushReplacement(context, FadePage(page: LakumActivationVidaPage()));
}
}
@ -51,7 +51,7 @@ class LakumMainPage extends StatelessWidget {
body: Container(
width: double.infinity,
child: SingleChildScrollView(
child: (model.lacumGroupInformation != null && model.lacumGroupInformation.lakumInquiryInformationObjVersion != null)
child: (model.lacumGroupInformation != null && model.lacumGroupInformation!.lakumInquiryInformationObjVersion != null)
? Column(
children: [
Stack(
@ -73,7 +73,7 @@ class LakumMainPage extends StatelessWidget {
SizedBox(
height: 12,
),
LakumHomeButtons(mediaQuery, model, projectViewModel),
LakumHomeButtons(mediaQuery, model, projectViewModel!),
SizedBox(
height: 12,
),
@ -83,13 +83,13 @@ class LakumMainPage extends StatelessWidget {
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
LacumPointsWidget(mediaQuery, 1, TranslationBase.of(context).balance, model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalanceAmount,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsBalance, null),
LacumPointsWidget(mediaQuery, 1, TranslationBase.of(context).balance, model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.pointsBalanceAmount!,
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.pointsBalance!, []),
SizedBox(
width: 8,
),
LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmount,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPoints, model.lacumGroupInformation.lakumInquiryInformationObjVersion.gainedPointsAmountPerYear),
LacumPointsWidget(mediaQuery, 2, TranslationBase.of(context).gained, model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.gainedPointsAmount!,
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.gainedPoints!, model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.gainedPointsAmountPerYear!),
SizedBox(
width: 8,
),
@ -97,16 +97,16 @@ class LakumMainPage extends StatelessWidget {
mediaQuery,
3,
TranslationBase.of(context).consumed,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount != null
? num.parse(model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmount)
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.consumedPointsAmount! != null
? num.parse(model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.consumedPointsAmount!)
: 0,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPoints,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.consumedPointsAmountPerYear),
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.consumedPoints!,
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.consumedPointsAmountPerYear!),
SizedBox(
width: 8,
),
LacumPointsWidget(mediaQuery, 4, TranslationBase.of(context).transferred, 0, model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPoints,
model.lacumGroupInformation.lakumInquiryInformationObjVersion.transferPointsAmountPerYear),
LacumPointsWidget(mediaQuery, 4, TranslationBase.of(context).transferred, 0, model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.transferPoints!,
model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.transferPointsAmountPerYear!),
],
),
),
@ -153,7 +153,7 @@ class LakumMainPage extends StatelessWidget {
],
),
Texts(
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.expiredPoints} ${TranslationBase.of(context).lakumPoint} ",
"${model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.expiredPoints} ${TranslationBase.of(context).lakumPoint} ",
fontWeight: FontWeight.bold,
fontSize: 14,
),
@ -187,7 +187,7 @@ class LakumMainPage extends StatelessWidget {
],
),
Texts(
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.waitingPoints} ${TranslationBase.of(context).lakumPoint}",
"${model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.waitingPoints} ${TranslationBase.of(context).lakumPoint}",
fontWeight: FontWeight.bold,
fontSize: 14,
),
@ -221,7 +221,7 @@ class LakumMainPage extends StatelessWidget {
],
),
Texts(
"${model.lacumGroupInformation.lakumInquiryInformationObjVersion.pointsWillBeExpired} ${TranslationBase.of(context).lakumPoint}",
"${model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.pointsWillBeExpired} ${TranslationBase.of(context).lakumPoint}",
fontWeight: FontWeight.bold,
fontSize: 14,
),
@ -251,7 +251,7 @@ class LakumMainPage extends StatelessWidget {
}
navigateToLakumRegister(BuildContext context) {
Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel.user.patientIdentificationNo)));
Navigator.pushReplacement(context, FadePage(page: LakumRegistrationPage(projectViewModel!.user!.patientIdentificationNo!)));
}
List<Widget> _buildAppBarICons(BuildContext context, LacumViewModel model) {
@ -260,7 +260,7 @@ class LakumMainPage extends StatelessWidget {
icon: Icon(Icons.settings),
color: Colors.white,
onPressed: () {
Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation, model.lacumGroupInformation))).then((result) => {model.getLacumGroupData(projectViewModel.user.patientIdentificationNo)});
Navigator.push(context, FadePage(page: LakumSettingPage(model.lacumInformation!, model.lacumGroupInformation!))).then((result) => {model.getLacumGroupData(projectViewModel!.user!.patientIdentificationNo!)});
},
),
];
@ -328,8 +328,8 @@ class LakumHomeButtons extends StatelessWidget {
Expanded(
child: InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation, model.lacumGroupInformation))).then((result) {
model.getLacumGroupData(projectViewModel.user.patientIdentificationNo);
Navigator.push(context, FadePage(page: LacumTransferPage(model.lacumInformation!, model.lacumGroupInformation!))).then((result) {
model.getLacumGroupData(projectViewModel.user!.patientIdentificationNo!);
});
},
child: Container(
@ -379,7 +379,7 @@ class LacumPointsWidget extends StatelessWidget {
final String title;
final num riyal;
final num point;
Color titleColor;
Color? titleColor;
final List<PointsAmountPerYear> pointsAmountPerYear;
LacumPointsWidget(this.mediaQuery, this.pointType, this.title, this.riyal, this.point, this.pointsAmountPerYear) {

@ -140,14 +140,14 @@ class _LakumPointsMonthPageState extends State<LakumPointMonthPage> {
SizedBox(
height: 10,
),
LakumPointTableRowWidget(true, "DATE", 0, 0, null, 0),
LakumPointTableRowWidget(true, "DATE", 0, 0, (){}, 0),
...List.generate(
widget.pointsAmountPerMonth.pointsAmountPerday.length,
widget.pointsAmountPerMonth.pointsAmountPerday!.length,
(index) => LakumPointTableRowWidget(
false,
DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(widget.pointsAmountPerMonth.pointsAmountPerday[index].transationDate), "en"),
widget.pointsAmountPerMonth.pointsAmountPerday[index].pointsPerDay,
widget.pointsAmountPerMonth.pointsAmountPerday[index].amountPerDay,
DateUtil.getWeekDayMonthDayYearDateFormatted(DateUtil.convertStringToDate(widget.pointsAmountPerMonth!.pointsAmountPerday![index].transationDate!), "en"),
widget.pointsAmountPerMonth.pointsAmountPerday![index].pointsPerDay!,
widget.pointsAmountPerMonth.pointsAmountPerday![index].amountPerDay!,
() {
setState(() {
if (widget.expandedItemIndex == index) {
@ -162,11 +162,11 @@ class _LakumPointsMonthPageState extends State<LakumPointMonthPage> {
collapsed: Column(
children: [
...List.generate(
widget.pointsAmountPerMonth.pointsAmountPerday[index].pointsDetails.length,
widget.pointsAmountPerMonth.pointsAmountPerday![index].pointsDetails!.length,
(index) => DayPointsDetailWidget(
widget.pointsAmountPerMonth.pointsAmountPerday[index].pointsDetails[index].subTransactionTypeDescription,
widget.pointsAmountPerMonth.pointsAmountPerday[index].pointsDetails[index].purchasePoints,
widget.pointsAmountPerMonth.pointsAmountPerday[index].pointsDetails[index].amount),
widget.pointsAmountPerMonth!.pointsAmountPerday![index].pointsDetails![index].subTransactionTypeDescription!,
widget.pointsAmountPerMonth.pointsAmountPerday![index].pointsDetails![index].purchasePoints!,
widget.pointsAmountPerMonth.pointsAmountPerday![index]!.pointsDetails![index].amount!),
),
],
),

@ -63,22 +63,22 @@ class _LakumPointsYearPageState extends State<LakumPointsYearPage> {
SizedBox(
height: 0,
),
LakumPointTableRowWidget(true, "MONTH", 0, 0, null, 0),
LakumPointTableRowWidget(true, "MONTH", 0, 0, (){}, 0),
...List.generate(
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth.length,
.pointsAmountPerMonth!.length,
(index) => LakumPointTableRowWidget(
false,
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].month.toString(),
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].pointsPerMonth,
widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index].amountPerMonth,
.pointsAmountPerMonth![index].month.toString(),
widget.pointsAmountPerYear![widget.selectedIndexYear]!
.pointsAmountPerMonth![index].pointsPerMonth!,
widget.pointsAmountPerYear[widget.selectedIndexYear]!
.pointsAmountPerMonth![index].amountPerMonth!,
(){
Navigator.push(context,
FadePage(page: LakumPointMonthPage(widget.pointsAmountPerYear[widget.selectedIndexYear]
.pointsAmountPerMonth[index], widget.pointsAmountPerYear[widget.selectedIndexYear].year)));
.pointsAmountPerMonth![index], widget.pointsAmountPerYear![widget.selectedIndexYear!].year!)));
},
index),
),
@ -95,7 +95,7 @@ class LacumPointsYearWidget extends StatelessWidget {
final MediaQueryData mediaQuery;
final bool isSelected;
final PointsAmountPerYear yearPoints;
final Function yearOnTap;
final VoidCallback yearOnTap;
LacumPointsYearWidget(
this.mediaQuery, this.isSelected, this.yearPoints, this.yearOnTap);

@ -12,18 +12,18 @@ import 'package:flutter/material.dart';
import 'cart-page/cart-order-preview.dart';
class PaymentMethodSelectPage extends StatefulWidget {
final OrderPreviewViewModel model;
final OrderPreviewViewModel? model;
final bool isUpdating;
final Function changeMainState;
final VoidCallback? changeMainState;
const PaymentMethodSelectPage({Key key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key);
const PaymentMethodSelectPage({Key? key, this.model, this.isUpdating = false, this.changeMainState}) : super(key: key);
@override
_PaymentMethodSelectPageState createState() => _PaymentMethodSelectPageState();
}
class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
PaymentOption selectedPaymentOption;
PaymentOption? selectedPaymentOption;
@override
Widget build(BuildContext context) {
@ -57,7 +57,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
children: [
PaymentMethodCard(
cardWidth,
selectedPaymentOption,
selectedPaymentOption!,
PaymentOption.meda,
() => {
setState(() {
@ -66,7 +66,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
}),
PaymentMethodCard(
cardWidth,
selectedPaymentOption,
selectedPaymentOption!,
PaymentOption.visa,
() => {
setState(() {
@ -75,17 +75,17 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
}),
PaymentMethodCard(
cardWidth,
selectedPaymentOption,
selectedPaymentOption!,
PaymentOption.mastercard,
() => {
setState(() {
selectedPaymentOption = PaymentOption.mastercard;
})
}),
widget.model.cartResponse.totalAmount > 1000
widget.model!.cartResponse.totalAmount! > 1000
? PaymentMethodCard(
cardWidth,
selectedPaymentOption,
selectedPaymentOption!,
PaymentOption.installments,
() => {
setState(() {
@ -96,7 +96,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
if (Platform.isIOS)
PaymentMethodCard(
cardWidth,
selectedPaymentOption,
selectedPaymentOption!,
PaymentOption.applepay,
() => {
setState(() {
@ -116,9 +116,9 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
TranslationBase.of(context).next,
selectedPaymentOption != null
? () {
widget.model.paymentCheckoutData.paymentOption = selectedPaymentOption;
widget.model!.paymentCheckoutData!.paymentOption = selectedPaymentOption;
if (widget.isUpdating) {
widget.changeMainState();
widget.changeMainState!();
Navigator.pop(context);
return;
} else {
@ -126,7 +126,7 @@ class _PaymentMethodSelectPageState extends State<PaymentMethodSelectPage> {
context,
FadePage(
page: OrderPreviewPage(
model: widget.model,
model: widget.model!,
),
),
);
@ -145,7 +145,7 @@ class PaymentMethodCard extends StatelessWidget {
final double cardWidth;
final PaymentOption selectedPaymentOption;
final PaymentOption paymentOption;
final Function selectMethod;
final VoidCallback selectMethod;
PaymentMethodCard(this.cardWidth, this.selectedPaymentOption, this.paymentOption, this.selectMethod);

@ -19,7 +19,7 @@ var product;
var customerId;
var item;
dynamic languageID;
List wishlistData;
List? wishlistData;
class PharmacyPage extends StatefulWidget {
@override

@ -6,15 +6,15 @@ import 'package:map_launcher/map_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
class AvailabilityInfo extends StatelessWidget {
final ProductDetailViewModel previousModel;
final ProductDetailViewModel? previousModel;
final InAppBrowser browser = new InAppBrowser();
AvailabilityInfo({Key key, this.previousModel}) : super(key: key);
AvailabilityInfo({Key? key, this.previousModel}) : super(key: key);
@override
Widget build(BuildContext context) {
return previousModel.productLocationService.length == 0
return previousModel!.productLocationService.length == 0
? Container(
padding: EdgeInsets.all(15),
alignment: Alignment.center,
@ -28,7 +28,7 @@ class AvailabilityInfo extends StatelessWidget {
physics: ScrollPhysics(),
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemCount: previousModel.productLocationService.length,
itemCount: previousModel!.productLocationService.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.all(8),
@ -39,7 +39,7 @@ class AvailabilityInfo extends StatelessWidget {
children: [
Expanded(
flex: 1,
child: Image.network(previousModel.productLocationService[index].projectImageUrl),
child: Image.network(previousModel!.productLocationService![index].projectImageUrl!),
),
SizedBox(
width: 10,
@ -47,7 +47,7 @@ class AvailabilityInfo extends StatelessWidget {
Expanded(
flex: 4,
child: Text(
previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(),
previousModel!.productLocationService![index].locationDescription! + "\n" + previousModel!.productLocationService[index].cityName.toString(),
style: TextStyle(fontSize: 12),
),
),
@ -59,8 +59,8 @@ class AvailabilityInfo extends StatelessWidget {
onPressed: () async {
await MapLauncher.showMarker(
mapType: MapType.google,
coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)),
title: previousModel.productLocationService[index].locationDescription,
coords: Coords(double.parse(previousModel!.productLocationService[index].latitude!), double.parse(previousModel!.productLocationService[index]!.longitude!)),
title: previousModel!.productLocationService![index].locationDescription!,
);
},
),
@ -71,7 +71,7 @@ class AvailabilityInfo extends StatelessWidget {
icon: Icon(Icons.phone),
color: Colors.red,
onPressed: () {
launch("tel://" + previousModel.productLocationService[index].phoneNumber);
launch("tel://" + previousModel!.productLocationService[index]!.phoneNumber!);
},
),
),

@ -7,9 +7,9 @@ import 'package:provider/provider.dart';
class DetailsInfo extends StatelessWidget {
final PharmacyProduct product;
final PharmacyProduct? product;
const DetailsInfo({Key key, this.product}) : super(key: key);
const DetailsInfo({Key? key, this.product}) : super(key: key);
@override
@ -41,9 +41,9 @@ class DetailsInfo extends StatelessWidget {
margin: EdgeInsets.only(left: 10, right: 10),
child: Text(
projectViewModel.isArabic
? product.fullDescriptionn
: product
.fullDescription ??
? product!.fullDescriptionn!
: product!
.fullDescription! ??
"",
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 14, letterSpacing:-0.56),
),

@ -2,9 +2,9 @@ import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'
import 'package:flutter/material.dart';
class DiscountDescription extends StatelessWidget {
final PharmacyProduct product;
final PharmacyProduct? product;
const DiscountDescription({Key key, this.product}) : super(key: key);
const DiscountDescription({Key? key, this.product}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
@ -20,8 +20,8 @@ class DiscountDescription extends StatelessWidget {
child: Container(
alignment: Alignment.centerRight,
child: Text(
product
.discountDescription,
product!
.discountDescription!,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 17),

@ -23,12 +23,12 @@ class FooterWidget extends StatefulWidget {
final int minQuantity;
final int quantityLimit;
final PharmacyProduct item;
final Function addToCartFunction;
final Function addToShoppingCartFunction;
final ProductDetailViewModel model;
final Function? addToCartFunction;
final Function? addToShoppingCartFunction;
final ProductDetailViewModel? model;
int quantity;
bool isOverQuantity;
int? quantity;
bool? isOverQuantity;
FooterWidget(this.isAvailable, this.maxQuantity, this.minQuantity,
this.quantityLimit, this.item,
@ -136,7 +136,7 @@ class _FooterWidgetState extends State<FooterWidget> {
Container(
width: 100,
decoration: BoxDecoration(
border: Border.all(color: Colors.grey[300]),
border: Border.all(color: Colors.grey[300]!),
color: Colors.white,
),
child: TextField(
@ -151,7 +151,7 @@ class _FooterWidgetState extends State<FooterWidget> {
} else {
setState(() {
widget.quantity = int.parse(text);
if (widget.quantity >=
if (widget.quantity! >=
widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
@ -220,7 +220,7 @@ class _FooterWidgetState extends State<FooterWidget> {
),
],
),
onPressed: widget.isAvailable && !widget.item.isRx
onPressed: widget.isAvailable && !widget.item.isRx!
? () {
setState(() {
if (showUI) {
@ -249,7 +249,7 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) {
login();
} else
await widget.addToCartFunction(
await widget.addToCartFunction!(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
@ -276,7 +276,7 @@ class _FooterWidgetState extends State<FooterWidget> {
if (!authenticatedUserObject.isLogin) {
login();
} else {
await widget.addToShoppingCartFunction(
await widget.addToShoppingCartFunction!(
quantity: widget.quantity,
itemID: widget.item.id,
model: widget.model);
@ -299,15 +299,15 @@ class _FooterWidgetState extends State<FooterWidget> {
}
bool isBuyNowDisable() {
return (!widget.isAvailable && widget.quantity > 0) ||
(widget.quantity > widget.quantityLimit) ||
widget.item.isRx;
return (!widget.isAvailable && widget.quantity! > 0) ||
(widget.quantity! > widget.quantityLimit) ||
widget.item.isRx!;
}
bool isAddToCartDisable() {
return (!widget.isAvailable && widget.quantity > 0) ||
widget.quantity > widget.quantityLimit ||
widget.item.isRx;
return (!widget.isAvailable && widget.quantity! > 0) ||
widget.quantity! > widget.quantityLimit ||
widget.item.isRx!;
}
void setUserValues(value) async {
@ -343,15 +343,16 @@ class _FooterWidgetState extends State<FooterWidget> {
}
}
onChangeValue(int i) {
onChangeValue(int i) {
setState(() {
widget.quantity = i;
if (widget.quantity >= widget.quantityLimit) {
if (widget.quantity! >= widget.quantityLimit) {
widget.isOverQuantity = true;
} else {
widget.isOverQuantity = false;
return widget.quantity;
//return widget.quantity!;
}
});
}
}

@ -1,12 +1,12 @@
import 'package:flutter/material.dart';
class QuantityBox extends StatelessWidget {
final int label;
final bool isSelected;
final Function(int) onTapFunc;
final int? label;
final bool? isSelected;
final Function(int)? onTapFunc;
QuantityBox({
Key key,
Key? key,
this.label,
this.onTapFunc, this.isSelected = false,
}) : super(key: key);
@ -18,7 +18,7 @@ class QuantityBox extends StatelessWidget {
InkWell(
child: Container(
decoration: BoxDecoration(
border: Border.all(color:isSelected?Colors.green: Colors.grey[300]),
border: Border.all(color:isSelected!?Colors.green: Colors.grey[300]!),
color: Colors.white,
),
alignment: Alignment.center,
@ -30,7 +30,7 @@ class QuantityBox extends StatelessWidget {
),
),
onTap:(){
onTapFunc(label);
onTapFunc!(label!)!;
}
),
SizedBox(

@ -22,8 +22,8 @@ import 'discount_description.dart';
import 'footor/footer-widget.dart';
import 'shared/product_details_app_bar.dart';
String itemID;
PharmacyProduct specificationData;
late String itemID;
late PharmacyProduct specificationData;
class ProductDetailPage extends StatefulWidget {
final PharmacyProduct product;
@ -41,7 +41,7 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
bool isDetails = true;
bool isReviews = false;
bool isAvailability = false;
String customerId;
String? customerId;
bool isSelected = true;
bool isOverQuantity = false;
bool isInWishList = false;
@ -120,14 +120,14 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
color: Colors.white,
child: Column(
children: [
if (widget.product.images.isNotEmpty)
if (widget.product.images!.isNotEmpty)
Stack(
children: [
Container(
height: MediaQuery.of(context).size.height * .40,
child: Center(
child: Image.network(
widget.product.images[0].src.trim(),
widget.product.images![0].src!.trim(),
fit: BoxFit.contain,
),
),
@ -364,9 +364,9 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
bottomSheet: model.state == ViewState.Idle || model.state == ViewState.ErrorLocal
? FooterWidget(
model.isStockAvailable,
widget.product.orderMaximumQuantity,
widget.product.orderMinimumQuantity,
model.stockQuantity,
widget.product.orderMaximumQuantity!,
widget.product.orderMinimumQuantity!,
model.stockQuantity!.toInt(),
widget.product,
quantity: quantity,
isOverQuantity: isOverQuantity,
@ -378,36 +378,36 @@ class __ProductDetailPageState extends State<ProductDetailPage> {
));
}
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel model}) async {
addToShoppingCartFunction({quantity, itemID, ProductDetailViewModel? model}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID, context);
await model?.addToCartData(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context);
if (model.state != ViewState.ErrorLocal) Utils.navigateToCartPage();
if (model?.state != ViewState.ErrorLocal) Utils.navigateToCartPage();
}
addToWishlistFunction({itemID, ProductDetailViewModel model}) async {
addToWishlistFunction({itemID, ProductDetailViewModel? model}) async {
isInWishList = true;
await model.addToWishlistData(itemID, context);
await model?.addToWishlistData!(itemID, context);
setState(() {});
}
deleteFromWishlistFunction({itemID, ProductDetailViewModel model}) async {
deleteFromWishlistFunction({itemID, ProductDetailViewModel? model}) async {
isInWishList = false;
await model.deleteWishlistData(itemID, context);
await model?.deleteWishlistData!(itemID, context);
setState(() {});
}
addToCartFunction({
quantity,
itemID,
ProductDetailViewModel model,
ProductDetailViewModel? model,
}) async {
GifLoaderDialogUtils.showMyDialog(context);
await model.addToCartData(quantity, itemID, context);
await model?.addToCartData!(quantity, itemID, context);
GifLoaderDialogUtils.hideDialog(context);
}
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel model}) async {
await model.notifyMe(customerId, itemId);
notifyMeWhenAvailable({itemId, customerId, ProductDetailViewModel? model}) async {
await model?.notifyMe!(customerId, itemId);
}
}

@ -5,9 +5,9 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/borderedButton.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import '../../../../locator.dart';
import 'shared/icon_with_bg.dart';
@ -16,12 +16,12 @@ class ProductNameAndPrice extends StatefulWidget {
BuildContext context;
PharmacyProduct item;
final customerId;
final bool isInWishList;
final Function notifyMeWhenAvailable;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
final bool? isInWishList;
final Function? notifyMeWhenAvailable;
final Function? addToWishlistFunction;
final Function? deleteFromWishlistFunction;
final bool isStockAvailable;
final String stockAvailability;
final String? stockAvailability;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
@ -116,7 +116,7 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
// color: getStatusBackgroundColor(),
// borderRadius: BorderRadius.circular(30.0)),
child: Text(
widget.stockAvailability,
widget.stockAvailability!,
style: TextStyle(fontWeight: FontWeight.w600, fontSize: 11, color: Color(0xffFFFFFF),letterSpacing:-0.44)),
//color: widget.isStockAvailable ? Colors.white : Colors.red,
),
@ -134,25 +134,25 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
icon: Icon(Icons.notifications_active),
color: new Color(0xff2E303A),
onPressed: () {
widget.notifyMeWhenAvailable(
widget!.notifyMeWhenAvailable!(
context, widget.item.id);
},
),
IconButton(
icon: Icon(!widget.isInWishList
icon: Icon(!widget.isInWishList!
? Icons.favorite_border
: Icons.favorite),
color: !widget.isInWishList
color: !widget.isInWishList!
? Color(0xff2E303A)
: Color(0xffD02127),
onPressed: () async {
{
if (widget.customerId != null) {
if (!widget.isInWishList) {
if (!widget.isInWishList!) {
await widget
.addToWishlistFunction(widget.item.id);
.addToWishlistFunction!(widget.item.id);
} else {
await widget.deleteFromWishlistFunction(
await widget.deleteFromWishlistFunction!(
widget.item.id);
}
} else {
@ -166,20 +166,20 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
),
)
: IconButton(
icon: Icon(!widget.isInWishList
icon: Icon(!widget.isInWishList!
? Icons.favorite_border
: Icons.favorite),
color: !widget.isInWishList
color: !widget.isInWishList!
? Color(0xff2E303A)
: Color(0xffD02127),
onPressed: () async {
{
if (widget.customerId != null) {
if (!widget.isInWishList) {
if (!widget.isInWishList!) {
await widget
.addToWishlistFunction(widget.item.id);
.addToWishlistFunction!(widget.item.id);
} else {
await widget.deleteFromWishlistFunction(
await widget.deleteFromWishlistFunction!(
widget.item.id);
}
} else {
@ -287,16 +287,35 @@ class _ProductNameAndPriceState extends State<ProductNameAndPrice> {
alignment: Alignment.bottomLeft,
child: Row(
children: [
RatingBar.readOnly(
// RatingBar.readOnly(
// initialRating: double.parse(
// widget.item.approvedRatingSum.toString()),
// size: 18.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
RatingBar(
initialRating: double.parse(
widget.item.approvedRatingSum.toString()),
size: 18.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
widget.item.approvedRatingSum.toString()),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
),
SizedBox(
width: 5,

@ -14,23 +14,23 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class RecommendedProducts extends StatefulWidget {
final PharmacyProduct product;
final String customerId;
final ProductDetailViewModel productDetailViewModel;
final PharmacyProduct? product;
final String? customerId;
final ProductDetailViewModel? productDetailViewModel;
final bool isOverQuantity;
final bool isInWishList;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
final VoidCallback? addToWishlistFunction;
final VoidCallback? deleteFromWishlistFunction;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
RecommendedProducts(
{Key key,
{Key? key,
this.product,
this.productDetailViewModel,
this.customerId,
@ -72,7 +72,7 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
// margin: EdgeInsets.symmetric(horizontal: 6, vertical: 4),
child: BaseView<PharmacyModuleViewModel>(
onModelReady: (model) =>
model.getRecommendedProducts(widget.product.id),
model.getRecommendedProducts(widget.product!.id!),
builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true,
baseViewModel: model,
@ -83,7 +83,7 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
Colors.grey[500]!,
),
),
),
@ -115,7 +115,7 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
elevation: 2,
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.grey[300], width: 2),
color: Colors.grey[300]!, width: 2),
borderRadius: BorderRadius.circular(10),
),
margin: EdgeInsets.symmetric(
@ -148,14 +148,14 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
) {
if (!widget.isInWishList && model.recommendedProductList[index].isinwishlist != true) {
GifLoaderDialogUtils.showMyDialog(context);
await widget.addToWishlistFunction(model.recommendedProductList[index].id,
widget.addToWishlistFunction!(
);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
model.recommendedProductList[index].isinwishlist = true;});
} else {
GifLoaderDialogUtils.showMyDialog(context);
await widget.deleteFromWishlistFunction(model.recommendedProductList[index].id,
widget.deleteFromWishlistFunction!(
);
GifLoaderDialogUtils.hideDialog(context);
setState(() {
@ -184,14 +184,14 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
model
.recommendedProductList[
index]
.images
.images!
.length >
0)
? Image.network(
model
.recommendedProductList[
index]
.images[0]
.images![0]
.src
.toString(),
fit: BoxFit.cover,
@ -291,22 +291,45 @@ class _RecommendedProductsState extends State<RecommendedProducts> {
EdgeInsets.only(right: 10),
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: model
.recommendedProductList[
index]
.approvedRatingSum
.toDouble(),
size: 13.0,
filledColor:
Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon:
Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
child: RatingBar(
initialRating:model
.recommendedProductList[
index]
.approvedRatingSum
.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
// RatingBar.readOnly(
// initialRating: model
// .recommendedProductList[
// index]
// .approvedRatingSum
// .toDouble(),
// size: 13.0,
// filledColor:
// Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon:
// Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
),
),
Texts(

@ -3,24 +3,24 @@ import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_deta
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class ReviewsInfo extends StatelessWidget {
final PharmacyProduct product;
final ProductDetailViewModel previousModel;
final PharmacyProduct? product;
final ProductDetailViewModel? previousModel;
const ReviewsInfo({Key key, this.product, this.previousModel})
const ReviewsInfo({Key? key, this.product, this.previousModel})
: super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return previousModel.productDetailService.length != 0 &&
previousModel.productDetailService[0].reviews.length != 0
return previousModel?.productDetailService.length != 0 &&
previousModel?.productDetailService[0].reviews!.length != 0
? ListView.builder(
physics: ScrollPhysics(),
itemCount: previousModel.productDetailService[0].reviews.length,
itemCount: previousModel?.productDetailService[0].reviews!.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
@ -35,10 +35,10 @@ class ReviewsInfo extends StatelessWidget {
children: [
Expanded(
child: Container(
child: Text(previousModel.productDetailService[0].reviews[index].customer.firstName != null
&& previousModel.productDetailService[0].reviews[index].customer.firstName != null
? previousModel.productDetailService[0].reviews[index].customer.firstName.toString() + " "
+ previousModel.productDetailService[0].reviews[index].customer.lastName.toString()
child: Text(previousModel!.productDetailService[0].reviews![index].customer!.firstName != null
&& previousModel!.productDetailService[0].reviews![index].customer!.firstName != null
? previousModel!.productDetailService[0].reviews![index].customer!.firstName.toString() + " "
+ previousModel!.productDetailService[0].reviews![index].customer!.lastName.toString()
:"",
// previousModel.productDetailService[0]
// .reviews[index].customerId
@ -55,46 +55,70 @@ class ReviewsInfo extends StatelessWidget {
child: projectViewModel.isArabic?
Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
initialRating: previousModel
.productDetailService[0].reviews[index].rating
.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
): Align(
alignment: Alignment.topRight,
child: RatingBar.readOnly(
initialRating: previousModel
.productDetailService[0].reviews[index].rating
.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),
child:
// RatingBar.readOnly(
// initialRating: previousModel
// .productDetailService[0].reviews[index].rating
// .toDouble(),
// size: 15.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
RatingBar(
initialRating: previousModel!
.productDetailService[0]!.reviews![index]!.rating!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
): RatingBar(
initialRating: previousModel!
.productDetailService[0]!.reviews![index]!.rating!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
))])
,
),
],
),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text(
previousModel
.productDetailService[0].reviews[index].replyText,
previousModel!
.productDetailService[0].reviews![index].replyText,
style: TextStyle(fontSize: 20),
),
),
@ -103,9 +127,8 @@ class ReviewsInfo extends StatelessWidget {
height: 50,
),
Divider(height: 1, color: Colors.grey),
],
),
);
]));
},
)
: Container(

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
class CustomDivider extends StatelessWidget {
const CustomDivider({
Key key,
Key? key,
this.color,
}) : super(key: key);
final Color color;
final Color? color;
@override
Widget build(BuildContext context) {

@ -3,13 +3,13 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class IconWithBg extends StatelessWidget {
final IconData icon;
final Color color;
final Function onPress;
final IconData? icon;
final Color? color;
final VoidCallback? onPress;
final bool hasPadding;
IconWithBg(
{Key key, this.icon, this.color, this.onPress, this.hasPadding = false})
{Key? key, this.icon, this.color, this.onPress, this.hasPadding = false})
: super(key: key);
@override
@ -35,7 +35,7 @@ class IconWithBg extends StatelessWidget {
),
color: color,
onPressed: () async {
onPress();
onPress!();
},
),
),

@ -16,18 +16,18 @@ import '../../../../../locator.dart';
import '../../../compare-list.dart';
import 'icon_with_bg.dart';
class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
final PharmacyProduct product;
class ProductAppBar extends StatelessWidget implements PreferredSizeWidget {
final PharmacyProduct? product;
final ProductDetailViewModel model;
final Function addToWishlistFunction;
final Function deleteFromWishlistFunction;
final int quantity;
final bool isInWishList;
final Function addToCartFunction;
final ProductDetailViewModel? model;
final VoidCallback? addToWishlistFunction;
final VoidCallback? deleteFromWishlistFunction;
final int? quantity;
final bool? isInWishList;
final Function? addToCartFunction;
ProductAppBar(
{Key key,
{Key? key,
this.product,
this.model,
this.addToWishlistFunction,
@ -81,7 +81,7 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
Navigator.pushAndRemoveUntil(
locator<NavigationService>()
.navigatorKey
.currentContext,
.currentContext!,
MaterialPageRoute(
builder: (context) =>
LandingPagePharmacy(currentTab: 3)),
@ -151,19 +151,19 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
return Container(
child: new Wrap(
children: <Widget>[
if (product.stockAvailability != 'Out of stock' && product.isRx != true)
if (product!.stockAvailability! != 'Out of stock' && product!.isRx! != true)
new ListTile(
leading: Icon(Icons.shopping_cart),
title: Text(
TranslationBase.of(context).addToCart,
),
onTap: () async {
if (quantity > 0) {
if (quantity! > 0) {
{
await addToCartFunction(
quantity: quantity,
itemID: itemID,
model: model);
addToCartFunction!(
quantity: quantity!,
itemID: itemID!,
model: model!);
Navigator.of(context).pop();
}
@ -176,19 +176,19 @@ class ProductAppBar extends StatelessWidget with PreferredSizeWidget {
}),
ListTile(
leading: Icon(
!isInWishList ? Icons.favorite_border : Icons.favorite,
color: !isInWishList ? Colors.white : Colors.red[800],
!isInWishList! ? Icons.favorite_border : Icons.favorite,
color: !isInWishList! ? Colors.white : Colors.red[800],
),
title: Text(
isInWishList
isInWishList!
? TranslationBase.of(context).removeFromWishlist
: TranslationBase.of(context).addToWishlist,
),
onTap: () async {
if (isInWishList)
await deleteFromWishlistFunction();
if (isInWishList!)
deleteFromWishlistFunction!();
else
await addToWishlistFunction();
addToWishlistFunction!();
Navigator.of(context).pop();
}),
ListTile(

@ -12,17 +12,17 @@ var product;
var customerId;
class RecommendedProductPage extends StatefulWidget {
String productId ;
String? productId ;
RecommendedProductPage({this.productId});
@override
_RecommendedProductPageState createState() => _RecommendedProductPageState(productId: productId);
_RecommendedProductPageState createState() => _RecommendedProductPageState(productId: productId!);
}
class _RecommendedProductPageState extends State<RecommendedProductPage>
with SingleTickerProviderStateMixin {
List<RecommendedProductModel> recommendedProductList = [];
String productId;
late String? productId;
_RecommendedProductPageState({this.productId});
String id = "";
bool styleOne = true;

@ -26,8 +26,8 @@ class _SearchBrandsPageState extends State<SearchBrandsPage> {
Widget build(BuildContext context) {
ProjectViewModel projectProvider = Provider.of(context);
return BaseView<BrandsViewModel>(
onModelReady: (model) => model.searchProducts(),
builder: (BuildContext context, model, Widget child) =>
onModelReady: (model) => model!.searchProducts(productName: ''),
builder: (BuildContext context, model, Widget? child) =>
PharmacyAppScaffold(
appBarTitle: TranslationBase.of(context).search,
isBottomBar: false,
@ -117,9 +117,9 @@ class _SearchBrandsPageState extends State<SearchBrandsPage> {
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Text( projectProvider.isArabic
? model.searchList[index].namen
:model.searchList[index].name,
child: Text( projectProvider.isArabic!
? model.searchList[index].namen!
:model.searchList[index].name!,
style: TextStyle(fontSize: 20),
),
),
@ -142,7 +142,7 @@ class _SearchBrandsPageState extends State<SearchBrandsPage> {
searchMedicine(model, BuildContext context) {
Utils.hideKeyboard(context);
if (_formKey.currentState.validate())
if (_formKey.currentState!.validate())
model.searchProducts(productName: textController.text);
}
}

@ -10,10 +10,10 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class ProductOrderItem extends StatefulWidget {
final ShoppingCart item;
final VoidCallback changeCartItems;
final VoidCallback deleteCartItems;
final OrderPreviewViewModel model;
final ShoppingCart? item;
final VoidCallback? changeCartItems;
final VoidCallback? deleteCartItems;
final OrderPreviewViewModel? model;
ProductOrderItem(
{this.item, this.changeCartItems, this.deleteCartItems, this.model});
@ -33,16 +33,16 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
@override
Widget build(BuildContext context) {
_quantityController.text = "${widget.item.quantity}";
_quantityController.text = "${widget.item!.quantity!}";
_totalPrice =
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
"${(widget.item!.product!.price! * widget.item!.quantity!).toStringAsFixed(2)}";
ProjectViewModel projectProvider = Provider.of(context);
return Column(
children: [
ListTile(
leading: InkWell(
onTap: () => {widget.deleteCartItems()},
onTap: () => {widget.deleteCartItems!()},
child: Icon(
FontAwesomeIcons.trashAlt,
size: 15,
@ -55,10 +55,10 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
(widget.item.product.images != null &&
widget.item.product.images.length > 0)
(widget.item!.product!.images! != null &&
widget.item!.product!.images!.length > 0)
? Image.network(
widget.item.product.images[0].src,
widget!.item!.product!.images![0]!.src!,
fit: BoxFit.cover,
height: 80,
)
@ -79,8 +79,8 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
Container(
child: Texts(
projectProvider.isArabic
? widget.item.product.namen
: "${widget.item.product.name}",
? widget.item!.product!.namen!
: "${widget.item!.product!.name!}",
regular: true,
textAlign: TextAlign.justify,
fontSize: 12,
@ -90,7 +90,7 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
),
Container(
child: Texts(
"${(widget.item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}",
"${(widget.item!.product!.price!).toStringAsFixed(2)} ${projectProvider.isArabic ? widget.item!.currencyn! : widget.item!.currency}",
fontSize: 14,
fontWeight: FontWeight.bold,
),
@ -135,13 +135,13 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
setState(() {
var value = int.tryParse(text);
if (value == null) {
widget.item.quantity = 0;
widget!.item!.quantity = 0;
} else {
widget.item.quantity =
widget.item!.quantity =
int.parse(text);
}
_totalPrice =
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
"${(widget.item!.product!.price! * widget.item!.quantity!).toStringAsFixed(2)}";
});
},
)),
@ -176,16 +176,16 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
fontSize: 12,
),
Texts(
"$_totalPrice ${projectProvider.isArabic ? widget.item.currencyn : widget.item.currency}",
"$_totalPrice ${projectProvider.isArabic ? widget.item!.currencyn! : widget.item!.currency!}",
fontSize: 12,
fontWeight: FontWeight.bold,
),
widget.item.product.stockQuantity == 0
widget.item!.product!.stockQuantity == 0
? Texts(
projectProvider.isArabic
? widget.item.product
.stockAvailabilityn
: widget.item.product
? widget.item!.product!
.stockAvailabilityn!
: widget.item!.product!
.stockAvailability,
fontWeight: FontWeight.normal,
fontSize: 13,
@ -224,13 +224,13 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
switch (operation) {
case Operation.inc:
{
newValue = widget.item.quantity + 1;
newValue = widget.item!.quantity! + 1;
}
break;
case Operation.dec:
{
newValue = widget.item.quantity - 1;
newValue = widget.item!.quantity! - 1;
}
break;
default:
@ -240,19 +240,19 @@ class _ProductOrderItemState extends State<ProductOrderItem> {
break;
}
if (newValue > 0) {
widget.item.quantity = newValue;
await widget.changeCartItems();
if (widget.model.state == ViewState.ErrorLocal) {
widget.item!.quantity = newValue;
widget!.changeCartItems!();
if (widget.model!.state == ViewState.ErrorLocal) {
if (operation == Operation.dec) {
newValue = widget.item.quantity + 1;
newValue = widget.item!.quantity! + 1;
} else {
newValue = widget.item.quantity - 1;
newValue = widget.item!.quantity! - 1;
}
widget.item.quantity = newValue;
widget.item!.quantity = newValue;
}
_quantityController.text = "${widget.item.quantity}";
_quantityController.text = "${widget.item!.quantity!}";
_totalPrice =
"${(widget.item.product.price * widget.item.quantity).toStringAsFixed(2)}";
"${(widget.item!.product!.price! * widget.item!.quantity!).toStringAsFixed(2)}";
}
});
}

@ -22,9 +22,9 @@ class ProductOrderPreviewItem extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
(item.product.images != null && item.product.images.length > 0)
(item.product!.images != null && item.product!.images!.length > 0)
? Image.network(
item.product.images[0].src,
item.product!.images![0].src!,
fit: BoxFit.cover,
height: 80,
)
@ -44,8 +44,8 @@ class ProductOrderPreviewItem extends StatelessWidget {
Container(
child: Texts(
projectProvider.isArabic
? item.product.namen
: item.product.name,
? item.product!.namen
: item.product!.name,
regular: true,
textAlign: TextAlign.justify,
fontSize: 12,
@ -55,7 +55,7 @@ class ProductOrderPreviewItem extends StatelessWidget {
),
Container(
child: Texts(
"${(item.product.price).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
"${(item.product!.price)!.toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
fontSize: 14,
fontWeight: FontWeight.bold,
),
@ -83,7 +83,7 @@ class ProductOrderPreviewItem extends StatelessWidget {
child: Container(
alignment: Alignment.centerRight,
child: Texts(
"${(item.product.price * item.quantity).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
"${(item.product!.price! * item.quantity!).toStringAsFixed(2)} ${projectProvider.isArabic ? item.currencyn : item.currency}",
fontSize: 14,
fontWeight: FontWeight.bold,
),

@ -12,9 +12,9 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
import 'dart:math' as math;
@ -160,11 +160,11 @@ class ProductTileItem extends StatelessWidget {
),
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center,
child: (item.images != null && item.images.length > 0)
child: (item.images != null && item.images!.length > 0)
? Padding(
padding: EdgeInsets.all(12.0),
child: Image.network(
item.images[0].src,
item.images![0].src!,
fit: BoxFit.cover,
height: itemHeight / 2,
),
@ -274,15 +274,36 @@ class ProductTileItem extends StatelessWidget {
child: Row(
children: [
// Expanded(
RatingBar.readOnly(
initialRating: item.approvedRatingSum.toDouble(),
size: 13.0,
filledColor: Color(0XFFD02127),
emptyColor: Color(0XFFD02127),
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star_border,
// RatingBar.readOnly(
// initialRating: item.approvedRatingSum.toDouble(),
// size: 13.0,
// filledColor: Color(0XFFD02127),
// emptyColor: Color(0XFFD02127),
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star_border,
// ),
//
//
RatingBar(
initialRating: item.approvedRatingSum!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
),
Texts(
"(${item.approvedTotalReviews})",

@ -45,7 +45,7 @@ class BestSellerWidget extends StatelessWidget {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
Colors.grey[500]!,
),
),
),

@ -35,7 +35,7 @@ class GridViewCard extends StatelessWidget {
text,
color: Colors.white,
bold: true,
fontSize: SizeConfig.textMultiplier * 1.3,
fontSize: SizeConfig.textMultiplier! * 1.3,
),
],
),

@ -10,7 +10,7 @@ import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart';
class MostViewedWidget extends StatelessWidget {
const MostViewedWidget({Key key}) : super(key: key);
const MostViewedWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -47,7 +47,7 @@ class MostViewedWidget extends StatelessWidget {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
Colors.grey[500]!,
),
),
),

@ -11,8 +11,9 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:provider/provider.dart';
import 'package:rating_bar/rating_bar.dart';
class PrescriptionsWidget extends StatelessWidget {
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
@ -81,7 +82,7 @@ class PrescriptionsWidget extends StatelessWidget {
radius: 30,
backgroundColor: Colors.transparent,
child: Image.network(
model.prescriptionsList[index].doctorImageURL,
model.prescriptionsList[index].doctorImageURL!,
width: 50,
height: 50,
),
@ -160,7 +161,27 @@ class PrescriptionsWidget extends StatelessWidget {
Row(children: <Widget>[
Container(
margin: EdgeInsets.only(left: 5),
child: RatingBar.readOnly(
child:
RatingBar(
initialRating: model.prescriptionsList[index].actualDoctorRate!.toDouble(),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
/* RatingBar.readOnly(
initialRating: model.prescriptionsList[index].actualDoctorRate.toDouble(),
size: 15.0,
filledColor: Colors.yellow[700],
@ -169,7 +190,7 @@ class PrescriptionsWidget extends StatelessWidget {
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
),*/
),
SizedBox(
width: 130.0,

@ -49,7 +49,7 @@ class RecentlyViewedWidget extends StatelessWidget {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
Colors.grey[500]!,
),
),
),

@ -40,7 +40,7 @@ class ShopByBrandWidget extends StatelessWidget {
child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
Colors.grey[500]!,
),
),
),

@ -69,13 +69,13 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName,
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.memberName,
fontSize: 13,
fontWeight: FontWeight.bold,
color: Colors.black,
),
Texts(
"${widget.model.lacumInformation.yahalaAccountNo}",
"${widget.model.lacumInformation!.yahalaAccountNo}",
fontSize: 13,
fontWeight: FontWeight.normal,
color: Colors.black,
@ -83,23 +83,23 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
],
),
BorderedButton(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active"
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.accountStatus == "Active"
? TranslationBase.of(context).active
: TranslationBase.of(context).inactive,
textColor: widget.model.lacumInformation
textColor: widget.model.lacumInformation!
.accountStatus ==
1
? Colors.green
: Colors.red,
hasBorder: true,
borderColor: widget.model.lacumInformation
borderColor: widget.model.lacumInformation!
.accountStatus ==
1
? Colors.green
: Colors.red,
radius: 16,
rPadding: 16,
icon: widget.model.lacumInformation
icon: widget.model.lacumInformation!
.accountStatus ==
1
? Icon(
@ -132,7 +132,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumInformation
widget.model.lacumInformation!
.identificationNo,
fontSize: 13,
fontWeight: FontWeight.normal,
@ -175,7 +175,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber,
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.mobileNumber,
fontSize: 13,
fontWeight: FontWeight.normal,
color: Colors.black,
@ -192,7 +192,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumInformation.prefLang ==
widget.model.lacumInformation!.prefLang ==
"2"
? TranslationBase.of(context).lanEnglish
: TranslationBase.of(context).lanArabic,

@ -69,13 +69,13 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.memberName,
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.memberName,
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.black,
),
Texts(
"${widget.model.lacumInformation.yahalaAccountNo}",
"${widget.model.lacumInformation!.yahalaAccountNo}",
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.black,
@ -83,23 +83,23 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
],
),
BorderedButton(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.accountStatus == "Active"
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.accountStatus == "Active"
? TranslationBase.of(context).active
: TranslationBase.of(context).inactive,
textColor: widget.model.lacumInformation
.accountStatus ==
textColor: widget.model.lacumInformation!
.accountStatus! ==
1
? Colors.green
: Colors.red,
hasBorder: true,
borderColor: widget.model.lacumInformation
borderColor: widget.model.lacumInformation!
.accountStatus ==
1
? Colors.green
: Colors.red,
radius: 16,
rPadding: 16,
icon: widget.model.lacumInformation
icon: widget.model.lacumInformation!
.accountStatus ==
1
? Icon(
@ -132,7 +132,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumInformation
widget.model.lacumInformation!
.identificationNo,
fontSize: 16,
fontWeight: FontWeight.normal,
@ -175,7 +175,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumGroupInformation.lakumInquiryInformationObjVersion.mobileNumber,
widget.model.lacumGroupInformation!.lakumInquiryInformationObjVersion!.mobileNumber,
fontSize: 16,
fontWeight: FontWeight.normal,
color: Colors.black,
@ -192,7 +192,7 @@ class _LakumBannerWidgetState extends State<LakumBannerWidget> {
color: Colors.black,
),
Texts(
widget.model.lacumInformation.prefLang ==
widget.model.lacumInformation!.prefLang ==
"1"
? TranslationBase.of(context).lanEnglish
: TranslationBase.of(context).lanArabic,

@ -7,9 +7,9 @@ class LakumPointTableRowWidget extends StatefulWidget {
final String rowTitle;
final num points;
final num riyal;
final Function onTap;
final VoidCallback onTap;
final int rowIndex;
final Widget collapsed;
final Widget? collapsed;
final bool expandFlag;
LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points,

@ -7,9 +7,9 @@ class LakumPointTableRowWidget extends StatefulWidget {
final String rowTitle;
final double points;
final double riyal;
final Function onTap;
final VoidCallback? onTap;
final int rowIndex;
final Widget collapsed;
final Widget? collapsed;
final bool expandFlag;
LakumPointTableRowWidget(this.isTableTitle, this.rowTitle, this.points,
@ -25,7 +25,7 @@ class _LakumPointTableRowWidgetState extends State<LakumPointTableRowWidget> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: widget.onTap,
onTap: widget.onTap!,
child: Column(
children: <Widget>[
Column(

@ -42,12 +42,12 @@ class ManufacturerItem extends StatelessWidget {
? Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 10),
alignment: Alignment.topCenter,
child: AppText(item.name, fontWeight: FontWeight.w500,fontSize: 14,),
child: AppText(item.name!, fontWeight: FontWeight.w500,fontSize: 14,),
)
: Padding(
padding: EdgeInsets.symmetric(horizontal: 8),
child: Image.network(
item.image.src,
item.image!.src!,
fit: BoxFit.cover,
),
),

@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
class WishlistPage extends StatelessWidget {
const WishlistPage({Key key}) : super(key: key);
const WishlistPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {

@ -16,10 +16,10 @@ dynamic languageID;
class OrderPage extends StatefulWidget {
// orderList({this.customerId, this.pageId});
String customerID;
String customerGUID;
String? customerID;
String? customerGUID;
OrderPage({@required this.customerID, this.customerGUID});
OrderPage({required this.customerID, this.customerGUID});
@override
_OrderPageState createState() => _OrderPageState();
@ -38,7 +38,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
List<Orders> cancelledOrderList = [];
List<Orders> pendingOrderList = [];
TabController _tabController;
TabController? _tabController;
// AppSharedPreferences sharedPref = AppSharedPreferences();
getLanguageID() async {
@ -399,7 +399,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
processingOrderList.add(model.orders[i]);
}
}
_tabController.index = 1;
_tabController!.index = 1;
return Container(
width: MediaQuery.of(context).size.width,
child: processingOrderList.length != 0
@ -531,7 +531,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.grey[500],
color: Colors.grey[500]!,
style: BorderStyle.solid,
width: 5.0,
),
@ -862,7 +862,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
pendingOrderList.add(model.orders[i]);
}
}
_tabController.animateTo(2);
_tabController!.animateTo(2);
return Container(
child: pendingOrderList.length != 0
? SingleChildScrollView(
@ -995,7 +995,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
left: 13.0, right: 13.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.orange[300],
color: Colors.orange[300]!,
style: BorderStyle.solid,
width: 5.0,
),
@ -1271,7 +1271,7 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
left: 10.0, right: 10.0),
decoration: BoxDecoration(
border: Border.all(
color: Colors.red[900],
color: Colors.red[900]!,
style: BorderStyle.solid,
width: 5.0,
),
@ -1415,5 +1415,5 @@ class _OrderPageState extends State<OrderPage> with SingleTickerProviderStateMix
class Test<T extends String> {
static const values = {"1": 1, "2": 2, "3": 3};
int operator [](String key) => values[key];
int operator [](String key) => values[key]!;
}

@ -24,7 +24,7 @@ dynamic languageID;
class OrderDetailsPage extends StatefulWidget {
Orders orderModel;
OrderDetailsPage({@required this.orderModel});
OrderDetailsPage({required this.orderModel});
// Orders orderModel;
// OrderModel orderModelDetails;
@ -40,7 +40,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
}
// AppSharedPreferences sharedPref = AppSharedPreferences();
String customerId;
late String customerId;
List<OrderDetailModel> ordersList = [];
List<OrderDetailModel> cancelledOrderList = [];
@ -52,9 +52,9 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
var isActiveDelivery = false;
var dataIsCancel;
var dataIsRefund;
BuildContext context;
late BuildContext context;
MyInAppBrowser browser;
MyInAppBrowser? browser;
@override
void initState() {
@ -63,7 +63,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
// print(widget.orderModel.orderItems.length);
getCancelOrder(widget.orderModel.id);
print("ID is" + widget.orderModel.id);
print("ID is" + widget.orderModel.id!);
// cancelOrderDetail(order)
}
@ -76,7 +76,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
onModelReady: (model) {
model.getOrderDetails(widget.orderModel.id, widget.orderModel.orderGuid).then((value) {
setState(() {
isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID.isNotEmpty));
isActiveDelivery = (value.orderStatusId == 995 && (value.driverID != null && value.driverID!.isNotEmpty));
});
});
},
@ -121,7 +121,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
padding: EdgeInsets.only(left: 11.0, right: 11.0),
decoration: BoxDecoration(
border: Border.all(
color: getStatusBackgroundColor(),
color: getStatusBackgroundColor()!,
style: BorderStyle.solid,
width: 5.0,
),
@ -164,7 +164,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
margin: EdgeInsets.only(left: 10.0, top: 13.0),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
"${model.orderListModel[0].shippingAddress.firstName} ${model.orderListModel[0].shippingAddress.lastName}",
"${model.orderListModel[0].shippingAddress!.firstName} ${model.orderListModel[0].shippingAddress!.lastName}",
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
@ -176,7 +176,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address1.toString(),
model.orderListModel[0].shippingAddress!.address1.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
@ -189,11 +189,11 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
margin: EdgeInsets.fromLTRB(10.0, 5.0, 1.0, 5.0),
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
Text(
model.orderListModel[0].shippingAddress.address2.toString() +
model.orderListModel[0].shippingAddress!.address2.toString() +
' ' +
model.orderListModel[0].shippingAddress.country.toString() +
model.orderListModel[0].shippingAddress!.country.toString() +
' ' +
model.orderListModel[0].shippingAddress.zipPostalCode.toString(),
model.orderListModel[0].shippingAddress!.zipPostalCode.toString(),
style: TextStyle(
fontSize: 10.0,
fontWeight: FontWeight.bold,
@ -215,7 +215,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
Container(
margin: EdgeInsets.only(top: 5.0, bottom: 5.0),
child: Text(
model.orderListModel[0].shippingAddress.phoneNumber.toString(),
model.orderListModel[0].shippingAddress!.phoneNumber.toString(),
style: TextStyle(
fontSize: 15.0,
),
@ -339,24 +339,24 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: ScrollPhysics(),
itemCount: model.orderListModel[0].orderItems.length,
itemCount: model.orderListModel[0].orderItems!.length,
itemBuilder: (context, index) {
return Container(
child: productTile(
productName: projectViewModel.isArabic ?
model.orderListModel[0].orderItems[index].product.namen.toString()
:model.orderListModel[0].orderItems[index].product.name.toString(),
productPrice: model.orderListModel[0].orderItems[index].product.price.toString(),
productRate: model.orderListModel[0].orderItems[index].product.approvedRatingSum.toDouble(),
productReviews: model.orderListModel[0].orderItems[index].product.approvedTotalReviews,
totalPrice: "${(model.orderListModel[0].orderItems[index].product.price * model.orderListModel[0].orderItems[index].quantity).toStringAsFixed(2)}",
qyt: model.orderListModel[0].orderItems[index].quantity.toString(),
model.orderListModel[0].orderItems![index].product!.namen.toString()
:model.orderListModel[0].orderItems![index].product!.name.toString(),
productPrice: model.orderListModel[0].orderItems![index!].product!.price!.toString(),
productRate: model.orderListModel[0].orderItems![index].product!.approvedRatingSum!.toDouble(),
productReviews: model.orderListModel[0].orderItems![index].product!.approvedTotalReviews,
totalPrice: "${(model.orderListModel[0].orderItems![index].product!.price! * model.orderListModel![0].orderItems![index].quantity!).toStringAsFixed(2)}",
qyt: model.orderListModel[0].orderItems![index].quantity.toString(),
isOrderDetails: true,
imgs: model.orderListModel[0].orderItems[index].product.images != null && model.orderListModel[0].orderItems[index].product.images.length != 0
? model.orderListModel[0].orderItems[index].product.images[0].src.toString()
imgs: model.orderListModel[0].orderItems![index].product!.images != null && model.orderListModel[0].orderItems![index].product!.images!.length != 0
? model.orderListModel[0].orderItems![index].product!.images![0].src.toString()
: null,
status: model.orderListModel[0].orderStatusId,
product: model.orderListModel[0].orderItems[index].product,
product: model.orderListModel[0].orderItems![index].product,
),
);
}),
@ -533,7 +533,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
model.orderListModel[0].orderStatusId == 10
? InkWell(
onTap: () {
openPayment(model.orderListModel[0], model.user);
openPayment(model.orderListModel[0], model.user!);
},
child: Container(
padding: EdgeInsets.only(left: 10.0, right: 10.0),
@ -604,30 +604,30 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
);
}
Color getStatusBackgroundColor() {
Color? getStatusBackgroundColor() {
print(widget.orderModel.orderStatusId);
// if(orderStatus == 'delivered')
if (widget.orderModel.orderStatusId == 30 || widget.orderModel.orderStatusId == 997 || widget.orderModel.orderStatusId == 994)
return Color(0xFF4CAF50);
else if (widget.orderModel.orderStatusId == 20 || widget.orderModel.orderStatusId == 995 || widget.orderModel.orderStatusId == 998 || widget.orderModel.orderStatusId == 999)
return Colors.grey[500];
return Colors.grey[500]!;
else if (widget.orderModel.orderStatusId == 10)
return Colors.orange[300];
else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900];
return Colors.orange[300]!;
else if (widget.orderModel.orderStatusId == 40 || widget.orderModel.orderStatusId == 996 || widget.orderModel.orderStatusId == 200) return Colors.red[900]!;
}
getCancelOrder(dataIsCancel) {
if (widget.orderModel.canCancel && widget.orderModel.canRefund) {
if (widget.orderModel.canCancel! && widget.orderModel.canRefund!) {
setState(() {
isCancel = true;
isRefund = false;
});
} else if (widget.orderModel.canCancel) {
} else if (widget.orderModel.canCancel!) {
setState(() {
isCancel = true;
isRefund = false;
});
} else if (widget.orderModel.canRefund) {
} else if (widget.orderModel.canRefund!) {
setState(() {
isCancel = false;
isRefund = true;
@ -659,7 +659,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
getCanceledOrder(order) {
Navigator.pop(context);
if (widget.orderModel.canCancel && widget.orderModel.canRefund == false) {
if (widget.orderModel.canCancel! && widget.orderModel.canRefund == false) {
// getCanceledOrder(order);
// AppToast.showSuccessToast(message: "Request Sent Successfully");
// Navigator.push(context,
@ -674,8 +674,8 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
) {
browser = new MyInAppBrowser(onExitCallback: onBrowserExit, onLoadStartCallback: onBrowserLoadStart);
browser.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id, order.billingAddress.email, order.customValuesXml,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser);
browser?.openPharmacyPaymentBrowser(order, order.orderTotal, 'ePharmacy Order', order.id!, order.billingAddress!.email!, order.customValuesXml!,
"${authenticatedUser.firstName} ${authenticatedUser.middleName} ${authenticatedUser.lastName}", authenticatedUser.patientID, authenticatedUser, browser!);
}
onBrowserLoadStart(String url) {
@ -684,7 +684,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
MyInAppBrowser.successURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
if (browser!.isOpened()) browser!.close();
MyInAppBrowser.isPaymentDone = true;
return;
}
@ -692,7 +692,7 @@ class _OrderDetailsPageState extends State<OrderDetailsPage> {
MyInAppBrowser.errorURLS.forEach((element) {
if (url.contains(element)) {
if (browser.isOpened()) browser.close();
if (browser!.isOpened()) browser!.close();
MyInAppBrowser.isPaymentDone = false;
return;
}

@ -7,8 +7,8 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/image.dart' as flutterImage;
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_svg/svg.dart';
import 'package:rating_bar/rating_bar.dart';
class ProductReviewPage extends StatefulWidget {
final PharmacyProduct product;
@ -49,7 +49,7 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
children: [
widget.product.images != null
? flutterImage.Image.network(
widget.product.images[0].src,
widget.product.images![0]!.src!,
fit: BoxFit.cover,
height: 80,
)
@ -99,16 +99,38 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
Container(
child: Align(
alignment: Alignment.topLeft,
child: RatingBar.readOnly(
child:
// RatingBar.readOnly(
// initialRating: ratingValue,
// size: 15.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// ),
//
//
RatingBar(
initialRating: ratingValue,
size: 15.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
),
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
)
),
),
SizedBox(
@ -150,18 +172,38 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
// RatingBar(
// size: 40.0,
// filledColor: Colors.yellow[700],
// emptyColor: Colors.grey[500],
// isHalfAllowed: true,
// halfFilledIcon: Icons.star_half,
// filledIcon: Icons.star,
// emptyIcon: Icons.star,
// onRatingChanged: (rating) {
// currentRating = rating;
// },
// ),
RatingBar(
size: 40.0,
filledColor: Colors.yellow[700],
emptyColor: Colors.grey[500],
isHalfAllowed: true,
halfFilledIcon: Icons.star_half,
filledIcon: Icons.star,
emptyIcon: Icons.star,
onRatingChanged: (rating) {
currentRating = rating;
initialRating: ratingValue,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
itemSize: 20,
ignoreGestures: true,
ratingWidget: RatingWidget(
full: Icon(Icons.star),
half: Icon(Icons.star_half),
empty: Icon(Icons.star),
),
tapOnlyMode: true,
itemPadding: EdgeInsets.symmetric(horizontal: 4.0),
onRatingUpdate: (rating) {
print(rating);
},
),
)
],
),
),
@ -179,13 +221,13 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5.0),
borderSide:
BorderSide(width: 1, color: Colors.grey[400]),
BorderSide(width: 1, color: Colors.grey[400]!),
),
enabledBorder: OutlineInputBorder(
borderRadius:
BorderRadius.all(Radius.circular(5.0)),
borderSide:
BorderSide(color: Colors.grey[400], width: 1),
BorderSide(color: Colors.grey[400]!, width: 1),
),
),
onChanged: (value) {
@ -220,9 +262,9 @@ class _ProductReviewPageState extends State<ProductReviewPage> {
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: _reviewController.value.text != null &&
_reviewController.value.text != ""
? Colors.yellow[700]
color: _reviewController!.value.text! != null &&
_reviewController!.value.text! != ""
? Colors.yellow[700]!
: Color(0xFFf5d69c),
style: BorderStyle.solid,
width: 1.0),

@ -28,14 +28,14 @@ class AddAddressPage extends StatefulWidget {
}
class _AddAddressPageState extends State<AddAddressPage> {
double _latitude;
double _longitude;
AppMap appMap;
AppSharedPreferences sharedPref = AppSharedPreferences();
LatLng currentPostion;
double? _latitude;
double? _longitude;
AppMap? appMap;
AppSharedPreferences? sharedPref = AppSharedPreferences();
LatLng? currentPostion;
Completer<GoogleMapController> mapController = Completer();
Placemark selectedPlace;
LocationUtils locationUtils;
Placemark? selectedPlace;
LocationUtils? locationUtils;
static CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
@ -47,7 +47,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
super.initState();
if (widget.editedAddress != null && widget.editedAddress.latLong != null && widget.editedAddress.latLong != "") {
List<String> latLng = widget.editedAddress.latLong.split(",");
List<String> latLng = widget.editedAddress.latLong!.split(",");
_latitude = double.parse(latLng[0]);
_longitude = double.parse(latLng[1]);
} else {
@ -56,19 +56,19 @@ class _AddAddressPageState extends State<AddAddressPage> {
// setState(() {});
appMap = AppMap(
_kGooglePlex.toMap(),
onCameraMove: (camera) {
_updatePosition(camera);
_kGooglePlex!.toMap() as Map<dynamic, dynamic>,
onCameraMove: () {
_updatePosition(_kGooglePlex);
},
onMapCreated: () {
currentPostion = LatLng(_latitude, _longitude);
currentPostion = LatLng(_latitude!, _longitude!);
// latitude = widget.latitude;
// longitude = widget.longitude;
setMap();
setState(() {});
},
onCameraIdle: () async {
List<Placemark> placemarks = await placemarkFromCoordinates(_latitude, _longitude);
List<Placemark> placemarks = await placemarkFromCoordinates(_latitude!, _longitude!);
selectedPlace = placemarks[0];
print(selectedPlace);
},
@ -78,10 +78,10 @@ class _AddAddressPageState extends State<AddAddressPage> {
setMap() {
setState(() {
_kGooglePlex = CameraPosition(
target: currentPostion,
target: currentPostion!,
zoom: 14.4746,
);
appMap.moveTo(cameraPostion: _kGooglePlex);
appMap!.moveTo(cameraPostion: _kGooglePlex);
});
}
@ -92,16 +92,16 @@ class _AddAddressPageState extends State<AddAddressPage> {
}
_getCurrentLocation() async {
if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) {
var lat = await this.sharedPref.getDouble(USER_LAT);
var long = await this.sharedPref.getDouble(USER_LONG);
if (await this.sharedPref!.getDouble(USER_LAT) != null && await this.sharedPref!.getDouble(USER_LONG) != null) {
var lat = await this.sharedPref!.getDouble(USER_LAT);
var long = await this.sharedPref!.getDouble(USER_LONG);
_latitude = lat;
_longitude = long;
currentPostion = LatLng(lat, long);
setMap();
} else {
locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context);
locationUtils.getCurrentLocation(callBack: (value) {
locationUtils!.getCurrentLocation(callBack: (value) {
print(value);
setMap();
});
@ -136,7 +136,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
child: Stack(
alignment: Alignment.center,
children: [
if (appMap != null) appMap,
if (appMap != null) appMap!,
Container(
margin: EdgeInsets.only(bottom: 50.0),
child: Icon(
@ -171,7 +171,7 @@ class _AddAddressPageState extends State<AddAddressPage> {
// ]),
// );
widget.onPick(selectedPlace, "$_latitude,$_longitude");
widget.onPick(selectedPlace!, "$_latitude,$_longitude");
Navigator.of(context).pop();
// await model.addAddressInfo(addNewAddressRequestModel: addNewAddressRequestModel);

@ -20,13 +20,13 @@ import 'package:provider/provider.dart';
///TODO Elham* split this to tow files
class PharmacyAddressesPage extends StatefulWidget {
final OrderPreviewViewModel orderPreviewViewModel;
final Function changeMainState;
final OrderPreviewViewModel? orderPreviewViewModel;
final Function? changeMainState;
final bool isUpdate;
final bool isShippingAddress;
const PharmacyAddressesPage({Key key, this.orderPreviewViewModel, this.isUpdate = false, this.isShippingAddress = false, this.changeMainState}) : super(key: key);
const PharmacyAddressesPage({Key? key, this.orderPreviewViewModel, this.isUpdate = false, this.isShippingAddress = false, this.changeMainState}) : super(key: key);
@override
_PharmacyAddressesState createState() => _PharmacyAddressesState();
@ -96,7 +96,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
vPadding: 12,
hasShadow: true,
handler: () {
navigateToAddressPage(context, model, null);
navigateToAddressPage(context, model, AddressInfo());
},
),
),
@ -132,17 +132,17 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
fontSize: 14,
vPadding: 8,
handler: () async {
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
widget.orderPreviewViewModel!.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
GifLoaderDialogUtils.showMyDialog(context);
await widget.orderPreviewViewModel.getInformationsByAddress(projectProvider.user.patientIdentificationNo);
if (widget.orderPreviewViewModel.error == "") {
await widget.orderPreviewViewModel.getShoppingCart();
await widget.orderPreviewViewModel!.getInformationsByAddress(projectProvider.user!.patientIdentificationNo!);
if (widget.orderPreviewViewModel!.error == "") {
await widget.orderPreviewViewModel!.getShoppingCart();
GifLoaderDialogUtils.hideDialog(context);
model.saveSelectedAddressLocally(model.addresses[model.selectedAddressIndex]);
_navigateToPaymentOption(model);
} else {
GifLoaderDialogUtils.hideDialog(context);
AppToast.showErrorToast(message: widget.orderPreviewViewModel.error);
AppToast.showErrorToast(message: widget.orderPreviewViewModel!.error);
return;
}
},
@ -158,8 +158,8 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
_navigateToPaymentOption(model) {
if (widget.isUpdate) {
widget.orderPreviewViewModel.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
widget.changeMainState();
widget.orderPreviewViewModel!.paymentCheckoutData.address = Addresses.fromJson(model.addresses[model.selectedAddressIndex].toJson());
widget.changeMainState!();
Navigator.pop(context);
return;
@ -168,12 +168,12 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
context,
FadePage(
page: PaymentMethodSelectPage(
model: widget.orderPreviewViewModel,
model: widget.orderPreviewViewModel!,
))).then((result) => {
setState(() {
if (result != null) {
var paymentOption = result;
widget.orderPreviewViewModel.paymentCheckoutData.paymentOption = paymentOption;
widget.orderPreviewViewModel!.paymentCheckoutData!.paymentOption = paymentOption;
}
// widget.changeMainState();
})
@ -184,7 +184,7 @@ class _PharmacyAddressesState extends State<PharmacyAddressesPage> {
class AddressItemWidget extends StatefulWidget {
final PharmacyAddressesViewModel model;
final AddressInfo address;
final Function selectAddress;
final VoidCallback selectAddress;
final bool isSelected;
final Function(AddressInfo) onTabEditAddress;
@ -210,7 +210,7 @@ class _AddressItemWidgetState extends State<AddressItemWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: widget.selectAddress,
onTap: widget!.selectAddress!,
child: Container(
margin: EdgeInsets.only(left: 16, right: 16),
child: Padding(

@ -42,7 +42,7 @@ class _pharmacyContactsPageState extends State<pharmacyContactsPage> {
Card(
elevation: 2,
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.grey[300], width: 2),
side: BorderSide(color: Colors.grey[300]!, width: 2),
borderRadius: BorderRadius.circular(10),
),
margin: EdgeInsets.symmetric(

@ -30,9 +30,9 @@ dynamic languageID;
class PharmacyProfilePage extends StatefulWidget {
final bool moveToOrder;
final Function(int) changeTab;
final VoidCallbackAction? changeTab;
PharmacyProfilePage({@required this.moveToOrder, this.changeTab});
PharmacyProfilePage({required this.moveToOrder, this.changeTab});
@override
_ProfilePageState createState() => _ProfilePageState();
@ -42,13 +42,13 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
AppSharedPreferences sharedPref = AppSharedPreferences();
String page_id = "";
AuthenticatedUser user;
bool isLogin = false;
String firstName;
String customerId;
String customerGUID;
String lastName, mobileNo, identificationNo;
int languageId;
AuthenticatedUser? user;
bool? isLogin = false;
String? firstName;
String? customerId;
String? customerGUID;
String? lastName, mobileNo, identificationNo;
int? languageId;
getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE);
@ -71,7 +71,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
if (userData != null) {
user = AuthenticatedUser.fromJson(userData);
setState(() {
firstName = user.firstName.toString();
firstName = user!.firstName!.toString();
});
} else {
if (userData == null) {
@ -89,7 +89,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
super.initState();
getUser();
if (widget.moveToOrder) {
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID)));
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId!, customerGUID: customerGUID!)));
}
}
@ -111,9 +111,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
showPharmacyCart: false,
showHomeAppBarIcon: false,
isMainPharmacyPages: true,
backButtonTab: () {
widget.changeTab(0);
},
backButtonTab: widget.changeTab!,
body: user != null
? Container(
color: Colors.white,
@ -134,7 +132,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
bottom: 10.0,
),
child: LargeAvatar(
name: user.firstName.toString(),
name: user!.firstName.toString(),
url: '',
),
),
@ -150,7 +148,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
Row(children: <Widget>[
Text(
languageID == "ar" ? user.firstNameN.toString() + " " + user.lastNameN.toString() : user.firstName.toString() + " " + user.lastName.toString(),
languageID == "ar" ? user!.firstNameN!.toString() + " " + user!.lastNameN!.toString() : user!.firstName!.toString() + " " + user!.lastName!.toString(),
style: TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold),
),
]),
@ -181,7 +179,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
AppToast.showErrorToast(message: "Customer not found");
return;
}
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId, customerGUID: customerGUID)));
Navigator.push(context, FadePage(page: OrderPage(customerID: customerId!, customerGUID: customerGUID!)));
},
child: Column(
children: <Widget>[
@ -492,7 +490,7 @@ class _ProfilePageState extends State<PharmacyProfilePage> {
),
InkWell(
onTap: () {
Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo, this.firstName, this.lastName, this.mobileNo, this.languageId)));
Navigator.push(context, FadePage(page: LakumTermsConditions(this.identificationNo!, this.firstName!, this.lastName!, this.mobileNo!, this.languageId!)));
},
child: Row(
children: <Widget>[

@ -18,9 +18,9 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:provider/provider.dart';
class RateAppointmentClinic extends StatefulWidget {
final AppointmentDetails appointmentDetails;
final String doctorNote;
final int doctorRate;
late final AppointmentDetails? appointmentDetails;
late final String? doctorNote;
late final int? doctorRate;
RateAppointmentClinic({this.appointmentDetails, this.doctorRate, this.doctorNote});
@ -211,21 +211,21 @@ class _RateAppointmentClinicState extends State<RateAppointmentClinic> {
: () {
model
.sendAppointmentRate(
rating, widget.appointmentDetails.appointmentNo, widget.appointmentDetails.projectID, widget.appointmentDetails.doctorID, widget.appointmentDetails.clinicID, note)
rating, widget.appointmentDetails!.appointmentNo!, widget.appointmentDetails!.projectID!, widget.appointmentDetails!.doctorID!, widget.appointmentDetails!.clinicID!, note)
.then(
(value) => {
model
.sendDoctorRate(
widget.doctorRate,
widget.appointmentDetails.appointmentNo,
widget.appointmentDetails.projectID,
widget.appointmentDetails.doctorID,
widget.appointmentDetails.clinicID,
widget.doctorRate!,
widget.appointmentDetails!.appointmentNo!,
widget.appointmentDetails!.projectID!,
widget.appointmentDetails!.doctorID!,
widget.appointmentDetails!.clinicID!,
note,
widget.appointmentDetails.appointmentDate,
widget.appointmentDetails.doctorName,
widget.appointmentDetails.projectName,
widget.appointmentDetails.clinicName)
widget.appointmentDetails!.appointmentDate,
widget.appointmentDetails!.doctorName,
widget.appointmentDetails!.projectName,
widget.appointmentDetails!.clinicName)
.then((value) {
Navigator.pushReplacement(
context,

@ -26,7 +26,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
bool location = false;
var sharedPref = new AppSharedPreferences();
var permission = new PermissionService();
LocationPermission locationPermission;
LocationPermission? locationPermission;
var mediaQueryData;
@override
@ -59,7 +59,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
value: vibration,
onChanged: (value) {
setState(() {
vibration = value;
vibration = value!;
});
},
activeColor: CustomColors.accentColor,
@ -79,7 +79,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
value: accsibility,
onChanged: (value) {
setState(() {
accsibility = value;
accsibility = value!;
});
},
activeColor: CustomColors.accentColor,
@ -112,7 +112,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
groupValue: blindValue,
onChanged: (value) {
setState(() {
blindValue = value;
blindValue = value!;
setTheme(value);
});
},
@ -133,7 +133,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
groupValue: blindValue,
onChanged: (value) {
setState(() {
blindValue = value;
blindValue = value!;
setTheme(value);
});
},
@ -154,7 +154,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
groupValue: blindValue,
onChanged: (value) {
setState(() {
blindValue = value;
blindValue = value!;
setTheme(value);
});
},
@ -175,7 +175,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
groupValue: blindValue,
onChanged: (value) {
setState(() {
blindValue = value;
blindValue = value!;
setTheme(value);
});
},
@ -207,7 +207,7 @@ class _GeneralSettings extends State<GeneralSettings> with TickerProviderStateMi
value: camera,
onChanged: (value) {
setState(() {
camera = value;
camera = value!;
});
this.permission.openSettings();
},

@ -29,7 +29,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
TextEditingController emergencyContact = new TextEditingController();
TextEditingController emailController = new TextEditingController();
TextEditingController emergencyContactName = new TextEditingController();
ProjectViewModel projectProvider;
ProjectViewModel? projectProvider;
@override
void initState() {
@ -68,7 +68,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
),
),
Text(
model.user.patientID.toString(),
model.user!.patientID.toString(),
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
@ -106,7 +106,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
groupValue: language,
onChanged: (value) {
setState(() {
language = value;
language = value!;
});
},
),
@ -128,7 +128,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
groupValue: language,
onChanged: (value) {
setState(() {
language = value;
language = value!;
});
},
),
@ -167,7 +167,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
value: emailAlert,
onChanged: (value) {
setState(() {
emailAlert = value;
emailAlert = value!;
});
},
activeColor: CustomColors.accentColor,
@ -187,7 +187,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
value: smsAlert,
onChanged: (value) {
setState(() {
smsAlert = value;
smsAlert = value!;
});
},
activeColor: CustomColors.accentColor,
@ -268,7 +268,7 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
);
}
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) {
Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) {
return Container(
padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15),
alignment: Alignment.center,
@ -368,8 +368,8 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
GifLoaderDialogUtils.showMyDialog(context);
Map<String, dynamic> request = {};
request["IsActive"] = false;
request["PatientIdentificationID"] = projectProvider.user.patientIdentificationNo;
request["PatientMobileNumber"] = Utils.getPhoneNumberWithoutZero(projectProvider.user.mobileNumber);
request["PatientIdentificationID"] = projectProvider!.user!.patientIdentificationNo!;
request["PatientMobileNumber"] = Utils.getPhoneNumberWithoutZero(projectProvider!.user!.mobileNumber!);
authService.deactivateAccount(request, false).then((result) {
AppToast.showSuccessToast(message: TranslationBase.of(context).accountDeactivated);
GifLoaderDialogUtils.hideDialog(context);
@ -403,9 +403,9 @@ class _ProfileSettings extends State<ProfileSettings> with TickerProviderStateMi
authService.saveSettings(request).then((result) {
AppToast.showSuccessToast(message: TranslationBase.of(context).profileUpdate);
GifLoaderDialogUtils.hideDialog(context);
AuthenticatedUser authUser = projectProvider.user;
AuthenticatedUser authUser = projectProvider!.user!;
authUser.emailAddress = this.emailController.text;
projectProvider.setUser(authUser);
projectProvider!.setUser(authUser);
});
}
}

@ -17,14 +17,14 @@ class Settings extends StatefulWidget {
}
class _Settings extends State<Settings> with TickerProviderStateMixin {
TabController _tabController;
TabController? _tabController;
@override
void initState() {
_tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type);
if (widget.type == 1) {
_tabController.animateTo(1);
_tabController!.animateTo(1);
}
super.initState();

@ -94,7 +94,7 @@ class _SymptomInfo extends State<SymptomInfo> {
value: checkValue,
onChanged: (newValue) {
setState(() {
this.checkValue = newValue;
this.checkValue = newValue!;
});
},
controlAffinity: ListTileControlAffinity

@ -22,16 +22,16 @@ class _MyVaccinesItemPageState extends State<MyVaccinesItemPage> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<VaccineViewModel>(
onModelReady: (model) => model.getMyVaccinationItem(),
builder: (BuildContext context, VaccineViewModel model, Widget child) =>
builder: (BuildContext context, VaccineViewModel model, Widget? child) =>
AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).myVaccinesAvailability,
baseViewModel: model,
body: Container(
margin: EdgeInsets.only(
left: SizeConfig.screenWidth * 0.004,
right: SizeConfig.screenWidth * 0.004,
top: SizeConfig.screenWidth * 0.04,
left: SizeConfig.screenWidth! * 0.004,
right: SizeConfig.screenWidth! * 0.004,
top: SizeConfig.screenWidth! * 0.04,
),
child: ListView.builder(
itemCount: model.vaccinationItemList.length,

@ -27,7 +27,7 @@ class _MyVaccinesState extends State<MyVaccines> {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<VaccineViewModel>(
onModelReady: (model) => model.getVaccine(),
builder: (BuildContext context, VaccineViewModel model, Widget child) => AppScaffold(
builder: (BuildContext context, VaccineViewModel model, Widget? child) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
@ -42,7 +42,7 @@ class _MyVaccinesState extends State<MyVaccines> {
children: <Widget>[
AppExpandableNotifier(
isExpand: true,
title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate).year.toString() : "",
title: model.state == ViewState.Idle ? DateUtil.convertStringToDate(model.vaccineList[0].vaccinationDate!).year.toString() : "",
bodyWidget: Container(
child: ListView.separated(
physics: ScrollPhysics(),
@ -56,13 +56,13 @@ class _MyVaccinesState extends State<MyVaccines> {
onTap: null,
isInOutPatient: true,
isShowInOutPatient: false,
name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName,
name: TranslationBase.of(context).dr.toString() + " " + model.vaccineList[index].doctorName!,
billNo: "",
vaccineName: model.vaccineList[index].vaccineName,
vaccineName: model.vaccineList[index].vaccineName!,
profileUrl: model.vaccineList[index].doctorImageURL,
subName: model.vaccineList[index].projectName,
isLiveCareAppointment: false,
date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate),
date: DateUtil.convertStringToDate(model.vaccineList[index].vaccinationDate!),
isSortByClinic: true,
);
},
@ -83,7 +83,7 @@ class _MyVaccinesState extends State<MyVaccines> {
showDialog(
context: context,
builder: (cxt) => ConfirmSendEmailDialog(
email: projectViewModel.user.emailAddress,
email: projectViewModel.user!.emailAddress!,
onTapSendEmail: () {
model.sendEmail(message: TranslationBase.of(context).emailSentSuccessfully);
},

@ -4,11 +4,11 @@ import 'dart:convert';
import 'dart:async';
class SimpleWebSocket {
String _url;
var _socket;
Function() onOpen;
Function(dynamic msg) onMessage;
Function(int code, String reaso) onClose;
String? _url;
late var _socket;
late Function() onOpen;
late Function(dynamic msg) onMessage;
late Function(int code, String reaso) onClose;
SimpleWebSocket(this._url);
connect() async {

@ -2,11 +2,11 @@
import 'dart:html';
class SimpleWebSocket {
String _url;
var _socket;
Function() onOpen;
Function(dynamic msg) onMessage;
Function(int code, String reason) onClose;
late String _url;
late var _socket;
late Function() onOpen;
late Function(dynamic msg) onMessage;
late Function(int code, String reason) onClose;
SimpleWebSocket(this._url) {
_url = _url.replaceAll('https:', 'wss:');

@ -40,7 +40,7 @@ int randomBetween(int from, int to) {
/// Generates a random string of [length] with characters
/// between ascii [from] to [to].
/// Defaults to characters of ascii '!' to '~'.
String randomString(int length, {int from: ASCII_START, int to: ASCII_END}) {
String randomString(int length, {int from= ASCII_START, int to= ASCII_END}) {
return String.fromCharCodes(
List.generate(length, (index) => randomBetween(from, to)));
}

@ -15,24 +15,24 @@ const JsonEncoder _encoder = JsonEncoder();
const JsonDecoder _decoder = JsonDecoder();
class SessionOneToOne {
String id;
SocketUser local_user;
SocketUser remote_user;
SessionOneToOne({@required this.id, @required this.local_user, @required this.remote_user});
late String id;
late SocketUser local_user;
late SocketUser remote_user;
SessionOneToOne({required this.id, required this.local_user, required this.remote_user});
RTCPeerConnection pc;
RTCDataChannel dc;
late RTCPeerConnection pc;
late RTCDataChannel dc;
List<RTCIceCandidate> remoteCandidates = [];
}
class SocketUser{
String id;
String name;
String userAgent;
Map moreInfo;
String? id;
String? name;
String? userAgent;
Map? moreInfo;
SocketUser({@required this.id, @required this.name, @required this.userAgent, @required this.moreInfo});
SocketUser({required this.id, required this.name, required this.userAgent, required this.moreInfo});
SocketUser.from(dynamic json){
id = json['id'];
@ -53,26 +53,26 @@ class Signaling {
var _host;
var _turnCredential;
SimpleWebSocket _socket;
SessionOneToOne session;
SimpleWebSocket? _socket;
SessionOneToOne? session;
Signaling(this._host, {@required this.session});
Signaling(this._host, {required this.session});
MediaStream localStream;
final List<MediaStream> remoteStreams = <MediaStream>[];
late MediaStream? localStream;
late final List<MediaStream> remoteStreams = <MediaStream>[];
Function(SignalingState state) onSignalingStateChange;
Function(SessionOneToOne session, CallState state) onCallStateChange;
Function(MediaStream stream) onLocalStream;
Function(SessionOneToOne session, MediaStream stream) onAddRemoteStream;
Function(SessionOneToOne session, MediaStream stream) onRemoveRemoteStream;
Function(dynamic event) onPeersUpdate;
Function(dynamic event) onConnected;
Function(dynamic event) onRemoteConnected;
Function(SessionOneToOne session, RTCDataChannel dc, RTCDataChannelMessage data) onDataChannelMessage;
Function(SessionOneToOne session, RTCDataChannel dc) onDataChannel;
late Function(SignalingState state) onSignalingStateChange;
late Function(SessionOneToOne session, CallState state) onCallStateChange;
late Function(MediaStream stream) onLocalStream;
late Function(SessionOneToOne session, MediaStream stream) onAddRemoteStream;
late Function(SessionOneToOne session, MediaStream stream) onRemoveRemoteStream;
late Function(dynamic event) onPeersUpdate;
late Function(dynamic event) onConnected;
late Function(dynamic event) onRemoteConnected;
late Function(SessionOneToOne session, RTCDataChannel dc, RTCDataChannelMessage data) onDataChannelMessage;
late Function(SessionOneToOne session, RTCDataChannel dc) onDataChannel;
String get sdpSemantics => WebRTC.platformIsWindows ? 'plan-b' : 'unified-plan';
String? get sdpSemantics => WebRTC.platformIsWindows ? 'plan-b' : 'unified-plan';
Map<String, dynamic> _iceServers = {
'iceServers': [
@ -111,14 +111,14 @@ class Signaling {
void switchCamera() {
if (localStream != null) {
Helper.switchCamera(localStream .getVideoTracks()[0]);
Helper.switchCamera(localStream! .getVideoTracks()[0]);
}
}
void muteMic() {
if (localStream != null) {
bool enabled = localStream .getAudioTracks()[0].enabled;
localStream .getAudioTracks()[0].enabled = !enabled;
bool enabled = localStream!.getAudioTracks()[0].enabled;
localStream!.getAudioTracks()[0].enabled = !enabled;
}
}
@ -136,10 +136,10 @@ class Signaling {
return;
if (media == 'data') {
_createDataChannel(session);
_createDataChannel(session!);
}
_createOffer(session, media);
onCallStateChange?.call(session, CallState.Calling);
_createOffer(session!, media);
onCallStateChange?.call(session!, CallState.Calling);
}
void bye(SessionOneToOne session) {
@ -176,17 +176,17 @@ class Signaling {
var description = data['description'];
var media = data['media'];
await _initPeerConnection(session, media: media, screenSharing: false);
await session.pc?.setRemoteDescription(RTCSessionDescription(description['sdp'], description['type']));
await _createAnswer(session, media);
await _initPeerConnection(session!, media: media, screenSharing: false);
await session!.pc?.setRemoteDescription(RTCSessionDescription(description['sdp'], description['type']));
await _createAnswer(session!, media);
if (session.remoteCandidates.isNotEmpty) {
session.remoteCandidates.forEach((candidate) async {
await session.pc?.addCandidate(candidate);
if (session!.remoteCandidates!.isNotEmpty) {
session!.remoteCandidates!.forEach((candidate) async {
await session!.pc?.addCandidate(candidate);
});
session.remoteCandidates.clear();
session!.remoteCandidates.clear();
}
onCallStateChange?.call(session, CallState.Calling);
onCallStateChange?.call(session!, CallState.Calling);
}
break;
case 'answer':
@ -194,7 +194,7 @@ class Signaling {
var description = data['description'];
var sessionId = data['session_id'];
session.pc?.setRemoteDescription(
session!.pc?.setRemoteDescription(
RTCSessionDescription(description['sdp'], description['type']));
}
break;
@ -208,10 +208,10 @@ class Signaling {
candidateMap['sdpMid'], candidateMap['sdpMLineIndex']);
if (session != null) {
if (session.pc != null) {
await session.pc?.addCandidate(candidate);
if (session!.pc != null) {
await session!.pc?.addCandidate(candidate);
} else {
session.remoteCandidates.add(candidate);
session!.remoteCandidates.add(candidate);
}
} else {
// _sessions[sessionId] = SessionOneToOne(pid: peerId, sid: sessionId)
@ -231,8 +231,8 @@ class Signaling {
var sessionId = data['session_id'];
print('bye: ' + sessionId);
if (session != null) {
onCallStateChange?.call(session, CallState.Bye);
_closeSession(session);
onCallStateChange?.call(session!, CallState.Bye);
_closeSession(session!);
}
}
break;
@ -275,7 +275,7 @@ class Signaling {
_socket?.onOpen = () {
print('onOpen');
onSignalingStateChange?.call(SignalingState.Open);
_send('connect', session.local_user.toJson());
_send('connect', session!.local_user!.toJson());
};
_socket?.onMessage = (message) {
@ -314,7 +314,7 @@ class Signaling {
return stream;
}
Future<SessionOneToOne> _initPeerConnection(SessionOneToOne session, {@required String media, @required bool screenSharing}) async {
Future<SessionOneToOne> _initPeerConnection(SessionOneToOne session, {required String media, required bool screenSharing}) async {
if (media != 'data')
localStream = await createStream(media, screenSharing);
@ -330,7 +330,7 @@ class Signaling {
onAddRemoteStream?.call(session, stream);
remoteStreams.add(stream);
};
await pc.addStream(localStream);
await pc.addStream(localStream!);
break;
case 'unified-plan':
// Unified-Plan
@ -339,8 +339,8 @@ class Signaling {
onAddRemoteStream?.call(session, event.streams[0]);
}
};
localStream .getTracks().forEach((track) {
pc.addTrack(track, localStream);
localStream! .getTracks().forEach((track) {
pc.addTrack(track, localStream!);
});
break;
}
@ -437,7 +437,7 @@ class Signaling {
onDataChannel?.call(session, channel);
}
Future<void> _createDataChannel(SessionOneToOne session, {label: 'fileTransfer'}) async {
Future<void> _createDataChannel(SessionOneToOne session, {label= 'fileTransfer'}) async {
RTCDataChannelInit dataChannelDict = RTCDataChannelInit()
..maxRetransmits = 30;
RTCDataChannel channel =
@ -486,13 +486,13 @@ class Signaling {
}
Future<void> finishSessions() async {
_closeSessionById(session.id);
_closeSessionById(session!.id);
}
void _closeSessionById(String sessionId) {
if (session != null && session.id == sessionId) {
_closeSession(session);
onCallStateChange?.call(session, CallState.Bye);
if (session != null && session!.id == sessionId) {
_closeSession(session!);
onCallStateChange?.call(session!, CallState.Bye);
}
}

@ -17,17 +17,17 @@ class StartVideoCall extends StatefulWidget {
String caller;
String receiver;
bool iAmCaller;
StartVideoCall({@required this.caller, @required this.receiver, this.iAmCaller = false, @required this.host});
StartVideoCall({required this.caller, required this.receiver, this.iAmCaller = false, required this.host});
@override
StartVideoCallState createState() => StartVideoCallState(receiverId: receiver, callerId: caller, iAmCaller: iAmCaller);
}
class StartVideoCallState extends State<StartVideoCall> {
Signaling _signaling;
SessionOneToOne _session;
late Signaling _signaling;
late SessionOneToOne? _session;
StartVideoCallState({@required String callerId, @required String receiverId, @required bool iAmCaller}){
StartVideoCallState({required String callerId, required String receiverId, required bool iAmCaller}){
final self_role = iAmCaller ? "Caller" : "Receiver";
final self_id = iAmCaller ? callerId : receiverId;
@ -50,7 +50,7 @@ class StartVideoCallState extends State<StartVideoCall> {
final RTCVideoRenderer _localRenderer = RTCVideoRenderer();
final RTCVideoRenderer _remoteRenderer = RTCVideoRenderer();
MediaStream get localMediaStream => _signaling.localStream;
MediaStream get localMediaStream => _signaling.localStream!;
MediaStream get remoteMediaStream => _signaling.remoteStreams.first;
@override
@ -129,7 +129,7 @@ class StartVideoCallState extends State<StartVideoCall> {
if(_session == null)
return;
_signaling ??= Signaling(widget.host, session: _session)..connect();
_signaling ??= Signaling(widget.host, session: _session!)..connect();
_signaling?.onSignalingStateChange = (SignalingState state) {
switch (state) {
@ -159,7 +159,7 @@ class StartVideoCallState extends State<StartVideoCall> {
};
_signaling?.onConnected = ((event) {
_signaling?.callAccepted(_session);
_signaling?.callAccepted(_session!);
});
_signaling?.onRemoteConnected = ((event) {
@ -186,7 +186,7 @@ class StartVideoCallState extends State<StartVideoCall> {
_hangUp() async{
if (_session != null) {
_signaling?.bye(_session);
_signaling?.bye(_session!);
}
}
@ -198,21 +198,21 @@ class StartVideoCallState extends State<StartVideoCall> {
_signaling?.muteMic();
}
Function _onAudioEnable() {
Function? _onAudioEnable() {
final audioTrack = localMediaStream.getAudioTracks()[0];
final mute = audioTrack.muted;
Helper.setMicrophoneMute(!mute, audioTrack);
Helper.setMicrophoneMute(!mute!, audioTrack);
_audioButton.add(mute);
}
Function _onVideoEnabled() {
Function? _onVideoEnabled() {
final videoTrack = localMediaStream.getVideoTracks()[0];
bool videoEnabled = videoTrack.enabled;
localMediaStream.getVideoTracks()[0].enabled = !videoEnabled;
_videoButton.add(!videoEnabled);
}
Function _onSwitchCamera() {
Function? _onSwitchCamera() {
Helper.switchCamera(localMediaStream.getVideoTracks()[0]);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save