import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/%E2%80%8B%20health_calculators.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/e_referral_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h2o_index_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health-weather/health-weather-indicator.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/health_converter.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/my_web_view.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/parking_page.dart'; import 'package:diplomaticquarterapp/pages/Blood/blood_donation.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/BookingOptions.dart'; import 'package:diplomaticquarterapp/pages/ChildVaccines/child_vaccines_page.dart'; import 'package:diplomaticquarterapp/pages/ContactUs/findus/findus_page.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart'; import 'package:diplomaticquarterapp/pages/ErService/ErOptions.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart'; import 'package:diplomaticquarterapp/pages/paymentService/payment_service.dart'; import 'package:diplomaticquarterapp/pages/symptom-checker/info.dart'; import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/location_util.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/data_display/services)contaniner.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; class AllHabibMedicalService extends StatefulWidget { //TODO final Function goToMyProfile; AllHabibMedicalService({Key key, this.goToMyProfile}); @override _AllHabibMedicalServiceState createState() => _AllHabibMedicalServiceState(); } class _AllHabibMedicalServiceState extends State { AppSharedPreferences sharedPref = AppSharedPreferences(); AuthenticatedUser authUser = new AuthenticatedUser(); LocationUtils locationUtils; var weather = '--'; @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { getAuthUser(); locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); locationUtils.getCurrentLocation(); }); super.initState(); } @override Widget build(BuildContext context) { return AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).alhabiServices, isShowDecPage: false, body: Column( children: [ Expanded( child: ListView( scrollDirection: Axis.vertical, physics: AlwaysScrollableScrollPhysics(), shrinkWrap: true, children: [ Container( margin: EdgeInsets.all(8), width: double.infinity, height: 150, decoration: BoxDecoration( image: DecorationImage( image: ExactAssetImage('assets/images/Weather_img.png'), fit: BoxFit.cover, ), borderRadius: BorderRadius.circular(8.0)), child: Padding( padding: EdgeInsets.symmetric(horizontal: 10.0), child: Row( children: [ Expanded( flex: 3, child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( TranslationBase.of(context) .healthWeatherIndicators, color: Colors.white, fontWeight: FontWeight.w600, ), Texts( TranslationBase.of(context) .healthTipsBasedOnCurrentWeather, color: Colors.white, fontSize: 14, ), ], )), Expanded( flex: 2, child: InkWell( onTap: () { Navigator.push( context, FadePage( page: HealthWeatherIndicator(), ), ); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Image.asset( 'assets/images/Weather_ico.png', width: 60, height: 60, ), AppText(weather, fontSize: 22, color: Colors.white) ], ), Texts( TranslationBase.of(context).moreDetails, color: Colors.white, decoration: TextDecoration.underline, ), ], )), ) ], ), ), ), ServicesContainer( onTap: () { Navigator.pop(context); widget.goToMyProfile(); }, imageLocation: 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: BookingOptions( isAppbar: true, ), ), ), imageLocation: 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: PaymentService(), ), ), imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), ServicesContainer( onTap: () { Navigator.push( context, FadePage( page: ErOptions( isAppbar: true, ), ), ); }, imageLocation: 'assets/images/emergency_service_image.png', title: TranslationBase.of(context).emergencyService, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: MyFamily(), ), ), imageLocation: 'assets/images/new-design/family_menu_icon_red.png', title: TranslationBase.of(context).family, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: ToDo(), ), ), imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: ParkingPage(), ), ), imageLocation: 'assets/images/new-design/parking_system_icon.png', title: TranslationBase.of(context).parking, ), ServicesContainer( onTap: () => launch( "https://hmgwebservices.com/vt_mobile/html/index.html"), imageLocation: 'assets/images/new-design/virtual_tour_icon.png', title: TranslationBase.of(context).vTour, ), ServicesContainer( onTap: () { Navigator.of(context).push( MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: TranslationBase.of(context).hmgNews, selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ), ), ); }, imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png', title: TranslationBase.of(context).latestNews, ), ServicesContainer( onTap: () => Navigator.push( context, FadePage( page: FindUsPage(), ), ), imageLocation: 'assets/images/new-design/find_us_icon.png', title: TranslationBase.of(context).findUs, ), ], ), ), ], ), ); } getAuthUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson( await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); } var data = await this.sharedPref.getObject(WEATHER); weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; print(data); } }