diff --git a/lib/core/service/medical/prescriptions_service.dart b/lib/core/service/medical/prescriptions_service.dart index ce91be53..fa2a24c6 100644 --- a/lib/core/service/medical/prescriptions_service.dart +++ b/lib/core/service/medical/prescriptions_service.dart @@ -34,10 +34,10 @@ class PrescriptionsService extends BaseService { } Future getPrescriptionsOrders() async { + prescriptionsOrderList.clear(); Map body = Map(); body['isDentalAllowedBackend'] = false; await baseAppClient.post(GET_PRESCRIPTIONS_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { - prescriptionsOrderList.clear(); response['PatientER_GetPatientAllPresOrdersList'].forEach((prescriptionsOrder) { prescriptionsOrderList.add(PrescriptionsOrder.fromJson(prescriptionsOrder)); }); diff --git a/lib/core/viewModels/medical/prescriptions_view_model.dart b/lib/core/viewModels/medical/prescriptions_view_model.dart index 38009f45..0c1fafdf 100644 --- a/lib/core/viewModels/medical/prescriptions_view_model.dart +++ b/lib/core/viewModels/medical/prescriptions_view_model.dart @@ -77,14 +77,17 @@ class PrescriptionsViewModel extends BaseViewModel { } getPrescriptionsOrders({bool showLoading = false}) async { - if (showLoading) setState(ViewState.Busy); - await _prescriptionsService.getPrescriptionsOrders(); - if (_prescriptionsService.hasError) { - error = _prescriptionsService.error; - setState(ViewState.ErrorLocal); - } else { - setState(ViewState.Idle); - } + // print(showLoading); + setState(ViewState.Busy); + Future.delayed(new Duration(milliseconds: 300)).then((value) async { + await _prescriptionsService.getPrescriptionsOrders(); + if (_prescriptionsService.hasError) { + error = _prescriptionsService.error; + setState(ViewState.ErrorLocal); + } else { + setState(ViewState.Idle); + } + }); } setFilterType(FilterType filterType) { diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index 982b9044..9478ae38 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -1,20 +1,15 @@ import 'dart:ui'; -import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; -import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; -import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; -import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; -import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; @@ -77,132 +72,37 @@ class _H2OPageState extends State with SingleTickerProviderStateMixin { }, ), ], - body: Scaffold( - // extendBodyBehindAppBar: true, - // appBar: PreferredSize( - // preferredSize: Size.fromHeight(65.0), - // child: Stack( - // children: [ - // Positioned( - // bottom: 1, - // left: 0, - // right: 0, - // child: BackdropFilter( - // filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - // child: Container( - // color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), - // height: 70.0, - // ), - // ), - // ), - // Center( - // child: Container( - // height: 60.0, - // alignment: Alignment.center, - // // margin: EdgeInsets.only(top: 10.0), - // // width: MediaQuery.of(context).size.width * 0.9, - // - // child: TabBar( - // isScrollable: false, - // controller: _tabController, - // indicatorWeight: 5.0, - // indicatorSize: TabBarIndicatorSize.tab, - // indicatorColor: Colors.red[800], - // labelColor: Theme.of(context).primaryColor, - // labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), - // unselectedLabelColor: Colors.grey[800], - // tabs: [ - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).today), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).week), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).month), - // ), - // ), - // ], - // ), - // ), - // ), - // ], - // ), - // ), - // backgroundColor: Colors.white, - body: Column( - children: [ - TabBar( + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), controller: _tabController, - indicatorWeight: 3.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Color(0xff2B353E), - unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - labelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - unselectedLabelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + children: [TodayPage(), WeekPage(), MonthPage()], ), - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [TodayPage(), WeekPage(), MonthPage()], - ), - ) - ], - ), - bottomNavigationBar: BottomNavBar( - changeIndex: (index) { - if (index == 0) { - IS_VOICE_COMMAND_CLOSED = false; - } else if (index == 1) { - Navigator.push( - context, - FadePage( - page: AppScaffold( - appBarTitle: TranslationBase.of(context).medicalProfile, - isShowAppBar: true, - showHomeAppBarIcon: false, - appBarIcons: [ - IconButton( - icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), - color: Colors.white, - onPressed: () => Navigator.of(context).pushNamed( - SETTINGS, - ), - ), - ], - body: MedicalProfilePageNew()))); - } else if (index == 2) { - Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); - } else if (index == 3) { - Navigator.of(context).pushNamed(MY_FAMILIY); - } else if (index == 4) { - Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); - } - }, - showHomeIcon: true, - index: 0, - ), + ) + ], ), ), );