diff --git a/assets/images/new/My Services/active medication.svg b/assets/images/new/services/active_medication.svg similarity index 100% rename from assets/images/new/My Services/active medication.svg rename to assets/images/new/services/active_medication.svg diff --git a/assets/images/new/My Services/Appointment list.svg b/assets/images/new/services/appointment_list.svg similarity index 100% rename from assets/images/new/My Services/Appointment list.svg rename to assets/images/new/services/appointment_list.svg diff --git a/assets/images/new/My Services/lab result.svg b/assets/images/new/services/lab_result.svg similarity index 100% rename from assets/images/new/My Services/lab result.svg rename to assets/images/new/services/lab_result.svg diff --git a/assets/images/new/My Services/medicine prescription.svg b/assets/images/new/services/medicine_prescription.svg similarity index 100% rename from assets/images/new/My Services/medicine prescription.svg rename to assets/images/new/services/medicine_prescription.svg diff --git a/assets/images/new/services/my_doc.svg b/assets/images/new/services/my_doc.svg new file mode 100644 index 00000000..8bec48a5 --- /dev/null +++ b/assets/images/new/services/my_doc.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/images/new/My Services/radiology.svg b/assets/images/new/services/radiology.svg similarity index 100% rename from assets/images/new/My Services/radiology.svg rename to assets/images/new/services/radiology.svg diff --git a/assets/images/new/My Services/Vital Signs.svg b/assets/images/new/services/vital_signs.svg similarity index 100% rename from assets/images/new/My Services/Vital Signs.svg rename to assets/images/new/services/vital_signs.svg diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d12d280f..459595ba 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -480,7 +480,7 @@ const Map localizedValues = { "locationa": {"en": "location:", "ar": "الموقع"}, "ambulancerequest": {"en": "Ambulance :", "ar": "طلب نقل "}, "requestA": {"en": "Request:", "ar": "اسعاف"}, - "MyAppointments": {"en": "Appointments", "ar": "مواعيدي"}, + "MyAppointments": {"en": "My", "ar": "مواعيدي"}, "NoBookedAppointments": { "en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة" @@ -493,7 +493,7 @@ const Map localizedValues = { "en": "No Arrived Appointments", "ar": "لم تصل المواعيد" }, - "MyAppointmentsList": {"en": "List", "ar": "قائمة بمواعدي"}, + "MyAppointmentsList": {"en": "Appointments", "ar": "قائمة بمواعدي"}, "Radiology": {"en": "Radiology", "ar": "الأشعة"}, "RadiologySubtitle": {"en": "Result", "ar": "صور وتقارير"}, "Lab": {"en": "Lab", "ar": "تحليل المختبر"}, diff --git a/lib/pages/landing/fragments/home_page_fragment.dart b/lib/pages/landing/fragments/home_page_fragment.dart new file mode 100644 index 00000000..670bf5e1 --- /dev/null +++ b/lib/pages/landing/fragments/home_page_fragment.dart @@ -0,0 +1,108 @@ +import 'package:diplomaticquarterapp/models/hmg_services.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/utils_new.dart'; +import 'package:flutter/material.dart'; + +class HomePageFragment extends StatefulWidget { + @override + _HomePageFragmentState createState() => _HomePageFragmentState(); +} + +class _HomePageFragmentState extends State { + List hmgServices = []; + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialiseHmgServices(false); + // getFamilyFiles(); + } + + initialiseHmgServices(bool isLogin) { + hmgServices.add(new HmgServices(0, "LiveCare ", "Online Consulting", "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, "Covid Test", "Drive-Thru", "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, "Checkup", "Comprehensive", "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(3, "HHC Home", "Health Care", "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, "E-Refferal", "Services", "assets/images/new/E_Refferal.svg", isLogin)); + hmgServices.add(new HmgServices(5, "RRT", "Emergency", "assets/images/new/RRT.svg", isLogin)); + } + + @override + Widget build(BuildContext context) { + return Container( + width: double.infinity, + child: Column( + children: [ + AspectRatio( + aspectRatio: 2, + child: Container( + margin: EdgeInsets.all(14), + child: SliderView(), + // 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"), + ), + mHeight(20), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + ), + child: Column( + children: [ + Row( + children: [ + Expanded( + child: Text( + "HMG Services", + style: TextStyle( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + "View All Services", + style: TextStyle( + color: CustomColors.accentColor, + fontSize: 14, + ), + ), + ], + ), + mHeight(20), + 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); + }), + ], + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + ), + child: PharmacyView(), + ), + mHeight(140), + ], + ), + ); + } +} diff --git a/lib/pages/landing/fragments/logged_home_page_fragment.dart b/lib/pages/landing/fragments/logged_home_page_fragment.dart new file mode 100644 index 00000000..0b22ec67 --- /dev/null +++ b/lib/pages/landing/fragments/logged_home_page_fragment.dart @@ -0,0 +1,231 @@ +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/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/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/services/family_files/family_files_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.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; + + LoggedHomePageFragment(this.projectViewModel); + + @override + _HomePageFragmentState createState() => _HomePageFragmentState(); +} + +class _HomePageFragmentState extends State { + List hmgServices = []; + var familyFileProvider = FamilyFilesProvider(); + + @override + void initState() { + // TODO: implement initState + super.initState(); + initialiseHmgServices(false); + // getFamilyFiles(); + } + + initialiseHmgServices(bool isLogin) { + hmgServices.add(new HmgServices(0, "LiveCare ", "Online Consulting", "assets/images/new/Live_Care.svg", isLogin)); + hmgServices.add(new HmgServices(1, "Covid Test", "Drive-Thru", "assets/images/new/covid_test_drive_thru.svg", isLogin)); + hmgServices.add(new HmgServices(2, "Checkup", "Comprehensive", "assets/images/new/comprehensive_checkup.svg", isLogin)); + hmgServices.add(new HmgServices(3, "HHC Home", "Health Care", "assets/images/new/HHC.svg", isLogin)); + hmgServices.add(new HmgServices(4, "E-Refferal", "Services", "assets/images/new/E_Refferal.svg", isLogin)); + hmgServices.add(new HmgServices(5, "RRT", "Emergency", "assets/images/new/RRT.svg", isLogin)); + } + + Future 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) { + var appoCountProvider = Provider.of(context); + List myMedicalList = Utils.myMedicalListHomePage(projectViewModel: widget.projectViewModel, context: context, count: appoCountProvider.count, isLogin: widget.projectViewModel.isLogin); + return Container( + width: double.infinity, + child: Column( + children: [ + FutureBuilder( + future: getFamilyFiles(), // async work + builder: (BuildContext context, AsyncSnapshot snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.waiting: + return Padding(padding: EdgeInsets.all(10), child: Text('')); + default: + if (snapshot.hasError) + return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); + else { + List sliderData = []; + sliderData.add(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)); + for (int i = 0; i < snapshot.data.getAllSharedRecordsByStatusList.length; i++) { + if (snapshot.data.getAllSharedRecordsByStatusList[i].status == 3) + sliderData.add(new SliderData(TranslationBase.of(context).fileno + ": " + snapshot.data.getAllSharedRecordsByStatusList[i].responseID.toString(), + snapshot.data.getAllSharedRecordsByStatusList[i].patientName, "", bannerColor[i + 1].darkColor, bannerColor[i + 1].lightColor)); + } + + return AspectRatio( + aspectRatio: 2, + child: CarouselSlider( + options: CarouselOptions( + autoPlay: false, + enlargeCenterPage: true, + initialPage: 0, + aspectRatio: 2.5, + viewportFraction: 0.9, + enableInfiniteScroll: false, + onPageChanged: (index, reason) { + print("onPageChanged"); + }), + items: [ + for (int i = 0; i < sliderData.length; i++) + Builder( + builder: (BuildContext context) { + return LoggedSliderView(sliderData[i]); + }, + ) + ], + ), + ); + } + } + }, + ), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.143, + child: ListView.separated( + itemCount: 4, + padding: EdgeInsets.zero, + scrollDirection: Axis.horizontal, + physics: BouncingScrollPhysics(), + itemBuilder: (context, index) { + return Container( + child: myMedicalList[index], + margin: EdgeInsets.only(left: index == 0 ? 20 : 0, right: index == 3 ? 20 : 0), + ); + }, + separatorBuilder: (BuildContext context, int index) { + return mWidth(12); + }, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 16, + ), + child: Row( + children: [ + mFlex(1), + Text( + "View Medical File", + style: TextStyle( + color: CustomColors.accentColor, + fontSize: 14, + decoration: TextDecoration.underline, + ), + ), + ], + ), + ), + mHeight(16), + Padding( + padding: const EdgeInsets.only(left: 20, right: 20), + child: Image.asset("assets/images/bn_offer.png"), + ), + mHeight(14), + Column( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + ), + child: Row( + children: [ + Expanded( + child: Text( + "HMG Services", + style: TextStyle( + color: Colors.black, + fontSize: 18, + fontWeight: FontWeight.bold, + ), + ), + ), + Text( + "View All Services", + style: TextStyle( + color: CustomColors.accentColor, + decoration: TextDecoration.underline, + fontSize: 14, + ), + ), + ], + ), + ), + mHeight(20), + Container( + width: double.infinity, + height: MediaQuery.of(context).size.height * 0.143, + 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.height * 0.143, + margin: 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); + }, + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.only( + left: 20, + right: 20, + top: 20, + ), + child: PharmacyView(), + ), + mHeight(140), + ], + ), + ); + } +} diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 34398b56..e18a7fcb 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -15,6 +15,8 @@ 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/landing/fragments/home_page_fragment.dart'; +import 'package:diplomaticquarterapp/pages/landing/fragments/logged_home_page_fragment.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/logged_slider_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/offer_view.dart'; import 'package:diplomaticquarterapp/pages/landing/widgets/pharmacy_view.dart'; @@ -55,38 +57,6 @@ class HomePage2 extends StatefulWidget { class _HomePageState2 extends State { PharmacyModuleViewModel pharmacyModuleViewModel = locator(); ProjectViewModel projectViewModel; - var familyFileProvider = FamilyFilesProvider(); - List hmgServices = []; - - @override - void initState() { - // TODO: implement initState - super.initState(); - initialiseHmgServices(false); - // getFamilyFiles(); - } - - initialiseHmgServices(bool isLogin) { - hmgServices.add(new HmgServices(0, "LiveCare ", "Online Consulting", "assets/images/new/Live_Care.svg", isLogin)); - hmgServices.add(new HmgServices(1, "Covid Test", "Drive-Thru", "assets/images/new/covid_test_drive_thru.svg", isLogin)); - hmgServices.add(new HmgServices(2, "Checkup", "Comprehensive", "assets/images/new/comprehensive_checkup.svg", isLogin)); - hmgServices.add(new HmgServices(3, "HHC Home", "Health Care", "assets/images/new/HHC.svg", isLogin)); - hmgServices.add(new HmgServices(4, "E-Refferal", "Services", "assets/images/new/E_Refferal.svg", isLogin)); - hmgServices.add(new HmgServices(5, "RRT", "Emergency", "assets/images/new/RRT.svg", isLogin)); - } - - Future getFamilyFiles() async { - if (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) { @@ -94,218 +64,13 @@ class _HomePageState2 extends State { return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => Container( - color: Color(0xFFFF7F7F7), + color: CustomColors.backgroudGreyColor, + // color: Colors.yellow, child: SingleChildScrollView( + physics: BouncingScrollPhysics(), child: Column( children: [ - !model.isLogin - ? AspectRatio( - aspectRatio: 2, - child: Container( - margin: EdgeInsets.all(14), - child: SliderView(), - // height: MediaQuery.of(context).size.width / 2.6, - ), - ) - : FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child: Text('')); - default: - if (snapshot.hasError) - return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); - else { - List sliderData = []; - sliderData.add(new SliderData(TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), - projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, "", bannerColor[0].darkColor, bannerColor[0].lightColor)); - for (int i = 0; i < snapshot.data.getAllSharedRecordsByStatusList.length; i++) { - if (snapshot.data.getAllSharedRecordsByStatusList[i].status == 3) - sliderData.add(new SliderData(TranslationBase.of(context).fileno + ": " + snapshot.data.getAllSharedRecordsByStatusList[i].responseID.toString(), - snapshot.data.getAllSharedRecordsByStatusList[i].patientName, "", bannerColor[i + 1].darkColor, bannerColor[i + 1].lightColor)); - } - - return CarouselSlider( - options: CarouselOptions( - autoPlay: false, - enlargeCenterPage: true, - initialPage: 0, - aspectRatio: 2.5, - viewportFraction: 0.9, - enableInfiniteScroll: false, - onPageChanged: (index, reason) { - print("onPageChanged"); - }), - items: [ - for (int i = 0; i < sliderData.length; i++) - Builder( - builder: (BuildContext context) { - return LoggedSliderView(sliderData[i]); - }, - ) - ], - ); - } - } - }, - ), - // CarouselSlider( - // options: CarouselOptions( - // autoPlay: false, - // enlargeCenterPage: true, - // initialPage: 0, - // aspectRatio: 2.5, - // viewportFraction: 0.9, - // enableInfiniteScroll: false, - // onPageChanged: (index, reason) { - // print("onPageChanged"); - // }), - // items: [ - // for (int i = 0; i < bannerColor.length; i++) - // Builder( - // builder: (BuildContext context) { - // return LoggedSliderView(bannerColor[i].darkColor, bannerColor[i].lightColor); - // }, - // ) - // ], - // ), - model.isLogin - ? FutureBuilder( - future: getFamilyFiles(), // async work - builder: (BuildContext context, AsyncSnapshot snapshot) { - switch (snapshot.connectionState) { - case ConnectionState.waiting: - return Padding(padding: EdgeInsets.all(10), child: Text('')); - default: - if (snapshot.hasError) - return Padding(padding: EdgeInsets.all(10), child: Text(snapshot.error)); - else - return Container( - decoration: BoxDecoration( - border: Border( - bottom: BorderSide( - // <--- left side - color: Colors.grey[200], - width: 1.0, - ), - )), - child: Column( - children: [ - // projectViewModel.user.isFamily == true - // ? - Container( - padding: EdgeInsets.only(bottom: 5), - child: InkWell( - onTap: () { - // switchUser( - // mainUser, - // context); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Icon(Icons.person), - ), - Expanded( - flex: 7, - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText(projectViewModel.user.firstName + ' ' + projectViewModel.user.lastName, color: Theme.of(context).textTheme.bodyText1.color), - AppText( - TranslationBase.of(context).fileno + ": " + projectViewModel.user.patientID.toString(), - color: Theme.of(context).textTheme.bodyText1.color, - ), - ])), - ], - ))), - // : SizedBox(), - Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: snapshot.data.getAllSharedRecordsByStatusList.map((result) { - return result.status == 3 - ? Container( - padding: EdgeInsets.only(bottom: 5), - child: InkWell( - onTap: () { - // switchUser(result, - // context); - }, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: Icon(Icons.person, color: result.responseID == model.user.patientID ? Color(0xFF40ACC9) : Colors.black), - ), - Expanded( - flex: 7, - child: Padding( - padding: EdgeInsets.only(left: 5, right: 5), - child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - AppText(result.patientName, color: result.responseID == model.user.patientID ? Color(0xFF40ACC9) : Colors.black), - AppText(TranslationBase.of(context).fileno + ": " + result.responseID.toString(), - color: result.responseID == projectViewModel.user.patientID ? Color(0xFF40ACC9) : Colors.black), - ]))), - ], - ))) - : SizedBox(); - }).toList()) - ], - )); - } - }, - ) - : Container(), - Padding( - padding: const EdgeInsets.only(left: 20, right: 20), - child: Image.asset("assets/images/bn_offer.png"), - ), - mHeight(20), - Padding( - padding: const EdgeInsets.only(left:20,right: 20,top: 20,), - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Text( - "HMG Services", - style: TextStyle( - color: Colors.black, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), - ), - Text( - "View All Services", - style: TextStyle( - color: CustomColors.accentColor, - fontSize: 14, - ), - ), - ], - ), - mHeight(20), - 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]); - } - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.only(left:20,right: 20,top: 20,), - child: PharmacyView(), - ), - mHeight(140), + !model.isLogin ? HomePageFragment() : LoggedHomePageFragment(projectViewModel), ], ), ), diff --git a/lib/pages/landing/widgets/logged_slider_view.dart b/lib/pages/landing/widgets/logged_slider_view.dart index 24b0dfe5..f1beb765 100644 --- a/lib/pages/landing/widgets/logged_slider_view.dart +++ b/lib/pages/landing/widgets/logged_slider_view.dart @@ -1,7 +1,7 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/material.dart'; -import 'dart:math'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/slider_data.dart'; class LoggedSliderView extends StatelessWidget { @@ -13,8 +13,8 @@ class LoggedSliderView extends StatelessWidget { Widget build(BuildContext context) { return Card( shape: cardRadius(20), - elevation: 3, - margin: EdgeInsets.all(6), + elevation: 0, + margin: EdgeInsets.all(0), child: Card( shape: cardRadius(20), clipBehavior: Clip.antiAlias, @@ -58,7 +58,7 @@ class LoggedSliderView extends StatelessWidget { ), ), mWidth(MediaQuery.of(context).size.width / 50), - circularAviator(MediaQuery.of(context).size.width / 14, brColor: Colors.white), + //circularAviator(MediaQuery.of(context).size.width / 14, brColor: Colors.white), mFlex(1), Text( "Verified", @@ -70,12 +70,12 @@ class LoggedSliderView extends StatelessWidget { ), mFlex(2), Padding( - padding: const EdgeInsets.only(left: 20,right: 20), + padding: const EdgeInsets.only(left: 20, right: 20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - sliderData.pateintName, + sliderData.pateintName.toLowerCase().capitalizeFirstofEach, style: TextStyle( color: Colors.white, fontWeight: FontWeight.bold, @@ -89,7 +89,7 @@ class LoggedSliderView extends StatelessWidget { ], ), ), - mFlex(2), + mFlex(3), Padding( padding: const EdgeInsets.only(left: 20, right: 20), child: Text( @@ -97,11 +97,20 @@ class LoggedSliderView extends StatelessWidget { style: TextStyle(color: Colors.white, fontSize: 14), ), ), - mFlex(3), + mFlex(4), ], ), ), ), + Positioned( + child: Icon( + Icons.arrow_forward_rounded, + color: Colors.white, + size: 20, + ), + bottom: 8, + right: 8, + ), ], ), ), diff --git a/lib/pages/landing/widgets/services_view.dart b/lib/pages/landing/widgets/services_view.dart index 0e829aac..2900d0b1 100644 --- a/lib/pages/landing/widgets/services_view.dart +++ b/lib/pages/landing/widgets/services_view.dart @@ -1,4 +1,5 @@ import 'package:auto_size_text/auto_size_text.dart'; +import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/models/hmg_services.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -7,8 +8,9 @@ import 'package:flutter_svg/flutter_svg.dart'; class ServicesView extends StatelessWidget { HmgServices hmgServices; + int index; - ServicesView(this.hmgServices); + ServicesView(this.hmgServices, this.index); @override Widget build(BuildContext context) { @@ -59,12 +61,15 @@ class ServicesView extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ mFlex(1), - SvgPicture.asset(hmgServices.icon), + SvgPicture.asset( + hmgServices.icon, + height: index == 0 ? MediaQuery.of(context).size.width / 18 : MediaQuery.of(context).size.width / 14, + ), mFlex(2), Text( hmgServices.title, style: TextStyle( - fontSize: 16, + fontSize: SizeConfig.textMultiplier * 1.9, fontWeight: FontWeight.bold, ), ), @@ -77,7 +82,7 @@ class ServicesView extends StatelessWidget { hmgServices.subTitle, maxLines: 1, style: TextStyle( - fontSize: 10, + fontSize: SizeConfig.textMultiplier * 1.2, ), ), ), diff --git a/lib/theme/colors.dart b/lib/theme/colors.dart index 6185aeb0..88acc553 100644 --- a/lib/theme/colors.dart +++ b/lib/theme/colors.dart @@ -8,9 +8,9 @@ class CustomColors { static const Color darkGrey = Color(0xFF222222); static const Color black = Color(0xFF141414); static const Color white = Color(0xFFFFFFFF); - static const Color accentColor=Color(0xFFFBF2E31); - static const Color lightGreyColor=Color(0xFFFEDEDED); - static const Color darkGreyColor=Color(0xFFFC9C9C9); - static const Color pharmacyGreyColor=Color(0xFFFE5E5E5); - static const Color backgroudGreyColor=Color(0xFFFF7F7F7); + static const Color accentColor = Color(0xFFD02127); + static const Color lightGreyColor = Color(0xFFE2E2E2); + static const Color darkGreyColor = Color(0xFFC9C9C9); + static const Color pharmacyGreyColor = Color(0xFFDBDBDB); + static const Color backgroudGreyColor = Color(0xFF7F7F7); } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 67e5c6b9..2be9ac84 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -62,7 +62,7 @@ class Utils { /// Check The Internet Connection static Future checkConnection() async { ConnectivityResult connectivityResult = - await (Connectivity().checkConnectivity()); + await (Connectivity().checkConnectivity()); if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { return true; @@ -199,59 +199,54 @@ class Utils { static validEmail(email) { return RegExp( - r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") + r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+") .hasMatch(email); } static List myMedicalList( {ProjectViewModel projectViewModel, - BuildContext context, - bool isLogin, - count}) { + BuildContext context, + bool isLogin, + count}) { List medical = List(); - if (projectViewModel.havePrivilege(5)) { - medical.add(InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: MyAppointments(), + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, + child: isLogin + ? Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5)), + Positioned( + right: 0.0, + child: Badge( + toAnimate: false, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle(color: Colors.white, fontSize: 16.0)), ), - ); - }, - child: isLogin - ? Stack(children: [ - MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - ), - Positioned( - right: 0.0, - child: Badge( - toAnimate: false, - position: BadgePosition.topEnd(), - shape: BadgeShape.circle, - badgeColor: secondaryColor.withOpacity(1.0), - borderRadius: BorderRadius.circular(8), - badgeContent: Container( - padding: EdgeInsets.all(2.0), - child: Text(count.toString(), - style: - TextStyle(color: Colors.white, fontSize: 16.0)), - ), - ), - ), - ]) - : MedicalProfileItem( - title: TranslationBase.of(context).myAppointments, - imagePath: 'my_appointment_icon.png', - subTitle: TranslationBase.of(context).myAppointmentsList, - hasBadge: true, - ), - )); - } + ), + ), + ]) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'my_appointment_icon.png', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5), + ), + )); + if (projectViewModel.havePrivilege(10)) { medical.add(InkWell( onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), @@ -263,106 +258,97 @@ class Utils { )); } - if (projectViewModel.havePrivilege(7)) { - medical.add(InkWell( - onTap: () => - Navigator.push(context, FadePage(page: RadiologyHomePage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).radiology, - imagePath: 'radiology_icon.png', - subTitle: TranslationBase.of(context).radiologySubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology_icon.png', + subTitle: TranslationBase.of(context).radiologySubtitle, + isEnable: projectViewModel.havePrivilege(7), + ), + )); - if (projectViewModel.havePrivilege(12)) { - medical.add(InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: HomePrescriptionsPage(), - ), - ); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).medicines, - imagePath: 'prescription_icon.png', - subTitle: TranslationBase.of(context).medicinesSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'prescription_icon.png', + subTitle: TranslationBase.of(context).medicinesSubtitle, + isEnable: projectViewModel.havePrivilege(12), + ), + )); - if (projectViewModel.havePrivilege(25)) { - medical.add(InkWell( - onTap: () => Navigator.push( - context, - FadePage( - page: VitalSignDetailsScreen(), - ), - ), - child: MedicalProfileItem( - title: TranslationBase.of(context).vitalSigns, - imagePath: 'vital_signs.png', - subTitle: TranslationBase.of(context).vitalSignsSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(25) + ? Navigator.push( + context, + FadePage(page: VitalSignDetailsScreen()), + ) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).vitalSigns, + imagePath: 'vital_signs.png', + subTitle: TranslationBase.of(context).vitalSignsSubtitle, + isEnable: projectViewModel.havePrivilege(25), + ), + )); - if (projectViewModel.havePrivilege(48)) { - medical.add(InkWell( - onTap: () => - Navigator.push(context, FadePage(page: ActiveMedicationsPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).myMedical, - imagePath: 'active_medications.png', - subTitle: TranslationBase.of(context).myMedicalSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(48) + ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myMedical, + imagePath: 'active_medications.png', + subTitle: TranslationBase.of(context).myMedicalSubtitle, + isEnable: false, + ), + )); - if (projectViewModel.havePrivilege(6)) { - medical.add(InkWell( - onTap: () { - Navigator.push( - context, - FadePage( - page: DoctorHomePage(), - ), - ); - }, - child: MedicalProfileItem( + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(6) + ? Navigator.push( + context, + FadePage( + page: DoctorHomePage(), + ), + ) + : null, + child: MedicalProfileItem( title: TranslationBase.of(context).myDoctor, imagePath: 'doctor_icon.png', subTitle: TranslationBase.of(context).myDoctorSubtitle, - ), - )); - } + isEnable: projectViewModel.havePrivilege(6)), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', + subTitle: TranslationBase.of(context).eyeSubtitle, + isEnable: projectViewModel.havePrivilege(14), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(22) + ? Navigator.push(context, FadePage(page: InsuranceCard())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).insurance, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).insuranceSubtitle, + isEnable: projectViewModel.havePrivilege(22), + ), + )); - if (projectViewModel.havePrivilege(14)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: EyeMeasurementsPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).eye, - imagePath: 'eye_measurement_icon.png', - subTitle: TranslationBase.of(context).eyeSubtitle, - ), - )); - } - if (projectViewModel.havePrivilege(22)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceCard())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).insurance, - imagePath: 'insurance_card_icon.png', - subTitle: TranslationBase.of(context).insuranceSubtitle, - ), - )); - } medical.add(InkWell( onTap: () { Navigator.push(context, FadePage(page: InsuranceUpdate())); @@ -374,137 +360,467 @@ class Utils { ), )); - if (projectViewModel.havePrivilege(18)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: InsuranceApproval())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).insuranceApproval, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(18) + ? Navigator.push(context, FadePage(page: InsuranceApproval())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + isEnable: projectViewModel.havePrivilege(18), + ), + )); - if (projectViewModel.havePrivilege(23)) { - medical.add(InkWell( - onTap: () => Navigator.push(context, FadePage(page: AllergiesPage())), - child: MedicalProfileItem( - title: TranslationBase.of(context).allergies, - imagePath: 'my_allergies_icon.png', - subTitle: TranslationBase.of(context).allergiesSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(23) + ? Navigator.push(context, FadePage(page: AllergiesPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context).allergiesSubtitle, + isEnable: projectViewModel.havePrivilege(23), + ), + )); - if (projectViewModel.havePrivilege(26)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyVaccines())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).myVaccines, - imagePath: 'my_vaccines_icon.png', - subTitle: TranslationBase.of(context).myVaccinesSubtitle, - ), - )); - } - if (projectViewModel.havePrivilege(20)) - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: HomeReportPage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).medical, - imagePath: 'medical_reports_icon.png', - subTitle: TranslationBase.of(context).medicalSubtitle, - ), - )); + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(26) + ? Navigator.push(context, FadePage(page: MyVaccines())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context).myVaccinesSubtitle, + isEnable: projectViewModel.havePrivilege(26), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(20) + ? Navigator.push(context, FadePage(page: HomeReportPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).medical, + imagePath: 'medical_reports_icon.png', + subTitle: TranslationBase.of(context).medicalSubtitle, + isEnable: projectViewModel.havePrivilege(20), + ), + )); - if (projectViewModel.havePrivilege(19)) { + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(19) + ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context).monthlySubtitle, + isEnable: projectViewModel.havePrivilege(19), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(16) + ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context).sickSubtitle, + isEnable: projectViewModel.havePrivilege(16), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(47) + ? Navigator.push(context, FadePage(page: MyBalancePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context).myBalanceSubtitle, + isEnable: projectViewModel.havePrivilege(47), + ), + )); + + medical.add(MedicalProfileItem( + title: TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context).patientCallSubtitle, + isEnable: projectViewModel.havePrivilege(61), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(24) + ? Navigator.push(context, FadePage(page: MyTrackers())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context).myTrackersSubtitle, + isEnable: projectViewModel.havePrivilege(24), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(30) + ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context).smartWatchesSubtitle, + isEnable: projectViewModel.havePrivilege(30), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(28) + ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).askYour, + imagePath: 'ask_doctor_icon.png', + subTitle: TranslationBase.of(context).askYourSubtitle, + isEnable: projectViewModel.havePrivilege(28)), + )); + + if (projectViewModel.havePrivilege(32) || true) { medical.add(InkWell( onTap: () { - Navigator.push(context, FadePage(page: MonthlyReportsPage())); + userData().then((userData_) { + if (projectViewModel.isLogin && userData_ != null) { + String patientID = userData_.patientID.toString(); + GifLoaderDialogUtils.showMyDialog(context); + projectViewModel + .platformBridge() + .connectHMGInternetWifi(patientID) + .then((value) => {GifLoaderDialogUtils.hideDialog(context)}); + } else { + AlertDialogBox( + context: context, + confirmMessage: + "Please login with your account first to use this feature", + okText: "OK", + okFunction: () { + AlertDialogBox.closeAlertDialog(context); + }).showAlertDialog(context); + } + }); }, child: MedicalProfileItem( - title: TranslationBase.of(context).monthly, - imagePath: 'monthly_reports_icon.png', - subTitle: TranslationBase.of(context).monthlySubtitle, + title: TranslationBase.of(context).internet, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).internetSubtitle, ), )); } - if (projectViewModel.havePrivilege(16)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: PatientSickLeavePage())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).sick, - imagePath: 'sick_leaves_icons.png', - subTitle: TranslationBase.of(context).sickSubtitle, + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(40) + ? launch('whatsapp://send?phone=18885521858&text=') + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).chatbotSubtitle, + isEnable: projectViewModel.havePrivilege(40), + ), + )); + + return medical; + } + + + static List myMedicalListHomePage( + {ProjectViewModel projectViewModel, + BuildContext context, + bool isLogin, + count}) { + List medical = List(); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(5) + ? Navigator.push(context, FadePage(page: MyAppointments())) + : null, + child: isLogin + ? Stack(children: [ + MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'appointment_list.svg', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5)), + Positioned( + right: 8, + top: 4, + child: Badge( + toAnimate: false, + elevation: 0, + position: BadgePosition.topEnd(), + shape: BadgeShape.circle, + badgeColor: secondaryColor.withOpacity(1.0), + borderRadius: BorderRadius.circular(8), + badgeContent: Container( + padding: EdgeInsets.all(2.0), + child: Text(count.toString(), + style: TextStyle(color: Colors.white, fontWeight:FontWeight.bold,fontSize: 12.0)), + ), + ), ), - )); - } + ]) + : MedicalProfileItem( + title: TranslationBase.of(context).myAppointments, + imagePath: 'appointment_list.svg', + subTitle: TranslationBase.of(context).myAppointmentsList, + hasBadge: true, + isEnable: projectViewModel.havePrivilege(5), + ), + )); - if (projectViewModel.havePrivilege(47)) { + if (projectViewModel.havePrivilege(10)) { medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyBalancePage())); - }, + onTap: () => Navigator.push(context, FadePage(page: LabsHomePage())), child: MedicalProfileItem( - title: TranslationBase.of(context).myBalance, - imagePath: 'check-in.png', - subTitle: TranslationBase.of(context).myBalanceSubtitle, + title: TranslationBase.of(context).lab, + imagePath: 'lab_result.svg', + subTitle: TranslationBase.of(context).labSubtitle, ), )); } - if (projectViewModel.havePrivilege(61)) { - medical.add(MedicalProfileItem( - title: TranslationBase.of(context).patientCall, - imagePath: 'medical_history_icon.png', - subTitle: TranslationBase.of(context).patientCallSubtitle, - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(7) + ? Navigator.push(context, FadePage(page: RadiologyHomePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).radiology, + imagePath: 'radiology.svg', + subTitle: TranslationBase.of(context).radiologySubtitle, + isEnable: projectViewModel.havePrivilege(7), + ), + )); - if (projectViewModel.havePrivilege(24)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: MyTrackers())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).myTrackers, - imagePath: 'my_tracker_icon.png', - subTitle: TranslationBase.of(context).myTrackersSubtitle, - ), - )); - } - if (projectViewModel.havePrivilege(30)) - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: SmartWatchInstructions())); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).smartWatches, - imagePath: 'smartwatch_icon.png', - subTitle: TranslationBase.of(context).smartWatchesSubtitle, + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(6) + ? Navigator.push( + context, + FadePage( + page: DoctorHomePage(), ), - )); + ) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myDoctor, + imagePath: 'my_doc.svg', + subTitle: TranslationBase.of(context).myDoctorSubtitle, + isEnable: projectViewModel.havePrivilege(6)), + )); - if (projectViewModel.havePrivilege(28)) { - medical.add(InkWell( - onTap: () { - Navigator.push(context, FadePage(page: AskDoctorHomPage())); - }, - child: MedicalProfileItem( + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(12) + ? Navigator.push(context, FadePage(page: HomePrescriptionsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).medicines, + imagePath: 'prescription_icon.png', + subTitle: TranslationBase.of(context).medicinesSubtitle, + isEnable: projectViewModel.havePrivilege(12), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(25) + ? Navigator.push( + context, + FadePage(page: VitalSignDetailsScreen()), + ) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).vitalSigns, + imagePath: 'vital_signs.png', + subTitle: TranslationBase.of(context).vitalSignsSubtitle, + isEnable: projectViewModel.havePrivilege(25), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(48) + ? Navigator.push(context, FadePage(page: ActiveMedicationsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myMedical, + imagePath: 'active_medications.png', + subTitle: TranslationBase.of(context).myMedicalSubtitle, + isEnable: false, + ), + )); + + + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(14) + ? Navigator.push(context, FadePage(page: EyeMeasurementsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).eye, + imagePath: 'eye_measurement_icon.png', + subTitle: TranslationBase.of(context).eyeSubtitle, + isEnable: projectViewModel.havePrivilege(14), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(22) + ? Navigator.push(context, FadePage(page: InsuranceCard())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).insurance, + imagePath: 'insurance_card_icon.png', + subTitle: TranslationBase.of(context).insuranceSubtitle, + isEnable: projectViewModel.havePrivilege(22), + ), + )); + + medical.add(InkWell( + onTap: () { + Navigator.push(context, FadePage(page: InsuranceUpdate())); + }, + child: MedicalProfileItem( + title: TranslationBase.of(context).updateInsurance, + imagePath: 'insurance_update_icon_.png', + subTitle: TranslationBase.of(context).updateInsuranceSubtitle, + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(18) + ? Navigator.push(context, FadePage(page: InsuranceApproval())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).insuranceApproval, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).insuranceApprovalSubtitle, + isEnable: projectViewModel.havePrivilege(18), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(23) + ? Navigator.push(context, FadePage(page: AllergiesPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).allergies, + imagePath: 'my_allergies_icon.png', + subTitle: TranslationBase.of(context).allergiesSubtitle, + isEnable: projectViewModel.havePrivilege(23), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(26) + ? Navigator.push(context, FadePage(page: MyVaccines())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myVaccines, + imagePath: 'my_vaccines_icon.png', + subTitle: TranslationBase.of(context).myVaccinesSubtitle, + isEnable: projectViewModel.havePrivilege(26), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(20) + ? Navigator.push(context, FadePage(page: HomeReportPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).medical, + imagePath: 'medical_reports_icon.png', + subTitle: TranslationBase.of(context).medicalSubtitle, + isEnable: projectViewModel.havePrivilege(20), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(19) + ? Navigator.push(context, FadePage(page: MonthlyReportsPage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).monthly, + imagePath: 'monthly_reports_icon.png', + subTitle: TranslationBase.of(context).monthlySubtitle, + isEnable: projectViewModel.havePrivilege(19), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(16) + ? Navigator.push(context, FadePage(page: PatientSickLeavePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).sick, + imagePath: 'sick_leaves_icons.png', + subTitle: TranslationBase.of(context).sickSubtitle, + isEnable: projectViewModel.havePrivilege(16), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(47) + ? Navigator.push(context, FadePage(page: MyBalancePage())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myBalance, + imagePath: 'check-in.png', + subTitle: TranslationBase.of(context).myBalanceSubtitle, + isEnable: projectViewModel.havePrivilege(47), + ), + )); + + medical.add(MedicalProfileItem( + title: TranslationBase.of(context).patientCall, + imagePath: 'medical_history_icon.png', + subTitle: TranslationBase.of(context).patientCallSubtitle, + isEnable: projectViewModel.havePrivilege(61), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(24) + ? Navigator.push(context, FadePage(page: MyTrackers())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).myTrackers, + imagePath: 'my_tracker_icon.png', + subTitle: TranslationBase.of(context).myTrackersSubtitle, + isEnable: projectViewModel.havePrivilege(24), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(30) + ? Navigator.push(context, FadePage(page: SmartWatchInstructions())) + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).smartWatches, + imagePath: 'smartwatch_icon.png', + subTitle: TranslationBase.of(context).smartWatchesSubtitle, + isEnable: projectViewModel.havePrivilege(30), + ), + )); + + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(28) + ? Navigator.push(context, FadePage(page: AskDoctorHomPage())) + : null, + child: MedicalProfileItem( title: TranslationBase.of(context).askYour, imagePath: 'ask_doctor_icon.png', subTitle: TranslationBase.of(context).askYourSubtitle, - ), - )); - } + isEnable: projectViewModel.havePrivilege(28)), + )); + if (projectViewModel.havePrivilege(32) || true) { medical.add(InkWell( onTap: () { @@ -520,7 +836,7 @@ class Utils { AlertDialogBox( context: context, confirmMessage: - "Please login with your account first to use this feature", + "Please login with your account first to use this feature", okText: "OK", okFunction: () { AlertDialogBox.closeAlertDialog(context); @@ -536,43 +852,46 @@ class Utils { )); } - if (projectViewModel.havePrivilege(40)) { - medical.add(InkWell( - onTap: () { - launch('whatsapp://send?phone=18885521858&text='); - }, - child: MedicalProfileItem( - title: TranslationBase.of(context).chatbot, - imagePath: 'insurance_approvals_icon.png', - subTitle: TranslationBase.of(context).chatbotSubtitle, - ), - )); - } + medical.add(InkWell( + onTap: () => projectViewModel.havePrivilege(40) + ? launch('whatsapp://send?phone=18885521858&text=') + : null, + child: MedicalProfileItem( + title: TranslationBase.of(context).chatbot, + imagePath: 'insurance_approvals_icon.png', + subTitle: TranslationBase.of(context).chatbotSubtitle, + isEnable: projectViewModel.havePrivilege(40), + ), + )); return medical; } - static Widget loadNetworkImage({@required String url, BoxFit fitting = BoxFit.cover}){ + static Widget loadNetworkImage( + {@required String url, BoxFit fitting = BoxFit.cover}) { return CachedNetworkImage( - placeholderFadeInDuration: Duration(milliseconds: 250), - fit: fitting, - imageUrl: url, - placeholder: (context, url) => Container( - child: Center( - child: CircularProgressIndicator() - ) - ), - errorWidget: (context, url, error){ - return Icon(Icons.error, color: Colors.red, size: 50,); - } - ); + placeholderFadeInDuration: Duration(milliseconds: 250), + fit: fitting, + imageUrl: url, + placeholder: (context, url) => + Container(child: Center(child: CircularProgressIndicator())), + errorWidget: (context, url, error) { + return Icon( + Icons.error, + color: Colors.red, + size: 50, + ); + }); } } - - - -Widget applyShadow({ Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}){ +Widget applyShadow( + {Color color = Colors.grey, + double shadowOpacity = 0.5, + double spreadRadius = 2, + double blurRadius = 7, + Offset offset = const Offset(2, 2), + @required Widget child}) { return Container( decoration: BoxDecoration( boxShadow: [ @@ -588,7 +907,6 @@ Widget applyShadow({ Color color = Colors.grey, double shadowOpacity = 0.5, doub ); } - Future userData() async { var userData = AuthenticatedUser.fromJson( await AppSharedPreferences().getObject(MAIN_USER)); @@ -603,15 +921,15 @@ extension IndexedIterable on Iterable { } } -openAppStore({String androidPackageName, String iOSAppID}) async{ - if(Platform.isAndroid){ - assert(!(androidPackageName == null), "Should have valid value in androidPackageName parameter"); - if((await FlutterHmsGmsAvailability.isGmsAvailable)) +openAppStore({String androidPackageName, String iOSAppID}) async { + if (Platform.isAndroid) { + assert(!(androidPackageName == null), + "Should have valid value in androidPackageName parameter"); + if ((await FlutterHmsGmsAvailability.isGmsAvailable)) launch("market://details?id=com.ejada.hmg"); - if((await FlutterHmsGmsAvailability.isHmsAvailable)) + if ((await FlutterHmsGmsAvailability.isHmsAvailable)) launch("appmarket://details?id=com.ejada.hmg"); - - }else if(Platform.isIOS){ + } else if (Platform.isIOS) { assert((iOSAppID == null), "Should have valid value in iOSAppID parameter"); launch("https://itunes.apple.com/kr/app/apple-store/$iOSAppID)"); } diff --git a/lib/widgets/data_display/medical/medical_profile_item.dart b/lib/widgets/data_display/medical/medical_profile_item.dart index c7e47dd9..b24e312c 100644 --- a/lib/widgets/data_display/medical/medical_profile_item.dart +++ b/lib/widgets/data_display/medical/medical_profile_item.dart @@ -1,52 +1,101 @@ +import 'package:auto_size_text/auto_size_text.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/others/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import '../../../Constants.dart'; import '../text.dart'; class MedicalProfileItem extends StatelessWidget { - MedicalProfileItem( - {@required this.imagePath, - @required this.title, - @required this.subTitle, - hasBadge}); - final String imagePath; final String title; final String subTitle; final bool hasBadge = false; + bool isEnable; + + MedicalProfileItem({ + @required this.imagePath, + @required this.title, + @required this.subTitle, + hasBadge, + this.isEnable = true, + }); @override Widget build(BuildContext context) { ProjectViewModel projectViewModel = Provider.of(context); return Container( - height: MediaQuery.of(context).size.height * 0.14, - margin: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(10), - color: Colors.white - ), - padding: EdgeInsets.all(10), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Texts(title, - fontSize: 1.5 * SizeConfig.textMultiplier, - color: secondaryColor, - fontWeight: FontWeight.bold), - Texts(subTitle,fontSize: 1.4 * SizeConfig.textMultiplier,), - Align( - alignment:projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, - child: Image.asset( - "assets/images/medical/$imagePath", - height: SizeConfig.heightMultiplier * 5, - width: SizeConfig.heightMultiplier * 5, + height: MediaQuery.of(context).size.height * 0.143, + width: MediaQuery.of(context).size.height * 0.143, + margin: EdgeInsets.all(0), + decoration: containerColorRadiusBorderWidth(Colors.white, 20, CustomColors.pharmacyGreyColor, 1), + clipBehavior: Clip.antiAlias, + child: Stack( + children: [ + Padding( + padding: EdgeInsets.all(10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Align( + // alignment: projectViewModel.isArabic ? Alignment.bottomLeft : Alignment.bottomRight, + // child: Image.asset( + // "assets/images/medical/$imagePath", + // height: SizeConfig.heightMultiplier * 5, + // width: SizeConfig.heightMultiplier * 5, + // ), + // ), + mFlex(1), + SvgPicture.asset( + "assets/images/new/services/$imagePath", + height: SizeConfig.heightMultiplier * 4, + width: SizeConfig.heightMultiplier * 4, + ), + mFlex(2), + Text( + title, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + Container( + width: double.infinity, + child: Row( + children: [ + Expanded( + child: AutoSizeText( + subTitle, + maxLines: 1, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + ), + mFlex(1), + ], ), - ) + ), + isEnable + ? Container() + : Container( + width: double.infinity, + height: double.infinity, + color: Colors.grey.withOpacity(0.7), + child: Icon( + Icons.lock_outline, + size: 40, + ), + ) ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index fd70e30a..f81621c7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -222,6 +222,7 @@ flutter: - assets/images/pharmacy_module/payment/ - assets/images/pharmacy_module/lakum/ - assets/images/new/ + - assets/images/new/services/ fonts: - family: WorkSans