diff --git a/lib/pages/landing/home_page.dart b/lib/pages/landing/home_page.dart index 3a64fbd5..0498b688 100644 --- a/lib/pages/landing/home_page.dart +++ b/lib/pages/landing/home_page.dart @@ -42,6 +42,7 @@ class _HomePageState extends State { onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => AppScaffold( isShowDecPage: false, + isHelp: true, body: Container( width: double.infinity, child: SingleChildScrollView( @@ -69,7 +70,7 @@ class _HomePageState extends State { right: 5, child: Container( width: - MediaQuery.of(context).size.width * 0.8, + MediaQuery.of(context).size.width * 0.8, child: Row( children: [ Expanded( @@ -84,54 +85,82 @@ class _HomePageState extends State { fit: BoxFit.fill, ), color: - Colors.white.withOpacity(0.3), + Colors.white.withOpacity(0.3), borderRadius: BorderRadius.all( Radius.circular(5))), child: Container( - child: Column( children: [ - Texts(TranslationBase.of(context).covidTest, - color: Colors.white, - fontWeight: FontWeight.w700, - ), + Texts( + TranslationBase.of(context) + .covidTest, + color: Colors.white, + fontWeight: FontWeight.w700, + ), Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: + MainAxisAlignment + .spaceAround, children: [ Container( margin: EdgeInsets.only( - top: 15.0,), + 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), + margin: EdgeInsets.only( + top: 5.0), child: Column( children: [ - Texts(TranslationBase.of(context).driveThru, - fontWeight: FontWeight.w700, - color: Colors.white,), + Texts( + TranslationBase.of( + context) + .driveThru, + fontWeight: + FontWeight.w700, + color: Colors.white, + ), ButtonTheme( - shape: RoundedRectangleBorder( + shape: + RoundedRectangleBorder( borderRadius: - BorderRadius.circular(5.0),), - minWidth: MediaQuery.of(context).size.width * 0.15, + 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), + color: Colors + .red[800], + textColor: + Colors.white, + disabledTextColor: + Colors.white, + disabledColor: + new Color( + 0xFFbcc2c4), onPressed: () { navigateToCovidDriveThru(); }, child: Texts( - TranslationBase.of(context).bookNow, - fontWeight: FontWeight.w700, - color: Colors.white, - ), + TranslationBase.of( + context) + .bookNow, + fontWeight: + FontWeight + .w700, + color: Colors + .white, + ), ), ), ], @@ -172,251 +201,255 @@ class _HomePageState extends State { ], ), ), - Container(width: double.infinity, height:projectViewModel.isArabic ?110: 80) + Container( + width: double.infinity, + height: projectViewModel.isArabic ? 110 : 80) ], ), Positioned( top: 155, left: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == - Orientation.landscape + Orientation.landscape ? 0.02 : 0.03), right: MediaQuery.of(context).size.width * (MediaQuery.of(context).orientation == - Orientation.landscape + 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: [ - 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)), + 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: [ + SizedBox( + height: 2, ), - child: Center( - child: Texts( - TranslationBase.of(context).viewMore, - color: Colors.white, - fontWeight: FontWeight.w700, - fontSize: 12, - ), + Texts( + TranslationBase.of(context).myMedicalFile, + color: Colors.black87, + fontWeight: FontWeight.w700, + fontSize: 23, ), - ), - ), - ) - ], - ), - ), - ) - : 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: [ - Row( - children: [ - if (projectViewModel.user != null && model.isLogin) - Expanded( - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - SizedBox( - height: 8, - ), - 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( + 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)), ), - Texts( - '${DateUtil.getMonthDayYearDateFormatted(model.user.dateofBirthDataTime)} ,${model.user.genderDescription} ${model.user.ageDesc}', - color: Colors.grey[100], - fontWeight: FontWeight.normal, - fontSize: 14, + child: Center( + child: Texts( + TranslationBase.of(context) + .viewMore, + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 12, + ), ), - ], - ), - ), - 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) - .viewMore, - color: Colors.white, - fontSize: 12, - ), - ), - ), - ) - ], + ) + ], + ), ), - Row( - children: [ - Expanded( - child: Row( + ) + : 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: [ + Row( children: [ - Image.asset( - 'assets/images/height_icon.png', - width: 35, - height: 40, - ), - Texts( - "${model.heightCm}", - color: Colors.white, - fontSize: 17, + if (projectViewModel.user != null && + model.isLogin) + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + SizedBox( + height: 8, + ), + 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.genderDescription} ${model.user.ageDesc}', + 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) + .viewMore, + color: Colors.white, + fontSize: 12, + ), + ), + ), ) ], ), - ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( + Row( children: [ - Image.asset( - 'assets/images/weight_icon.png', - width: 25, - height: 40, + Expanded( + child: Row( + children: [ + Image.asset( + 'assets/images/height_icon.png', + width: 35, + height: 40, + ), + Texts( + "${model.heightCm}", + color: Colors.white, + fontSize: 17, + ) + ], + ), ), - Texts( - '${model.weightKg}', - color: Colors.white, - fontSize: 17 - ) - ], - ), - ), - SizedBox( - width: 3, - ), - Expanded( - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Image.asset( - 'assets/images/blood_icon.png', - width: 35, - height: 40, + SizedBox( + width: 3, + ), + Expanded( + child: Row( + children: [ + Image.asset( + 'assets/images/weight_icon.png', + width: 25, + height: 40, + ), + Texts('${model.weightKg}', + color: Colors.white, + fontSize: 17) + ], + ), + ), + SizedBox( + width: 3, + ), + Expanded( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Image.asset( + 'assets/images/blood_icon.png', + width: 35, + height: 40, + ), + Texts( + '${model.booldType}', + color: Colors.white, + ) + ], + ), ), - Texts( - '${model.booldType}', - color: Colors.white, - ) ], - ), - ), - ], - ) - ], - ), - ), - ), + ) + ], + ), + ), + ), ), ], ), - if(projectViewModel.havePrivilege(64)||projectViewModel.havePrivilege(65)||projectViewModel.havePrivilege(67)) + if (projectViewModel.havePrivilege(64) || + projectViewModel.havePrivilege(65) || + projectViewModel.havePrivilege(67)) Container( margin: EdgeInsets.only(left: 15, right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if(projectViewModel.havePrivilege(64)) + if (projectViewModel.havePrivilege(64)) DashboardItem( onTap: () { Navigator.push( @@ -444,7 +477,8 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: SizeConfig.textMultiplier * 1.55, + fontSize: + SizeConfig.textMultiplier * 1.55, ) ], ), @@ -454,10 +488,10 @@ class _HomePageState extends State { imageName: 'home_healthcare_service_bg.png', opacity: 0.5, ), - if(projectViewModel.havePrivilege(65)) + if (projectViewModel.havePrivilege(65)) DashboardItem( - onTap: () => Navigator.push(context, FadePage(page: LandingPagePharmacy())), - + onTap: () => Navigator.push( + context, FadePage(page: LandingPagePharmacy())), child: Center( child: Padding( padding: const EdgeInsets.all(15.0), @@ -472,11 +506,13 @@ class _HomePageState extends State { height: 20, ), Texts( - TranslationBase.of(context).onlinePharmacy, + TranslationBase.of(context) + .onlinePharmacy, textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: SizeConfig.textMultiplier * 1.55, + fontSize: + SizeConfig.textMultiplier * 1.55, ) ], ), @@ -485,9 +521,9 @@ class _HomePageState extends State { height: MediaQuery.of(context).size.width * 0.4, imageName: 'al-habib_onlne_pharmacy_bg.png', ), - if(projectViewModel.havePrivilege(67)) + if (projectViewModel.havePrivilege(67)) DashboardItem( - onTap: (){ + onTap: () { Navigator.push( context, FadePage( @@ -506,14 +542,16 @@ class _HomePageState extends State { height: 50, ), SizedBox( - height:10, + height: 10, ), Texts( - TranslationBase.of(context).emergencyService, + TranslationBase.of(context) + .emergencyService, textAlign: TextAlign.center, color: Colors.white, fontWeight: FontWeight.w700, - fontSize: SizeConfig.textMultiplier * 1.55, + fontSize: + SizeConfig.textMultiplier * 1.55, ) ], ), @@ -601,7 +639,7 @@ class _HomePageState extends State { borderRadius: BorderRadius.circular(6.0), color: Colors.white, )), - if(projectViewModel.havePrivilege(60)) + if (projectViewModel.havePrivilege(60)) Container( width: MediaQuery.of(context).size.width * 0.29, child: InkWell( @@ -609,8 +647,8 @@ class _HomePageState extends State { context, FadePage( page: ErOptions( - isAppbar: true, - ))), + isAppbar: true, + ))), child: Center( child: Padding( padding: const EdgeInsets.all(15.0), @@ -630,7 +668,8 @@ class _HomePageState extends State { textAlign: TextAlign.center, color: Colors.black87, bold: false, - fontSize: SizeConfig.textMultiplier * 1.7, + fontSize: + SizeConfig.textMultiplier * 1.7, ) ], ), @@ -757,15 +796,15 @@ class _HomePageState extends State { 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}) + 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; @@ -783,14 +822,16 @@ class DashboardItem extends StatelessWidget { 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, + 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) + ? color + : HexColor('#050705').withOpacity(opacity) : Colors.white, borderRadius: BorderRadius.circular(6.0), border: hasBorder @@ -798,11 +839,13 @@ class DashboardItem extends StatelessWidget { : 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, - ) + image: ExactAssetImage('assets/images/$imageName'), + fit: BoxFit.cover, + colorFilter: hasColorFilter + ? new ColorFilter.mode( + Colors.black.withOpacity(0.2), BlendMode.dstIn) + : null, + ) : null, ), child: Center( diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index f53585cb..83454307 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -514,7 +514,13 @@ class _LandingPageState extends State with WidgetsBindingObserver { : IconButton( icon: Icon(Icons.arrow_back), color: Colors.white, - onPressed: () => currentTab = 0, + onPressed: () { + setState(() { + currentTab = 0; + }); + + pageController.jumpToPage(0); + }, ), notificationCount != '' ? new Positioned( @@ -572,7 +578,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { children: [ HomePage( goToMyProfile: () { - // _changeCurrentTab(1); + _changeCurrentTab(0); }, ), MedicalProfilePage(), @@ -608,7 +614,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { return TranslationBase.of(context).medicalProfile; case 2: return TranslationBase.of(context).bookAppo; - case 5: + case 5: return TranslationBase.of(context).bookAppo; case 3: return TranslationBase.of(context).services; diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart index c57bc51b..53822f1d 100644 --- a/lib/widgets/bottom_navigation/bottom_nav_bar.dart +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -47,67 +47,70 @@ class _BottomNavBarState extends State { color: Colors.white, child: Padding( padding: EdgeInsets.symmetric(horizontal: 18), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - BottomNavigationItem( - icon: EvaIcons.home, - activeIcon: EvaIcons.home, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 0, - name: TranslationBase.of(context).home, - ), - BottomNavigationItem( - icon: DQIcons.my_medical_file, - activeIcon: DQIcons.my_medical_file, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 1, - name: TranslationBase.of(context).medicalProfile, - ), - if (widget.index == 0 && projectViewModel.havePrivilege(34)) - Expanded( - child: SizedBox( - height: 50, - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SizedBox(height: 22), - ], - ), + child: Directionality( + textDirection: TextDirection.ltr, + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + BottomNavigationItem( + icon: DQIcons.my_medical_file, + activeIcon: DQIcons.my_medical_file, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 1, + name: TranslationBase.of(context).medicalProfile, + ), + BottomNavigationItem( + icon: DQIcons.family, + activeIcon: DQIcons.family, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 3, + name: TranslationBase.of(context).myFamily, ), - ), - if (widget.index != 0 && projectViewModel.havePrivilege(34)) - BottomNavigationItem( - icon: EvaIcons.calendar, - activeIcon: EvaIcons.calendar, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 2, - name: TranslationBase.of(context).bookAppo, - ), - BottomNavigationItem( - icon: DQIcons.family, - activeIcon: DQIcons.family, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 3, - name: TranslationBase.of(context).myFamily, - ), - if (projectViewModel.havePrivilege(51)) - BottomNavigationItem( - icon: EvaIcons.calendar, - activeIcon: EvaIcons.calendar, - changeIndex: _changeIndex, - index: widget.index, - currentIndex: 4, - name: TranslationBase.of(context).todoList, - ) - ], - ), + if (widget.index == 0) + Expanded( + child: SizedBox( + height: 50, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 22), + ], + ), + ), + ), + if (widget.index != 0 && projectViewModel.havePrivilege(34)) + BottomNavigationItem( + icon: EvaIcons.calendar, + activeIcon: EvaIcons.calendar, + changeIndex: _changeIndex, + index: _index, + currentIndex: 2, + name: TranslationBase.of(context).bookAppo, + ), + if (widget.index == 0 && projectViewModel.havePrivilege(34)) + BottomNavigationItem( + icon: EvaIcons.calendar, + activeIcon: EvaIcons.calendar, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 4, + name: TranslationBase.of(context).todoList, + ), + if (projectViewModel.havePrivilege(77)) + BottomNavigationItem( + icon: DQIcons.roboticon, + activeIcon: DQIcons.roboticon, + changeIndex: _changeIndex, + index: widget.index, + currentIndex: 0, + name: TranslationBase.of(context).help, + ) + ], + )), ), ); } diff --git a/lib/widgets/others/app_scaffold_pharmacy_widget.dart b/lib/widgets/others/app_scaffold_pharmacy_widget.dart index d818628e..c3bd8a47 100644 --- a/lib/widgets/others/app_scaffold_pharmacy_widget.dart +++ b/lib/widgets/others/app_scaffold_pharmacy_widget.dart @@ -106,8 +106,6 @@ class PharmacyAppScaffold extends StatelessWidget { buildBodyWidget() { // return body; //Stack(children: [body, buildAppLoaderWidget(isLoading)]); - return Stack(children: [ - body, /*FloatingSearchButton()*/ - ]); + return Stack(children: [body, FloatingSearchButton()]); } } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 6a242c7d..0ce115e0 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -8,11 +8,14 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; +import 'package:diplomaticquarterapp/widgets/typewriter/typewiter.dart'; +import 'package:diplomaticquarterapp/widgets/weather_slider/weather_slider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -24,6 +27,8 @@ import '../progress_indicator/app_loader_widget.dart'; import 'arrow_back.dart'; import 'network_base_view.dart'; import 'not_auh_page.dart'; +import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; class AppScaffold extends StatelessWidget { final String appBarTitle; @@ -44,7 +49,8 @@ class AppScaffold extends StatelessWidget { final double preferredSize; final List appBarIcons; final List imagesInfo; - + final bool isHelp; + bool isAnimation = false; AuthenticatedUserObject authenticatedUserObject = locator(); @@ -66,6 +72,7 @@ class AppScaffold extends StatelessWidget { this.preferredSize = 0.0, this.appBarIcons, this.infoList, + this.isHelp = false, this.imagesInfo}); @override @@ -93,16 +100,21 @@ class AppScaffold extends StatelessWidget { ) : baseViewModel != null ? NetworkBaseView( - child: body, + child: buildBodyWidget(context), baseViewModel: baseViewModel, ) - : body, + : buildBodyWidget(context), ); } buildAppLoaderWidget(bool isLoading) { return isLoading ? AppLoaderWidget() : Container(); } + + buildBodyWidget(context) { + return Stack( + children: [body, isHelp == true ? RobotIcon() : Container()]); + } } class AppBarWidget extends StatelessWidget with PreferredSizeWidget { @@ -175,3 +187,98 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { @override Size get preferredSize => Size(double.maxFinite, 60); } + +class RobotIcon extends StatefulWidget { + @override + _RobotIcon createState() => _RobotIcon(); +} + +class _RobotIcon extends State { + var event = RobotProvider(); + bool isAnimation = false; + + @override + void initState() { + event.controller.stream.listen((p) { + if (p['animationEnable'] == 'false') { + //setState(() { + // if (this.mounted) { + this.isAnimation = false; + //} + // }); + } + }); + + setState(() { + setAnimation(); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Positioned( + child: Column( + children: [ + isAnimation + ? Container( + height: 150, + width: 200, + padding: EdgeInsets.all(5), + margin: EdgeInsets.only(right: 35.0, bottom: 0), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Colors.white, + boxShadow: [ + BoxShadow(color: Colors.black, spreadRadius: 1), + ], + ), + child: TyperAnimatedTextKit( + text: Provider.of(context, + listen: false) + .isArabic == + true + ? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." + : "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", + textLength: Provider.of(context, + listen: false) + .isArabic == + true + ? "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." + .length + : "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file." + .length)) + : Container(), + Stack( + children: [ + isAnimation + ? Positioned( + top: 0, + right: 40, + child: Container( + height: 0, + width: 0, + decoration: ShapeDecoration( + color: Colors.grey, + shape: MessageBorder(reverse: true), + ))) + : Container(), + FloatingSearchButton() + ], + ) + ], + ), + right: -30, + bottom: 50); + } + + setAnimation() async { + //await sharedPref.getBool(IS_ROBOT_VISIBLE) || + var animation = + await sharedPref.getBool(IS_ROBOT_INIT) == null ? true : false; + + setState(() { + this.isAnimation = animation; + }); + } +} diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 1dc41621..cddeba51 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:collection'; import 'dart:io'; import 'dart:math'; @@ -48,6 +49,7 @@ import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/services/robo_search/search_provider.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; @@ -63,8 +65,6 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/DoctorProfile.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/Search.dart'; import 'package:flutter/cupertino.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/screens/pharmacy_module_page.dart'; - -import 'package:smart_progress_bar/smart_progress_bar.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; @@ -180,6 +180,7 @@ class _FloatingSearchButton extends State : 'assets/images/gif/robot-idle.gif'), ), onTap: () { + RoboSearch.isClosed = false; new RoboSearch(context: context).showAlertDialog(context); initSpeechState().then((value) => {startVoiceSearch()}); }, @@ -709,10 +710,12 @@ class _FloatingSearchButton extends State List arr = []; List arrDistance = []; DoctorsListService service = new DoctorsListService(); + GifLoaderDialogUtils.showMyDialog(context); service .getDoctorsList(clinicId, projectId, isNearest, context, doctorId: doctorId, doctorName: doctorName) .then((res) { + GifLoaderDialogUtils.hideDialog(context); if (res['MessageStatus'] == 1) { setState(() { if (res['SearchDoctorsByTime_IsVoiceCommandList'] != null && @@ -760,9 +763,10 @@ class _FloatingSearchButton extends State AppToast.showErrorToast(message: res['ErrorEndUserMessage']); } }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + AppToast.showErrorToast(message: err); print(err); - }).showProgressBar( - text: "Loading", backgroundColor: Colors.blue.withOpacity(0.6)); + }); } Future navigateToDoctorProfile(context, docObject, docProfile, @@ -892,27 +896,28 @@ class _FloatingSearchButton extends State class RoboSearch { final BuildContext context; var event = RobotProvider(); - var searchText = null; + var searchText; + static StreamSubscription streamSubscription; + static var isClosed = false; RoboSearch({ @required this.context, }); showAlertDialog(BuildContext context) { - // set up the buttons - - // set up the AlertDialog AlertDialog alert = AlertDialog( content: StatefulBuilder( builder: (BuildContext context, StateSetter setState) { - setState(() { - event.controller.stream.listen((p) { - if (p['searchText'] != null) { - setState(() { - searchText = p['searchText']; - }); - } - }); + streamSubscription = event.controller.stream.listen((p) { + if (p['searchText'] != 'null' && + p['searchText'] != null && + p['searchText'] != "" && + isClosed == false) { + setState(() { + searchText = p['searchText']; + }); + } }); + print(streamSubscription); return Container( color: Colors.white, height: SizeConfig.realScreenHeight * 0.5, @@ -969,10 +974,12 @@ class RoboSearch { builder: (BuildContext context) { return alert; }, - ); + ).then((value) => {}); } static closeAlertDialog(BuildContext context) { + isClosed = true; + streamSubscription.cancel(); Navigator.of(context).pop(); } }