appointment ui (cont.) & improvement.

merge-requests/390/head
Sikander Saleem 3 years ago
parent ff55ae1908
commit 5b778f0493

@ -13,8 +13,8 @@ const PACKAGES_CUSTOMER = '/api/customers';
const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items';
const PACKAGES_ORDERS = '/api/orders';
//const BASE_URL = 'https://uat.hmgwebservices.com/';
const BASE_URL = 'https://hmgwebservices.com/';
const BASE_URL = 'https://uat.hmgwebservices.com/';
//const BASE_URL = 'https://hmgwebservices.com/';
// Pharmacy UAT URLs
//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/core/enum/filter_type.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/viewModels/project_view_model.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/uitl/app_shared_preferences.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/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_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'AppointmentDetails.dart';
class MyAppointments extends StatefulWidget {
List<AppoitmentAllHistoryResultList> appoList = [];
@ -25,8 +32,7 @@ class MyAppointments extends StatefulWidget {
List<AppoitmentAllHistoryResultList> arrivedAppoList = [];
List<PatientAppointmentList> _patientBookedAppointmentListHospital = List();
List<PatientAppointmentList> _patientConfirmedAppointmentListHospital =
List();
List<PatientAppointmentList> _patientConfirmedAppointmentListHospital = List();
List<PatientAppointmentList> _patientArrivedAppointmentListHospital = List();
List<PatientAppointmentList> _patientBookedAppointmentListClinic = List();
@ -37,14 +43,12 @@ class MyAppointments extends StatefulWidget {
_MyAppointmentsState createState() => _MyAppointmentsState();
}
class _MyAppointmentsState extends State<MyAppointments>
with SingleTickerProviderStateMixin {
class _MyAppointmentsState extends State<MyAppointments> with SingleTickerProviderStateMixin {
TabController _tabController;
bool isDataLoaded = false;
var sharedPref = new AppSharedPreferences();
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
List<ImagesInfo> imagesInfo = List();
@ -55,43 +59,35 @@ class _MyAppointmentsState extends State<MyAppointments>
_tabController = new TabController(length: 3, vsync: this);
filterType = FilterType.Clinic;
WidgetsBinding.instance.addPostFrameCallback((_) {
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin)
getPatientAppointmentHistory();
if (Provider.of<ProjectViewModel>(context, listen: false).isLogin) getPatientAppointmentHistory();
});
imagesInfo.add(ImagesInfo(
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'));
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'));
imagesInfo.add(ImagesInfo(
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'));
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'));
super.initState();
}
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: TranslationBase.of(context).myAppointments,
appBarTitle: TranslationBase.of(context).myAppointmentsList,
isShowAppBar: true,
imagesInfo: imagesInfo,
showNewAppBar: true,
backgroundColor: Color(0xffF8F8F8),
showNewAppBarTitle: true,
description: TranslationBase.of(context).infoMyAppointments,
body: Container(
child: Column(children: [
TabBar(
tabs: [
Tab(child: Text(TranslationBase.of(context).booked, style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).booked,
style: TextStyle(color: Colors.black))),
Tab(
child: Text(TranslationBase.of(context).confirmed,
style: TextStyle(color: Colors.black)),
child: Text(TranslationBase.of(context).confirmed, style: TextStyle(color: Colors.black)),
),
Tab(
child: Text(TranslationBase.of(context).arrived,
style: TextStyle(color: Colors.black)),
child: Text(TranslationBase.of(context).arrived, style: TextStyle(color: Colors.black)),
)
],
controller: _tabController,
@ -101,50 +97,20 @@ class _MyAppointmentsState extends State<MyAppointments>
thickness: 0.5,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: InkWell(
onTap: () => setFilterType(FilterType.Clinic),
child: ListTile(
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),
),
),
),
)
children: [
MyTabView(TranslationBase.of(context).byClinic, FilterType.Clinic, filterType, () {
setFilterType(FilterType.Clinic);
}),
MyTabView(TranslationBase.of(context).byHospital, FilterType.Hospital, filterType, () {
setFilterType(FilterType.Hospital);
}),
],
),
isDataLoaded
? Expanded(
child: new TabBarView(
physics: NeverScrollableScrollPhysics(),
children: [
getBookedAppointments(),
getConfirmedAppointments(),
getArrivedAppointments()
],
children: [getBookedAppointments(), getConfirmedAppointments(), getArrivedAppointments()],
controller: _tabController,
),
)
@ -179,8 +145,7 @@ class _MyAppointmentsState extends State<MyAppointments>
if (res['AppoimentAllHistoryResultList'].length != 0) {
// isDataLoaded = true;
res['AppoimentAllHistoryResultList'].forEach((v) {
widget.appoList
.add(new AppoitmentAllHistoryResultList.fromJson(v));
widget.appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
});
sortAppointmentList();
} else {}
@ -226,135 +191,80 @@ class _MyAppointmentsState extends State<MyAppointments>
});
widget.bookedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic =
widget._patientBookedAppointmentListClinic
.where(
(elementClinic) =>
elementClinic.filterName == element.clinicName,
)
.toList();
List<PatientAppointmentList> doctorByClinic = widget._patientBookedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.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));
widget._patientBookedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital =
widget._patientBookedAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<PatientAppointmentList> doctorByHospital = widget._patientBookedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.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));
widget._patientBookedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
});
widget.confirmedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic =
widget._patientConfirmedAppointmentListClinic
.where(
(elementClinic) =>
elementClinic.filterName == element.clinicName,
)
.toList();
List<PatientAppointmentList> doctorByClinic = widget._patientConfirmedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.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));
widget._patientConfirmedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital =
widget._patientConfirmedAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<PatientAppointmentList> doctorByHospital = widget._patientConfirmedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.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));
widget._patientConfirmedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
});
widget.arrivedAppoList.forEach((element) {
List<PatientAppointmentList> doctorByClinic =
widget._patientArrivedAppointmentListClinic
.where(
(elementClinic) =>
elementClinic.filterName == element.clinicName,
)
.toList();
List<PatientAppointmentList> doctorByClinic = widget._patientArrivedAppointmentListClinic
.where(
(elementClinic) => elementClinic.filterName == element.clinicName,
)
.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));
widget._patientArrivedAppointmentListClinic.add(PatientAppointmentList(filterName: element.clinicName, patientDoctorAppointment: element));
}
List<PatientAppointmentList> doctorByHospital =
widget._patientArrivedAppointmentListHospital
.where(
(elementClinic) =>
elementClinic.filterName == element.projectName,
)
.toList();
List<PatientAppointmentList> doctorByHospital = widget._patientArrivedAppointmentListHospital
.where(
(elementClinic) => elementClinic.filterName == element.projectName,
)
.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));
widget._patientArrivedAppointmentListHospital.add(PatientAppointmentList(filterName: element.projectName, patientDoctorAppointment: element));
}
openAppointmentsTab();
@ -383,69 +293,29 @@ class _MyAppointmentsState extends State<MyAppointments>
}
Widget getBookedAppointments() {
return _getAppointment(widget.bookedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientBookedAppointmentListClinic : widget._patientBookedAppointmentListHospital);
}
Widget _getAppointment(int _listLength, List<PatientAppointmentList> _list) {
return Container(
child: Container(
child: widget.bookedAppoList.length != 0
? SingleChildScrollView(
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(),
)),
)
],
),
)
child: _listLength != 0
? _appointmentExpandableList(_list)
: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/images/new-design/noAppointmentIcon.png"),
Image.asset("assets/images/new-design/noAppointmentIcon.png"),
Container(
margin: EdgeInsets.only(top: 10.0),
child: Text(TranslationBase.of(context).noBookedAppo,
style: TextStyle(
fontSize: 16.0,
)),
child: Text(
TranslationBase.of(context).noBookedAppo,
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() {
return widget.confirmedAppoList.length != 0
? 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,
)),
),
],
),
),
);
return _getAppointment(widget.confirmedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientConfirmedAppointmentListClinic : widget._patientConfirmedAppointmentListHospital);
}
Widget getArrivedAppointments() {
return widget.arrivedAppoList.length != 0
? 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,
)),
),
],
),
),
);
return _getAppointment(widget.arrivedAppoList.length, (filterType == FilterType.Clinic) ? widget._patientArrivedAppointmentListClinic : widget._patientArrivedAppointmentListHospital);
}
setFilterType(FilterType filterType) {

@ -91,7 +91,7 @@ class _WelcomeLogin extends State<WelcomeLogin> {
() => {
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/project_view_model.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/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_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -54,40 +55,43 @@ class LabsHomePage extends StatelessWidget {
separatorBuilder: (context, index) {
return Container(
height: 1,
color: Colors.grey,
margin: EdgeInsets.only(left: 21, right: 21),
color: Color(0xffD9D9D9),
);
},
itemBuilder: (context, index) {
return AppExpandableNotifier(
title: model.patientLabOrdersList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(left: 21, right: 21),
itemBuilder: (context, _index) {
PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index];
return DoctorCard(
onTap: () => Navigator.push(
context,
FadePage(
page: LaboratoryResultPage(
patientLabOrders: labOrder,
),
),
),
isInOutPatient: labOrder.isInOutPatient,
name: labOrder.doctorName,
billNo: labOrder.projectName,
profileUrl: labOrder.doctorImageURL,
subName: labOrder.clinicDescription,
isLiveCareAppointment: labOrder.isLiveCareAppointment,
date: labOrder.orderDate
//projectViewModel.isArabic ? DateUtil.getMonthDayYearDateFormattedAr(labOrder.orderDate) : DateUtil.getMonthDayYearDateFormatted(labOrder.orderDate),
);
},
separatorBuilder: (context, index) => SizedBox(height: 14),
itemCount: model.patientLabOrdersList[index].patientLabOrdersList.length));
title: model.patientLabOrdersList[index].filterName,
bodyWidget: ListView.separated(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
padding: EdgeInsets.only(bottom: 14, top: 14, left: 21, right: 21),
itemBuilder: (context, _index) {
PatientLabOrders labOrder = model.patientLabOrdersList[index].patientLabOrdersList[_index];
bool _isSortByClinic = model.filterType == FilterType.Clinic;
return DoctorCard(
onTap: () => Navigator.push(
context,
FadePage(
page: LaboratoryResultPage(
patientLabOrders: labOrder,
),
),
),
isInOutPatient: labOrder.isInOutPatient,
name: TranslationBase.of(context).dr + " " + labOrder.doctorName,
billNo: labOrder.invoiceNo,
profileUrl: labOrder.doctorImageURL,
subName: _isSortByClinic ? labOrder.projectName : labOrder.clinicDescription,
isLiveCareAppointment: labOrder.isLiveCareAppointment,
date: 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),
);
},
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:flutter/cupertino.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';
class DoctorCard extends StatelessWidget {
@ -21,8 +21,10 @@ class DoctorCard extends StatelessWidget {
final Function onEmailTap;
final bool isInOutPatient;
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
Widget build(BuildContext context) {
@ -35,7 +37,7 @@ class DoctorCard extends StatelessWidget {
),
boxShadow: [
BoxShadow(
color: Color(0x0000000D),
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
@ -48,15 +50,10 @@ class DoctorCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
// width: 16, // projectViewModel.isArabic ? 27 : 20,
// width: 16, // projectViewModel.isArabic ? 27 : 20,
height: double.infinity,
alignment: Alignment.center,
// height: date == null
// ? projectViewModel.isArabic
// ? 185
// : 100
// : 180,
padding: EdgeInsets.only(left: 2,right: 2),
padding: EdgeInsets.only(left: 2, right: 2),
decoration: BoxDecoration(
//Colors.red[900] Color(0xff404545)
color: isLiveCareAppointment
@ -75,10 +72,10 @@ class DoctorCard extends StatelessWidget {
quarterTurns: 3,
child: Text(
isLiveCareAppointment
? TranslationBase.of(context).liveCare.toUpperCase()
? TranslationBase.of(context).liveCare.toLowerCase().capitalizeFirstofEach
: !isInOutPatient
? TranslationBase.of(context).inPatient.toUpperCase()
: TranslationBase.of(context).outpatient.toUpperCase(),
? TranslationBase.of(context).inPatient.toLowerCase().capitalizeFirstofEach
: TranslationBase.of(context).outpatient.toLowerCase().capitalizeFirstofEach,
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: [
Expanded(
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),
),
),
@ -132,7 +129,7 @@ class DoctorCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
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 ?? ""),
//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:flutter/material.dart';
import '../../Constants.dart';
import 'package:diplomaticquarterapp/extensions/string_extensions.dart';
/// App Expandable Notifier with animation
/// [headerWidget] widget want to show in the header
@ -37,6 +37,17 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
@override
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(
child: Column(
children: <Widget>[
@ -52,32 +63,41 @@ class _AppExpandableNotifier extends State<AppExpandableNotifier> {
headerAlignment: ExpandablePanelHeaderAlignment.center,
tapBodyToCollapse: true,
),
header: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Expanded(
child: Padding(
padding: EdgeInsets.all(10),
child: Text(
widget.title ?? TranslationBase.of(context).details,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: SizeConfig.textMultiplier * 2,
),
header: Padding(
padding: const EdgeInsets.only(top: 12, bottom: 12, left: 21, right: 21),
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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(
icon: Icon(
widget.expandFlag ? Icons.remove : Icons.add,
color: Color(0xff2E303A),
// size: 30.0,
),
onPressed: () {
setState(() {
widget.expandFlag = !widget.expandFlag;
widget.controller.expanded = widget.expandFlag;
});
}),
]),
IconButton(
icon: Icon(
widget.expandFlag ? Icons.remove : Icons.add,
color: Color(0xff2E303A),
// size: 30.0,
),
onPressed: () {
setState(() {
widget.expandFlag = !widget.expandFlag;
widget.controller.expanded = widget.expandFlag;
});
}),
]),
),
collapsed: widget.collapsed ?? Container(),
expanded: widget.bodyWidget,
builder: (_, collapsed, expanded) {

Loading…
Cancel
Save