CMC 1.6
parent
f20883184e
commit
96b971ef01
@ -1,136 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/models/hmg_services.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/pharmacy_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart';
|
||||
import 'package:diplomaticquarterapp/theme/colors.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HomePageFragment extends StatefulWidget {
|
||||
Function onPharmacyClick, onLoginClick;
|
||||
|
||||
HomePageFragment({this.onPharmacyClick, this.onLoginClick});
|
||||
|
||||
@override
|
||||
_HomePageFragmentState createState() => _HomePageFragmentState();
|
||||
}
|
||||
|
||||
class _HomePageFragmentState extends State<HomePageFragment> {
|
||||
List<HmgServices> hmgServices = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
// getFamilyFiles();
|
||||
}
|
||||
|
||||
initialiseHmgServices(bool isLogin) {
|
||||
hmgServices.clear();
|
||||
hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(2, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(4, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Refferal.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergency, TranslationBase.of(context).services, "assets/images/new/RRT.svg", isLogin));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
initialiseHmgServices(false);
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 2.3,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 14, right: 14, top: 10, bottom: 10),
|
||||
child: SliderView(
|
||||
onLoginClick: () {
|
||||
widget.onLoginClick();
|
||||
},
|
||||
),
|
||||
// height: MediaQuery.of(context).size.width / 2.6,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Image.asset("assets/images/bn_offer.png"),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 16,
|
||||
),
|
||||
child: PharmacyView(
|
||||
onPharmacyClick: () {
|
||||
widget.onPharmacyClick();
|
||||
},
|
||||
),
|
||||
),
|
||||
mHeight(16),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 8,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
TranslationBase.of(context).hMGService,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.push(context, FadePage(page: AllHabibMedicalService()));
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).viewAllServices,
|
||||
style: TextStyle(
|
||||
color: CustomColors.accentColor,
|
||||
fontSize: 14,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 4,
|
||||
),
|
||||
child: GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemCount: hmgServices.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return ServicesView(hmgServices[index], index);
|
||||
}),
|
||||
),
|
||||
],
|
||||
),
|
||||
mHeight(140),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,422 +0,0 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
|
||||
import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStatusResponse.dart';
|
||||
import 'package:diplomaticquarterapp/models/gradient_color.dart';
|
||||
import 'package:diplomaticquarterapp/models/hmg_services.dart';
|
||||
import 'package:diplomaticquarterapp/models/slider_data.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/MyAppointments/MyAppointments.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/pharmacy_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/services_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/landing/widgets/slider_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart';
|
||||
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||
import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart';
|
||||
import 'package:diplomaticquarterapp/theme/colors.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/uitl/utils.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart' as s;
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class LoggedHomePageFragment extends StatefulWidget {
|
||||
ProjectViewModel projectViewModel;
|
||||
Function onPharmacyClick;
|
||||
|
||||
LoggedHomePageFragment(this.projectViewModel, {this.onPharmacyClick});
|
||||
|
||||
@override
|
||||
_HomePageFragmentState createState() => _HomePageFragmentState();
|
||||
}
|
||||
|
||||
class _HomePageFragmentState extends State<LoggedHomePageFragment> {
|
||||
List<HmgServices> hmgServices = [];
|
||||
var familyFileProvider = FamilyFilesProvider();
|
||||
List<AppoitmentAllHistoryResultList> appoList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
|
||||
getPatientAppointmentHistory1();
|
||||
// getPatientAppointmentHistory1();
|
||||
// getFamilyFiles();
|
||||
}
|
||||
|
||||
initialiseHmgServices(bool isLogin) {
|
||||
hmgServices.clear();
|
||||
hmgServices.add(new HmgServices(0, TranslationBase.of(context).liveCare, TranslationBase.of(context).onlineConsulting, "assets/images/new/Live_Care.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(1, TranslationBase.of(context).covidTest, TranslationBase.of(context).driveThru, "assets/images/new/covid_test_drive_thru.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(2, TranslationBase.of(context).checkup, TranslationBase.of(context).comprehensive, "assets/images/new/comprehensive_checkup.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(3, TranslationBase.of(context).hhcHome, TranslationBase.of(context).healthCare, "assets/images/new/HHC.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(4, TranslationBase.of(context).refferal, TranslationBase.of(context).services2, "assets/images/new/E_Refferal.svg", isLogin));
|
||||
hmgServices.add(new HmgServices(5, TranslationBase.of(context).emergency, TranslationBase.of(context).services, "assets/images/new/RRT.svg", isLogin));
|
||||
}
|
||||
|
||||
Future<GetAllSharedRecordsByStatusResponse> getFamilyFiles() async {
|
||||
if (widget.projectViewModel.user != null) {
|
||||
print("calling_family");
|
||||
|
||||
if (await s.sharedPref.getObject(FAMILY_FILE) != null) {
|
||||
// print(await sharedPref.getObject(FAMILY_FILE));
|
||||
return Future.value(GetAllSharedRecordsByStatusResponse.fromJson(await s.sharedPref.getObject(FAMILY_FILE)));
|
||||
} else {
|
||||
return familyFileProvider.getSharedRecordByStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
initialiseHmgServices(false);
|
||||
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
|
||||
List<Widget> myMedicalList = Utils.myMedicalListHomePage(projectViewModel: widget.projectViewModel, context: context, count: appoCountProvider.count, isLogin: widget.projectViewModel.isLogin);
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
children: [
|
||||
AspectRatio(
|
||||
aspectRatio: 2.3,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20, top: 16, bottom: 16),
|
||||
child: LoggedSliderView(
|
||||
widget.projectViewModel,
|
||||
new SliderData(TranslationBase.of(context).fileno + ": " + widget.projectViewModel.user.patientID.toString(),
|
||||
widget.projectViewModel.user.firstName + ' ' + widget.projectViewModel.user.lastName, "", bannerColor[0].darkColor, bannerColor[0].lightColor),
|
||||
null),
|
||||
),
|
||||
),
|
||||
appoCountProvider.count == 0
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Image.asset("assets/images/bn_offer.png"),
|
||||
)
|
||||
: offersView(appoCountProvider.count),
|
||||
mHeight(16),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.width * 0.26,
|
||||
child: ListView.separated(
|
||||
itemCount: 4,
|
||||
padding: EdgeInsets.zero,
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return widget.projectViewModel.isArabic
|
||||
? Container(
|
||||
child: myMedicalList[index],
|
||||
width: MediaQuery.of(context).size.width * 0.26,
|
||||
margin: EdgeInsets.only(left: index == 3 ? 20 : 0, right: index == 0 ? 20 : 0),
|
||||
)
|
||||
: Container(
|
||||
child: myMedicalList[index],
|
||||
width: MediaQuery.of(context).size.width * 0.26,
|
||||
margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: index == 3 ? 20 : 0),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return mWidth(12);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: widget.projectViewModel.isArabic
|
||||
? EdgeInsets.only(
|
||||
right: 20,
|
||||
left: 8,
|
||||
top: 0,
|
||||
)
|
||||
: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 8,
|
||||
top: 0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
mFlex(1),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
navigateTo(context, MedicalProfilePageNew());
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).viewMedicalFile,
|
||||
style: TextStyle(
|
||||
color: CustomColors.accentColor,
|
||||
fontSize: 14,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 20,
|
||||
top: 4,
|
||||
),
|
||||
child: PharmacyView(
|
||||
onPharmacyClick: () {
|
||||
widget.onPharmacyClick();
|
||||
},
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: widget.projectViewModel.isArabic
|
||||
? EdgeInsets.only(
|
||||
right: 20,
|
||||
left: 8,
|
||||
top: 4,
|
||||
)
|
||||
: EdgeInsets.only(
|
||||
left: 20,
|
||||
right: 8,
|
||||
top: 4,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
TranslationBase.of(context).hMGService,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.push(context, FadePage(page: AllHabibMedicalService()));
|
||||
},
|
||||
child: Text(
|
||||
TranslationBase.of(context).viewAllServices,
|
||||
style: TextStyle(
|
||||
color: CustomColors.accentColor,
|
||||
fontSize: 14,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
mHeight(4),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.of(context).size.width * 0.26,
|
||||
child: ListView.separated(
|
||||
itemCount: hmgServices.length,
|
||||
padding: EdgeInsets.zero,
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width * 0.26,
|
||||
margin: widget.projectViewModel.isArabic
|
||||
? EdgeInsets.only(left: index == hmgServices.length - 1 ? 20 : 0, right: index == 0 ? 20 : 0)
|
||||
: EdgeInsets.only(left: index == 0 ? 20 : 0, right: index == hmgServices.length - 1 ? 20 : 0),
|
||||
child: ServicesView(hmgServices[index], index),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return mWidth(12);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
mHeight(140),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget offersView(int counts) {
|
||||
if (appoList.length > 0) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.width / 4.35,
|
||||
child: ListView.separated(
|
||||
itemCount: 2,
|
||||
padding: EdgeInsets.zero,
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
return index == 0
|
||||
? Container(
|
||||
width: MediaQuery.of(context).size.width / 1.123,
|
||||
height: MediaQuery.of(context).size.width / 4.35,
|
||||
margin: widget.projectViewModel.isArabic ? EdgeInsets.only(right: index == 0 ? 20 : 0) : EdgeInsets.only(left: index == 0 ? 20 : 0),
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: containerColorRadiusBorderWidth(Colors.white, 16, Colors.black, 2),
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
circularAviator(MediaQuery.of(context).size.width / 10, brColor: Colors.white, elevation: 1),
|
||||
mWidth(8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
appoList[index].doctorTitle + " " + appoList[index].doctorNameObj,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.watch_later_rounded,
|
||||
size: 16,
|
||||
),
|
||||
mWidth(4),
|
||||
Expanded(
|
||||
child: AutoSizeText(
|
||||
DateUtil.getWeekDayMonthDayYearDateFormatted(
|
||||
DateUtil.convertStringToDate(appoList[index].appointmentDate), widget.projectViewModel.isArabic ? "ar" : "en") +
|
||||
" " +
|
||||
appoList[index].startTime.substring(0, 5),
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.notifications_active_sharp,
|
||||
color: Color(0xFF9D9D9D),
|
||||
size: 16,
|
||||
),
|
||||
mWidth(4),
|
||||
Text(
|
||||
"Remind me",
|
||||
style: TextStyle(
|
||||
color: Color(0xFF9D9D9D),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
mFlex(1),
|
||||
Flexible(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: [
|
||||
// Text(
|
||||
// "Appointment Details",
|
||||
// style: TextStyle(
|
||||
// color: CustomColors.accentColor,
|
||||
// decoration: TextDecoration.underline,
|
||||
// ),
|
||||
// ),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.push(context, FadePage(page: MyAppointments()));
|
||||
},
|
||||
child: Text(
|
||||
"Appointment Details",
|
||||
style: TextStyle(
|
||||
color: CustomColors.accentColor,
|
||||
fontSize: 14,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
),
|
||||
),
|
||||
mFlex(1),
|
||||
Icon(Icons.arrow_forward),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: widget.projectViewModel.isArabic ? EdgeInsets.only(left: index == 1 ? 20 : 0) : EdgeInsets.only(right: index == 1 ? 20 : 0),
|
||||
child: Container(
|
||||
child: showOfferImage(),
|
||||
width: MediaQuery.of(context).size.width / 1.123,
|
||||
),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (BuildContext context, int index) {
|
||||
return mWidth(12);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Image.asset("assets/images/bn_offer.png"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Widget showOfferImage() {
|
||||
return Image.asset(
|
||||
"assets/images/bn_offer.png",
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
}
|
||||
|
||||
getPatientAppointmentHistory1() async {
|
||||
DoctorsListService service = new DoctorsListService();
|
||||
|
||||
Map res = await service.getPatientAppointmentHistory(true, context);
|
||||
// appoList.clear();
|
||||
if (res['MessageStatus'] == 1) {
|
||||
if (res['AppoimentAllHistoryResultList'].length != 0) {
|
||||
appoList.clear();
|
||||
res['AppoimentAllHistoryResultList'].forEach((v) {
|
||||
appoList.add(new AppoitmentAllHistoryResultList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
@ -1,892 +0,0 @@
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/locator.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/cmc_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/home_health_care_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/all_habib_medical_service_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ContactUs/contact_us_page.dart';
|
||||
import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart';
|
||||
import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
|
||||
import 'package:diplomaticquarterapp/pages/packages_offers/OfferAndPackagesPage.dart';
|
||||
import 'package:diplomaticquarterapp/pages/paymentService/payment_service.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/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'landing_page_pharmcy.dart';
|
||||
|
||||
class HomePage extends StatefulWidget {
|
||||
final Function goToMyProfile;
|
||||
|
||||
HomePage({Key key, this.goToMyProfile});
|
||||
|
||||
@override
|
||||
_HomePageState createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage> {
|
||||
PharmacyModuleViewModel pharmacyModuleViewModel = locator<PharmacyModuleViewModel>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ProjectViewModel projectViewModel = Provider.of(context);
|
||||
return BaseView<DashboardViewModel>(
|
||||
onModelReady: (model) => () async {},
|
||||
builder: (_, model, wi) => AppScaffold(
|
||||
isShowDecPage: false,
|
||||
isHelp: true,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 210,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/dashboard_top_bg.png'), fit: BoxFit.cover),
|
||||
),
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 15,
|
||||
left: 5,
|
||||
right: 5,
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 125,
|
||||
padding: EdgeInsets.all(5),
|
||||
margin: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("assets/images/new-design/covid_bg_transparent.png"),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).covidTest,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 15.0,
|
||||
),
|
||||
child: SvgPicture.asset('assets/images/new-design/covid-19-car.svg', width: 45.0, height: 45.0),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 5.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).driveThru,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
ButtonTheme(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
minWidth: MediaQuery.of(context).size.width * 0.15,
|
||||
height: 25.0,
|
||||
child: RaisedButton(
|
||||
color: Colors.red[800],
|
||||
textColor: Colors.white,
|
||||
disabledTextColor: Colors.white,
|
||||
disabledColor: new Color(0xFFbcc2c4),
|
||||
onPressed: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
navigateToCovidDriveThru();
|
||||
},
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).bookNow,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.push(context, FadePage(page: LiveCareHome())),
|
||||
child: Container(
|
||||
height: 125,
|
||||
padding: EdgeInsets.all(15),
|
||||
margin: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(color: Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all(Radius.circular(5))),
|
||||
child: SvgPicture.asset(
|
||||
projectViewModel.isArabic ? 'assets/images/new-design/livecare_arabic_logo.svg' : 'assets/images/new-design/liveCare_white_logo.svg',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(width: double.infinity, height: projectViewModel.isArabic ? 110 : 80)
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
top: 155,
|
||||
left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
|
||||
right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == Orientation.landscape ? 0.02 : 0.03),
|
||||
child: (!model.isLogin)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: 125,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#A59E9E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(9)),
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).myMedicalFile,
|
||||
color: Colors.black87,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 23,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).myMedicalFileSubTitle,
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
),
|
||||
Align(
|
||||
alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
widget.goToMyProfile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
width: 90,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#D81A2E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(0)),
|
||||
),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
width: double.infinity,
|
||||
height: projectViewModel.isArabic ? 160 : 130,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#A59E9E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(9)),
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover),
|
||||
),
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
if (projectViewModel.user != null && model.isLogin)
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
model.user.cRSVerificationStatus == 2
|
||||
? Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
|
||||
child: SvgPicture.asset("assets/images/new-design/verification_check.svg"),
|
||||
),
|
||||
],
|
||||
)
|
||||
: model.user.cRSVerificationStatus == 3
|
||||
? Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 0.0),
|
||||
child: SvgPicture.asset("assets/images/new-design/pending.svg"),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Row(
|
||||
children: [
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.grey[100],
|
||||
bold: true,
|
||||
fontSize: 15,
|
||||
),
|
||||
],
|
||||
),
|
||||
Texts(
|
||||
'${model.user.patientID}',
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
'${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.gender == 1 ? TranslationBase.of(context).male : TranslationBase.of(context).female} ${model.user.age.toString() + "y"}',
|
||||
color: Colors.grey[100],
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
widget.goToMyProfile();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(2),
|
||||
width: 90,
|
||||
height: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: HexColor('#D81A2E'),
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(5),
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Texts(
|
||||
TranslationBase.of(context).myMedicalFile,
|
||||
color: Colors.white,
|
||||
fontSize: 12,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/height_icon.png',
|
||||
width: 35,
|
||||
height: 40,
|
||||
),
|
||||
Texts(
|
||||
"${model.heightCm} ${TranslationBase.of(context).cm}",
|
||||
color: Colors.white,
|
||||
fontSize: 17,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/weight_icon.png',
|
||||
width: 25,
|
||||
height: 40,
|
||||
),
|
||||
Texts('${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 17)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
Expanded(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/blood_icon.png',
|
||||
width: 35,
|
||||
height: 40,
|
||||
),
|
||||
Texts('${model.booldType}', color: Colors.white, fontSize: 17)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15, right: 15, left: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesHomePage()));
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Color(0xffB8382C),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Row(
|
||||
children: [
|
||||
Texts(
|
||||
TranslationBase.of(context).offerAndPackages,
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Spacer(),
|
||||
Image.asset("assets/images/offer_icon.png"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (projectViewModel.havePrivilege(64) || projectViewModel.havePrivilege(65) || projectViewModel.havePrivilege(67))
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
if (projectViewModel.havePrivilege(64))
|
||||
DashboardItem(
|
||||
onTap: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: HomeHealthCarePage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/home_health_care_icon.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).homeHealthCare,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
imageName: 'home_healthcare_service_bg.png',
|
||||
opacity: 0.5,
|
||||
),
|
||||
if (projectViewModel.havePrivilege(65))
|
||||
DashboardItem(
|
||||
onTap: () => (model.user != null && model.user.outSA == 1) ? () {} : getPharmacyToken(model),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/pharmacy_logo.png',
|
||||
width: 40,
|
||||
height: 40,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).onlinePharmacy,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
imageName: 'al-habib_onlne_pharmacy_bg.png',
|
||||
),
|
||||
if (projectViewModel.havePrivilege(67))
|
||||
DashboardItem(
|
||||
onTap: (model.user != null && model.user.outSA == 1)
|
||||
? () {}
|
||||
: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: CMCPage(),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: (model.user != null && model.user.outSA == 1) ? const EdgeInsets.all(0.0) : const EdgeInsets.all(15.0),
|
||||
child: (model.user != null && model.user.outSA == 1)
|
||||
? Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
color: Colors.grey.shade500.withOpacity(0.3),
|
||||
child: Icon(
|
||||
Icons.lock_outline,
|
||||
size: 40,
|
||||
),
|
||||
)
|
||||
: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/comprehensive_medical_checkup_logo.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).cmcHeading,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: SizeConfig.textMultiplier * 1.55,
|
||||
)
|
||||
],
|
||||
)),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
color: HexColor("#747C80"),
|
||||
imageName: 'emergency_service_image.png',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () => Navigator.push(context, FadePage(page: PaymentService())),
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/al-habib_online_payment_service_icon.png',
|
||||
height: 55,
|
||||
),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).onlinePaymentService,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.push(context, FadePage(page: EReferralPage()));
|
||||
},
|
||||
child: Container(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/ereferral_service_icon.png',
|
||||
width: 50,
|
||||
height: 55,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).ereferral,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
)),
|
||||
),
|
||||
if (projectViewModel.havePrivilege(60))
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width * 0.29,
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
FadePage(
|
||||
page: ErOptions(
|
||||
isAppbar: true,
|
||||
))),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/Dr_Schedule_report.png',
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).emergencyServices,
|
||||
textAlign: TextAlign.center,
|
||||
color: Colors.black87,
|
||||
bold: false,
|
||||
fontSize: SizeConfig.textMultiplier * 1.7,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
height: MediaQuery.of(context).size.width * 0.4,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 15, right: 15),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
DashboardItem(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).hMGService,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewAllHabibMedicalService,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(),
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
//fontWeight: FontWeight.normal,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
height: 100,
|
||||
imageName: 'contact_us_bg.png',
|
||||
opacity: 0.5,
|
||||
color: Colors.grey[700],
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
onTap: () => Navigator.push(context, FadePage(page: AllHabibMedicalService())),
|
||||
),
|
||||
DashboardItem(
|
||||
onTap: () {
|
||||
// Navigator.push(
|
||||
// context, FadePage(page: FeedbackHomePage()));
|
||||
Navigator.push(context, FadePage(page: ContactUsPage()));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
TranslationBase.of(context).reachUs,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewAllWaysReachUs,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(),
|
||||
),
|
||||
Texts(
|
||||
TranslationBase.of(context).viewMore,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
height: 100,
|
||||
imageName: 'contact_us_bg.png',
|
||||
opacity: 0.5,
|
||||
color: Colors.grey[700],
|
||||
width: MediaQuery.of(context).size.width * 0.45,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 120,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getPharmacyToken(DashboardViewModel model) async {
|
||||
if (!model.isLogin) {
|
||||
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
||||
} else {
|
||||
GifLoaderDialogUtils.showMyDialog(context);
|
||||
await pharmacyModuleViewModel.generatePharmacyToken().then((value) async {
|
||||
if (pharmacyModuleViewModel.error.isNotEmpty) {
|
||||
await pharmacyModuleViewModel.createUser().then((value) {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
||||
});
|
||||
} else {
|
||||
GifLoaderDialogUtils.hideDialog(context);
|
||||
Navigator.push(context, FadePage(page: LandingPagePharmacy()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
navigateToCovidDriveThru() {
|
||||
Navigator.push(context, FadePage(page: CovidDrivethruLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
class DashboardItem extends StatelessWidget {
|
||||
const DashboardItem({this.hasBorder = false, this.imageName, @required this.child, this.onTap, Key key, this.width, this.height, this.color, this.opacity = 0.4, this.hasColorFilter = true})
|
||||
: super(key: key);
|
||||
final bool hasBorder;
|
||||
final String imageName;
|
||||
final Widget child;
|
||||
final Function onTap;
|
||||
final double width;
|
||||
final double height;
|
||||
final Color color;
|
||||
final double opacity;
|
||||
final bool hasColorFilter;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: width != null ? width : MediaQuery.of(context).size.width * 0.29,
|
||||
height: height != null
|
||||
? height
|
||||
: MediaQuery.of(context).orientation == Orientation.portrait
|
||||
? MediaQuery.of(context).size.height * 0.17
|
||||
: MediaQuery.of(context).size.height * 0.35,
|
||||
decoration: BoxDecoration(
|
||||
color: !hasBorder
|
||||
? color != null
|
||||
? color
|
||||
: HexColor('#050705').withOpacity(opacity)
|
||||
: Colors.white,
|
||||
borderRadius: BorderRadius.circular(6.0),
|
||||
border: hasBorder ? Border.all(width: 1.0, color: const Color(0xffcccccc)) : Border.all(width: 0.0, color: Colors.transparent),
|
||||
image: imageName != null
|
||||
? DecorationImage(
|
||||
image: ExactAssetImage('assets/images/$imageName'),
|
||||
fit: BoxFit.cover,
|
||||
colorFilter: hasColorFilter ? new ColorFilter.mode(Colors.black.withOpacity(0.2), BlendMode.dstIn) : null,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
child: Center(
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,191 +0,0 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:badges/badges.dart';
|
||||
import 'package:diplomaticquarterapp/config/size_config.dart';
|
||||
import 'package:diplomaticquarterapp/core/service/medical/vital_sign_service.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
||||
import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart';
|
||||
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||
import 'package:diplomaticquarterapp/uitl/utils.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/medical/time_line_widget.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MedicalProfilePage extends StatefulWidget {
|
||||
@override
|
||||
_MedicalProfilePageState createState() => _MedicalProfilePageState();
|
||||
}
|
||||
|
||||
class _MedicalProfilePageState extends State<MedicalProfilePage> {
|
||||
var authProvider = new AuthProvider();
|
||||
List<Medical> medical = List();
|
||||
ProjectViewModel projectViewModel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
projectViewModel = Provider.of(context);
|
||||
var appoCountProvider = Provider.of<ToDoCountProviderModel>(context);
|
||||
List<Widget> myMedicalList = Utils.myMedicalList(projectViewModel: projectViewModel, context: context, count: appoCountProvider.count, isLogin: projectViewModel.isLogin);
|
||||
return BaseView<MedicalViewModel>(
|
||||
onModelReady: (model) => model.getAppointmentHistory(),
|
||||
builder: (_, model, widget) => AppScaffold(
|
||||
isShowDecPage: false,
|
||||
baseViewModel: model,
|
||||
isHelp: false,
|
||||
body: Container(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 210,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/timeline_bg.png',
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
// color: Colors.black.withOpacity(0.0)
|
||||
),
|
||||
if (model.isLogin)
|
||||
ListView.builder(
|
||||
itemBuilder: (context, index) => TimeLineWidget(
|
||||
isUp: index % 2 == 1,
|
||||
appoitmentAllHistoryResul: model.appoitmentAllHistoryResultList[index],
|
||||
),
|
||||
itemCount: model.appoitmentAllHistoryResultList.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
reverse: projectViewModel.isArabic,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
projectViewModel.isLogin
|
||||
? Text(
|
||||
projectViewModel?.user?.firstNameN ?? "",
|
||||
style: TextStyle(color: Colors.black, fontSize: SizeConfig.textMultiplier * 1.8),
|
||||
)
|
||||
: Container(),
|
||||
Text(
|
||||
TranslationBase.of(context).medicalFile,
|
||||
style: TextStyle(color: Colors.black, fontSize: SizeConfig.textMultiplier * 3),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 12, right: 12),
|
||||
child: GridView.builder(
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
// gridDelegate:
|
||||
// SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: 3,
|
||||
// childAspectRatio: MediaQuery.of(context)
|
||||
// .size
|
||||
// .width /
|
||||
// (MediaQuery.of(context).size.height / 2.20),
|
||||
// ),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
||||
padding: EdgeInsets.zero,
|
||||
itemCount: myMedicalList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return myMedicalList[index];
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.12,
|
||||
),
|
||||
if (model.user != null && model.isLogin)
|
||||
Positioned(
|
||||
top: 185,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[500],
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(color: Colors.transparent, width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(9)),
|
||||
image: DecorationImage(image: ExactAssetImage('assets/images/bg_graphic.png'), fit: BoxFit.cover)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
Texts(
|
||||
model.user.firstName + " " + model.user.lastName,
|
||||
color: Colors.white,
|
||||
bold: true,
|
||||
),
|
||||
Texts(
|
||||
'${model.user.patientID}',
|
||||
color: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 2,
|
||||
left: projectViewModel.isArabic ? 0 : 10,
|
||||
right: projectViewModel.isArabic ? 10 : 0,
|
||||
child: Texts(
|
||||
TranslationBase.of(context).timeLine,
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Medical {
|
||||
final String title;
|
||||
final String imagePath;
|
||||
final String subTitle;
|
||||
final Widget page;
|
||||
|
||||
Medical({this.title, this.imagePath, this.subTitle, this.page});
|
||||
}
|
||||
Loading…
Reference in New Issue