Merge branch 'login_design_sikander' into development_new_design_2.0

merge-update-with-lab-changes
Sikander Saleem 5 years ago
commit d1b45c8bcc

@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders'; const PACKAGES_ORDERS = '/api/orders';
//const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/'; //const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs // Pharmacy UAT URLs
//const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; //const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/';

@ -1,6 +1,7 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/filter_type.dart'; import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/locator.dart';
@ -10,13 +11,19 @@ import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/AppointmentCar
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.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/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'AppointmentDetails.dart';
class MyAppointments extends StatefulWidget { class MyAppointments extends StatefulWidget {
List<AppoitmentAllHistoryResultList> appoList = []; List<AppoitmentAllHistoryResultList> appoList = [];
@ -25,8 +32,7 @@ class MyAppointments extends StatefulWidget {
List<AppoitmentAllHistoryResultList> arrivedAppoList = []; List<AppoitmentAllHistoryResultList> arrivedAppoList = [];
List<PatientAppointmentList> _patientBookedAppointmentListHospital = List(); List<PatientAppointmentList> _patientBookedAppointmentListHospital = List();
List<PatientAppointmentList> _patientConfirmedAppointmentListHospital = List<PatientAppointmentList> _patientConfirmedAppointmentListHospital = List();
List();
List<PatientAppointmentList> _patientArrivedAppointmentListHospital = List(); List<PatientAppointmentList> _patientArrivedAppointmentListHospital = List();
List<PatientAppointmentList> _patientBookedAppointmentListClinic = List(); List<PatientAppointmentList> _patientBookedAppointmentListClinic = List();
@ -37,14 +43,12 @@ class MyAppointments extends StatefulWidget {
_MyAppointmentsState createState() => _MyAppointmentsState(); _MyAppointmentsState createState() => _MyAppointmentsState();
} }
class _MyAppointmentsState extends State<MyAppointments> class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin {
TabController _tabController; TabController _tabController;
bool isDataLoaded = false; bool isDataLoaded = false;
var sharedPref = new AppSharedPreferences(); var sharedPref = new AppSharedPreferences();
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
List<ImagesInfo> imagesInfo = List(); List<ImagesInfo> imagesInfo = List();
@ -55,43 +59,35 @@ class _MyAppointmentsState extends State<MyAppointments>
_tabController = new TabController(length: 3, vsync: this); _tabController = new TabController(length: 3, vsync: this);
filterType = FilterType.Clinic; filterType = FilterType.Clinic;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) getPatientAppointmentHistory();
getPatientAppointmentHistory();
}); });
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/0.png'));
imagesInfo.add(ImagesInfo( imagesInfo.add(ImagesInfo(
imageEn: imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/1.png'));
'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/en/1.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/my-appointment/ar/1.png'));
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AppScaffold( return AppScaffold(
appBarTitle: TranslationBase.of(context).myAppointments, appBarTitle: TranslationBase.of(context).myAppointmentsList,
isShowAppBar: true, isShowAppBar: true,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true,
description: TranslationBase.of(context).infoMyAppointments, description: TranslationBase.of(context).infoMyAppointments,
body: Container( body: Container(
child: Column(children: [ child: Column(children: [
TabBar( TabBar(
tabs: [ tabs: [
Tab(child: Text(TranslationBase.of(context).booked, style: TextStyle(color: Colors.black))),
Tab( Tab(
child: Text(TranslationBase.of(context).booked, child: Text(TranslationBase.of(context).confirmed, style: TextStyle(color: Colors.black)),
style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).confirmed,
style: TextStyle(color: Colors.black)),
), ),
Tab( Tab(
child: Text(TranslationBase.of(context).arrived, child: Text(TranslationBase.of(context).arrived, style: TextStyle(color: Colors.black)),
style: TextStyle(color: Colors.black)),
) )
], ],
controller: _tabController, controller: _tabController,
@ -101,50 +97,20 @@ class _MyAppointmentsState extends State<MyAppointments>
thickness: 0.5, thickness: 0.5,
), ),
Row( Row(
children: <Widget>[ children: [
Expanded( MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, filterType, () {
flex: 1, setFilterType(FilterType.Clinic);
child: InkWell( }),
onTap: () => setFilterType(FilterType.Clinic), MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, filterType, () {
child: ListTile( setFilterType(FilterType.Hospital);
title: Text(TranslationBase.of(context).clinic), }),
leading: Radio(
value: FilterType.Clinic,
groupValue: filterType,
activeColor: Color(0xffB8382C),
onChanged: (FilterType value) {
setFilterType(value);
},
),
),
),
),
Expanded(
flex: 1,
child: InkWell(
onTap: () => setFilterType(FilterType.Hospital),
child: ListTile(
title: Text(TranslationBase.of(context).hospital),
leading: Radio(
value: FilterType.Hospital,
groupValue: filterType,
activeColor: Color(0xffB8382C),
onChanged: (FilterType value) => setFilterType(value),
),
),
),
)
], ],
), ),
isDataLoaded isDataLoaded
? Expanded( ? Expanded(
child: new TabBarView( child: new TabBarView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
children: [ children: [getBookedAppointments(), getConfirmedAppointments(), getArrivedAppointments()],
getBookedAppointments(),
getConfirmedAppointments(),
getArrivedAppointments()
],
controller: _tabController, controller: _tabController,
), ),
) )
@ -179,8 +145,7 @@ class _MyAppointmentsState extends State<MyAppointments>
if (res['AppoimentAllHistoryResultList'].length != 0) { if (res['AppoimentAllHistoryResultList'].length != 0) {
// isDataLoaded = true; // isDataLoaded = true;
res['AppoimentAllHistoryResultList'].forEach((v) { res['AppoimentAllHistoryResultList'].forEach((v) {
widget.appoList widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
.add(new AppoitmentAllHistoryResultList.fromJson(v));
}); });
sortAppointmentList(); sortAppointmentList();
} else {} } else {}
@ -226,135 +191,80 @@ class _MyAppointmentsState extends State<MyAppointments>
}); });
widget.bookedAppoList.forEach((element) { widget.bookedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = List<PatientAppointmentList> doctorByClinic = widget._patientBookedAppointmentListClinic
widget._patientBookedAppointmentListClinic .where(
.where( (elementClinic) => elementClinic.filterName == element.clinicName,
(elementClinic) => )
elementClinic.filterName == element.clinicName, .toList();
)
.toList();
if (doctorByClinic.length != 0) { if (doctorByClinic.length != 0) {
widget widget._patientBookedAppointmentListClinic[widget._patientBookedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
._patientBookedAppointmentListClinic[widget
._patientBookedAppointmentListClinic
.indexOf(doctorByClinic[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientBookedAppointmentListClinic.add(PatientAppointmentList( widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
filterName: element.clinicName, patientDoctorAppointment: element));
} }
List<PatientAppointmentList> doctorByHospital = List<PatientAppointmentList> doctorByHospital = widget._patientBookedAppointmentListHospital
widget._patientBookedAppointmentListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.projectName,
(elementClinic) => )
elementClinic.filterName == element.projectName, .toList();
)
.toList();
if (doctorByHospital.length != 0) { if (doctorByHospital.length != 0) {
widget widget._patientBookedAppointmentListHospital[widget._patientBookedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
._patientBookedAppointmentListHospital[widget
._patientBookedAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList( widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
filterName: element.projectName,
patientDoctorAppointment: element));
} }
}); });
widget.confirmedAppoList.forEach((element) { widget.confirmedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = List<PatientAppointmentList> doctorByClinic = widget._patientConfirmedAppointmentListClinic
widget._patientConfirmedAppointmentListClinic .where(
.where( (elementClinic) => elementClinic.filterName == element.clinicName,
(elementClinic) => )
elementClinic.filterName == element.clinicName, .toList();
)
.toList();
if (doctorByClinic.length != 0) { if (doctorByClinic.length != 0) {
widget widget._patientConfirmedAppointmentListClinic[widget._patientConfirmedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
._patientConfirmedAppointmentListClinic[widget
._patientConfirmedAppointmentListClinic
.indexOf(doctorByClinic[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientConfirmedAppointmentListClinic.add( widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
PatientAppointmentList(
filterName: element.clinicName,
patientDoctorAppointment: element));
} }
List<PatientAppointmentList> doctorByHospital = List<PatientAppointmentList> doctorByHospital = widget._patientConfirmedAppointmentListHospital
widget._patientConfirmedAppointmentListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.projectName,
(elementClinic) => )
elementClinic.filterName == element.projectName, .toList();
)
.toList();
if (doctorByHospital.length != 0) { if (doctorByHospital.length != 0) {
widget widget._patientConfirmedAppointmentListHospital[widget._patientConfirmedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
._patientConfirmedAppointmentListHospital[widget
._patientConfirmedAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientConfirmedAppointmentListHospital.add( widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
PatientAppointmentList(
filterName: element.projectName,
patientDoctorAppointment: element));
} }
}); });
widget.arrivedAppoList.forEach((element) { widget.arrivedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic = List<PatientAppointmentList> doctorByClinic = widget._patientArrivedAppointmentListClinic
widget._patientArrivedAppointmentListClinic .where(
.where( (elementClinic) => elementClinic.filterName == element.clinicName,
(elementClinic) => )
elementClinic.filterName == element.clinicName, .toList();
)
.toList();
if (doctorByClinic.length != 0) { if (doctorByClinic.length != 0) {
widget widget._patientArrivedAppointmentListClinic[widget._patientArrivedAppointmentListClinic.indexOf(doctorByClinic[0])].patientDoctorAppointmentList.add(element);
._patientArrivedAppointmentListClinic[widget
._patientArrivedAppointmentListClinic
.indexOf(doctorByClinic[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList( widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
filterName: element.clinicName, patientDoctorAppointment: element));
} }
List<PatientAppointmentList> doctorByHospital = List<PatientAppointmentList> doctorByHospital = widget._patientArrivedAppointmentListHospital
widget._patientArrivedAppointmentListHospital .where(
.where( (elementClinic) => elementClinic.filterName == element.projectName,
(elementClinic) => )
elementClinic.filterName == element.projectName, .toList();
)
.toList();
if (doctorByHospital.length != 0) { if (doctorByHospital.length != 0) {
widget widget._patientArrivedAppointmentListHospital[widget._patientArrivedAppointmentListHospital.indexOf(doctorByHospital[0])].patientDoctorAppointmentList.add(element);
._patientArrivedAppointmentListHospital[widget
._patientArrivedAppointmentListHospital
.indexOf(doctorByHospital[0])]
.patientDoctorAppointmentList
.add(element);
} else { } else {
widget._patientArrivedAppointmentListHospital.add( widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
PatientAppointmentList(
filterName: element.projectName,
patientDoctorAppointment: element));
} }
openAppointmentsTab(); openAppointmentsTab();
@ -383,69 +293,29 @@ class _MyAppointmentsState extends State<MyAppointments>
} }
Widget getBookedAppointments() { Widget getBookedAppointments() {
return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital);
}
Widget _getAppointment(int _listLength, List<PatientAppointmentList> _list) {
return Container( return Container(
child: Container( child: Container(
child: widget.bookedAppoList.length != 0 child: _listLength != 0
? SingleChildScrollView( ? _appointmentExpandableList(_list)
physics: BouncingScrollPhysics(),
child: Column(
children: <Widget>[
...List.generate(
filterType == FilterType.Clinic
? widget._patientBookedAppointmentListClinic.length
: widget._patientBookedAppointmentListHospital.length,
(index) => AppExpandableNotifier(
title: filterType == FilterType.Clinic
? widget
._patientBookedAppointmentListClinic[index]
.filterName
: widget
._patientBookedAppointmentListHospital[index]
.filterName,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: filterType == FilterType.Clinic
? widget
._patientBookedAppointmentListClinic[index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList()
: widget
._patientBookedAppointmentListHospital[
index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList(),
)),
)
],
),
)
: Container( : Container(
child: Center( child: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset("assets/images/new-design/noAppointmentIcon.png"),
"assets/images/new-design/noAppointmentIcon.png"),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).noBookedAppo, child: Text(
style: TextStyle( TranslationBase.of(context).noBookedAppo,
fontSize: 16.0, style: TextStyle(
)), fontSize: 16.0,
),
),
), ),
], ],
), ),
@ -455,144 +325,57 @@ class _MyAppointmentsState extends State<MyAppointments>
); );
} }
Widget _appointmentExpandableList(List<PatientAppointmentList> _patientAppointmentList) {
return ListView.separated(
physics: BouncingScrollPhysics(),
// padding: EdgeInsets.only(left: 21, right: 21),
separatorBuilder: (context, index) {
return Container(
height: 1,
margin: EdgeInsets.only(left: 21, right: 21),
color: Color(0xffD9D9D9),
);
},
itemBuilder: (context, index) {
List<AppoitmentAllHistoryResultList> _appointmentAllHistoryResultList = _patientAppointmentList[index].patientDoctorAppointmentList;
return AppExpandableNotifier(
title: _patientAppointmentList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
AppoitmentAllHistoryResultList _appointmentResult = _appointmentAllHistoryResultList[_index];
bool _isSortByClinic = filterType == FilterType.Clinic;
return DoctorCard(
onTap: () => Navigator.push(context, FadePage(page: AppointmentDetails(appo: _appointmentResult))).then((value) {
getPatientAppointmentHistory();
}),
isInOutPatient: _appointmentResult.isInOutPatient,
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),
isSortByClinic: _isSortByClinic,
//projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate),
);
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: _appointmentAllHistoryResultList.length),
);
},
itemCount: _patientAppointmentList.length,
);
}
Widget getConfirmedAppointments() { Widget getConfirmedAppointments() {
return widget.confirmedAppoList.length != 0 return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital);
? Container(
margin: EdgeInsets.only(top: 10.0),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: <Widget>[
...List.generate(
filterType == FilterType.Clinic
? widget._patientConfirmedAppointmentListClinic.length
: widget
._patientConfirmedAppointmentListHospital.length,
(index) => AppExpandableNotifier(
title: filterType == FilterType.Clinic
? widget
._patientConfirmedAppointmentListClinic[index]
.filterName
: widget
._patientConfirmedAppointmentListHospital[index]
.filterName,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: filterType == FilterType.Clinic
? widget
._patientConfirmedAppointmentListClinic[index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList()
: widget
._patientConfirmedAppointmentListHospital[
index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList(),
)),
)
],
),
),
)
: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/images/new-design/noAppointmentIcon.png"),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).noConfirmedAppo,
style: TextStyle(
fontSize: 16.0,
)),
),
],
),
),
);
} }
Widget getArrivedAppointments() { Widget getArrivedAppointments() {
return widget.arrivedAppoList.length != 0 return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital);
? Container(
margin: EdgeInsets.only(top: 10.0),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: <Widget>[
...List.generate(
filterType == FilterType.Clinic
? widget._patientArrivedAppointmentListClinic.length
: widget._patientArrivedAppointmentListHospital.length,
(index) => AppExpandableNotifier(
title: filterType == FilterType.Clinic
? widget._patientArrivedAppointmentListClinic[index]
.filterName
: widget._patientArrivedAppointmentListHospital[index]
.filterName,
bodyWidget: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: filterType == FilterType.Clinic
? widget._patientArrivedAppointmentListClinic[index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList()
: widget
._patientArrivedAppointmentListHospital[index]
.patientDoctorAppointmentList
.map((doctor) {
return AppointmentCard(
appo: doctor,
onReloadAppointmentHistory:
getPatientAppointmentHistory,
);
}).toList(),
),
),
)
],
),
),
)
: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/images/new-design/noAppointmentIcon.png"),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).noArrivedAppo,
style: TextStyle(
fontSize: 16.0,
)),
),
],
),
),
);
} }
setFilterType(FilterType filterType) { setFilterType(FilterType filterType) {

@ -91,7 +91,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
() => { () => {
Navigator.of(context).push(FadePage(page: LoginType())), Navigator.of(context).push(FadePage(page: LoginType())),
}, },
color: Color(0xff359846), color: Color(0xffD02127),
), ),
), ),
], ],

@ -4,9 +4,10 @@ import 'package:diplomaticquarterapp/core/model/labs/patient_lab_orders.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/labs_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart';
import 'package:diplomaticquarterapp/widgets/new_design/my_tab_view.dart';
import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart'; import 'package:diplomaticquarterapp/widgets/others/app_expandable_notifier.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -54,40 +55,43 @@ class LabsHomePage extends StatelessWidget {
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
return Container( return Container(
height: 1, height: 1,
color: Colors.grey, margin: EdgeInsets.only(left: 21, right: 21),
color: Color(0xffD9D9D9),
); );
}, },
itemBuilder: (context, index) { itemBuilder: (context, index) {
return AppExpandableNotifier( return AppExpandableNotifier(
title: model.patientLabOrdersList[index].filterName, title: model.patientLabOrdersList[index].filterName,
bodyWidget: ListView.separated( bodyWidget: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21), padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) { itemBuilder: (context, _index) {
PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index]; PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index];
bool _isSortByClinic = model.filterType == FilterType.Clinic;
return DoctorCard( return DoctorCard(
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
FadePage( FadePage(
page: LaboratoryResultPage( page: LaboratoryResultPage(
patientLabOrders: labOrder, patientLabOrders: labOrder,
), ),
), ),
), ),
isInOutPatient: labOrder.isInOutPatient, isInOutPatient: labOrder.isInOutPatient,
name: labOrder.doctorName, name: TranslationBase.of(context).dr + " " + labOrder.doctorName,
billNo: labOrder.projectName, billNo: labOrder.invoiceNo,
profileUrl: labOrder.doctorImageURL, profileUrl: labOrder.doctorImageURL,
subName: labOrder.clinicDescription, subName: _isSortByClinic ? labOrder.projectName : labOrder.clinicDescription,
isLiveCareAppointment: labOrder.isLiveCareAppointment, isLiveCareAppointment: labOrder.isLiveCareAppointment,
date: labOrder.orderDate date: labOrder.orderDate,
//projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate), isSortByClinic: _isSortByClinic,
); //projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate),
}, );
separatorBuilder: (context, index) => SizedBox(height: 14), },
itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length)); separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length),
);
}, },
itemCount: model.patientLabOrdersList.length), itemCount: model.patientLabOrdersList.length),
), ),
@ -98,49 +102,3 @@ class LabsHomePage extends StatelessWidget {
); );
} }
} }
// todo 'Sikander' move this widget to separate file, so can find easily
class MyTabView extends StatelessWidget {
final String title;
final FilterType value;
final FilterType groupValue;
final VoidCallback onPressed;
MyTabView(
this.title,
this.value,
this.groupValue,
this.onPressed, {
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onPressed,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 15),
Text(
title,
style: TextStyle(
fontSize: 16,
fontFamily: "Poppins",
fontWeight: FontWeight.w600,
color: value == groupValue ? Color(0xff2B353E) : Color(0xff575757),
letterSpacing: -0.48,
),
),
Container(
margin: EdgeInsets.only(top: 13),
height: 3,
color: value == groupValue ? Color(0xffD02127) : Colors.transparent,
)
],
),
),
);
}
}

@ -7,7 +7,7 @@ import 'package:diplomaticquarterapp/widgets/others/StarRating.dart';
import 'package:diplomaticquarterapp/widgets/others/rounded_container_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class DoctorCard extends StatelessWidget { class DoctorCard extends StatelessWidget {
@ -21,8 +21,10 @@ class DoctorCard extends StatelessWidget {
final Function onEmailTap; final Function onEmailTap;
final bool isInOutPatient; final bool isInOutPatient;
final bool isLiveCareAppointment; final bool isLiveCareAppointment;
final bool isSortByClinic;
DoctorCard({this.name, this.subName, this.rat, this.date, this.profileUrl, this.billNo, this.onTap, this.onEmailTap, this.isInOutPatient, this.isLiveCareAppointment = false}); DoctorCard(
{this.name, this.subName, this.rat, this.date, this.profileUrl, this.isSortByClinic = true, this.billNo, this.onTap, this.onEmailTap, this.isInOutPatient, this.isLiveCareAppointment = false});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -35,7 +37,7 @@ class DoctorCard extends StatelessWidget {
), ),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Color(0x0000000D), color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5, //spreadRadius: 5,
blurRadius: 27, blurRadius: 27,
offset: Offset(0, -3), offset: Offset(0, -3),
@ -48,15 +50,10 @@ class DoctorCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
Container( Container(
// width: 16, // projectViewModel.isArabic ? 27 : 20, // width: 16, // projectViewModel.isArabic ? 27 : 20,
height: double.infinity, height: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
// height: date == null padding: EdgeInsets.only(left: 2, right: 2),
// ? projectViewModel.isArabic
// ? 185
// : 100
// : 180,
padding: EdgeInsets.only(left: 2,right: 2),
decoration: BoxDecoration( decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545) //Colors.red[900] Color(0xff404545)
color: isLiveCareAppointment color: isLiveCareAppointment
@ -75,10 +72,10 @@ class DoctorCard extends StatelessWidget {
quarterTurns: 3, quarterTurns: 3,
child: Text( child: Text(
isLiveCareAppointment isLiveCareAppointment
? TranslationBase.of(context).liveCare.toUpperCase() ? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach
: !isInOutPatient : !isInOutPatient
? TranslationBase.of(context).inPatient.toUpperCase() ? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach
: TranslationBase.of(context).outpatient.toUpperCase(), : TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach,
style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10), style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Colors.white, letterSpacing: -0.2, height: 16 / 10),
), ),
), ),
@ -96,7 +93,7 @@ class DoctorCard extends StatelessWidget {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
TranslationBase.of(context).dr + " " + name, (name ?? ""),
style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), style: TextStyle(fontSize: 16, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
), ),
), ),
@ -132,7 +129,7 @@ class DoctorCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
myRichText(TranslationBase.of(context).clinic + ":", subName), myRichText(isSortByClinic ? TranslationBase.of(context).hospital : TranslationBase.of(context).clinic + ":", subName),
myRichText(TranslationBase.of(context).billNo, billNo ?? ""), myRichText(TranslationBase.of(context).billNo, billNo ?? ""),
//if (rat != null) StarRating(totalAverage: rat, forceStars: true), //if (rat != null) StarRating(totalAverage: rat, forceStars: true),
], ],

@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:diplomaticquarterapp/core/enum/filter_type.dart';
class MyTabView extends StatelessWidget {
final String title;
final FilterType value;
final FilterType groupValue;
final VoidCallback onPressed;
MyTabView(
this.title,
this.value,
this.groupValue,
this.onPressed, {
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: InkWell(
onTap: onPressed,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 15),
Text(
title,
style: TextStyle(
fontSize: 16,
fontFamily: "Poppins",
fontWeight: FontWeight.w600,
color: value == groupValue ? Color(0xff2B353E) : Color(0xff575757),
letterSpacing: -0.48,
),
),
Container(
margin: EdgeInsets.only(top: 13),
height: 3,
color: value == groupValue ? Color(0xffD02127) : Colors.transparent,
)
],
),
),
);
}
}

@ -3,7 +3,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../Constants.dart'; import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
/// App Expandable Notifier with animation /// App Expandable Notifier with animation
/// [headerWidget] widget want to show in the header /// [headerWidget] widget want to show in the header
@ -37,6 +37,17 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String _mainTitle = (widget.title ?? TranslationBase.of(context).details);
String _title = _mainTitle.split(" ")[0];
String _subTitle = _mainTitle.replaceAll(_title, "").trim();
if (_subTitle.length < 1) {
_subTitle = _title.toLowerCase().capitalizeFirstofEach;
_title = "";
} else {
_subTitle = _subTitle.toLowerCase().capitalizeFirstofEach;
_title = _title.toLowerCase().capitalizeFirstofEach;
}
return ExpandableNotifier( return ExpandableNotifier(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
@ -52,32 +63,41 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
headerAlignment: ExpandablePanelHeaderAlignment.center, headerAlignment: ExpandablePanelHeaderAlignment.center,
tapBodyToCollapse: true, tapBodyToCollapse: true,
), ),
header: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ header: Padding(
Expanded( padding: const EdgeInsets.only(top: 12, bottom: 12, left: 21, right: 21),
child: Padding( child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
padding: EdgeInsets.all(10), Expanded(
child: Text( child: Column(
widget.title ?? TranslationBase.of(context).details, mainAxisSize: MainAxisSize.min,
style: TextStyle( crossAxisAlignment: CrossAxisAlignment.start,
fontWeight: FontWeight.bold, children: [
fontSize: SizeConfig.textMultiplier * 2, if (_title.isNotEmpty)
), Text(
_title,
style: TextStyle(fontSize: 12, fontFamily: "Poppins", fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.72, height: 23 / 12),
),
Text(
_subTitle,
maxLines: 1,
style: TextStyle(fontSize: 24, fontFamily: "Poppins", fontWeight: FontWeight.w700, color: Color(0xff2E303A), letterSpacing: -1.44, height: 25 / 24),
),
],
), ),
), ),
), IconButton(
IconButton( icon: Icon(
icon: Icon( widget.expandFlag ? Icons.remove : Icons.add,
widget.expandFlag ? Icons.remove : Icons.add, color: Color(0xff2E303A),
color: Color(0xff2E303A), // size: 30.0,
// size: 30.0, ),
), onPressed: () {
onPressed: () { setState(() {
setState(() { widget.expandFlag = !widget.expandFlag;
widget.expandFlag = !widget.expandFlag; widget.controller.expanded = widget.expandFlag;
widget.controller.expanded = widget.expandFlag; });
}); }),
}), ]),
]), ),
collapsed: widget.collapsed ?? Container(), collapsed: widget.collapsed ?? Container(),
expanded: widget.bodyWidget, expanded: widget.bodyWidget,
builder: (_, collapsed, expanded) { builder: (_, collapsed, expanded) {

Loading…
Cancel
Save