import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_zoom_videosdk/native/zoom_videosdk.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/features/authentication/authentication_view_model.dart'; // import 'package:hmg_patient_app_new/presentation/authantication/login.dart'; import 'package:hmg_patient_app_new/presentation/home/landing_page.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:provider/provider.dart'; import 'core/cache_consts.dart'; import 'core/utils/local_notifications.dart'; import 'core/utils/push_notification_handler.dart'; import 'widgets/routes/custom_page_route.dart'; class SplashPage extends StatefulWidget { @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State { late AuthenticationViewModel authVm; Future initializeStuff() async { Timer( Duration(milliseconds: 500), () async { ApiConsts.setBackendURLs(); PushNotificationHandler().init(context); // Asyncronously }, ); await authVm.getServicePrivilege(); Timer(Duration(seconds: 2, milliseconds: 500), () async { LocalNotification.init(onNotificationClick: (payload) {}); Navigator.of(context).pushReplacement( CustomPageRoute( page: LandingNavigation(), // page: LoginScreen(), ), ); }); var zoom = ZoomVideoSdk(); InitConfig initConfig = InitConfig( domain: "zoom.us", enableLog: true, ); zoom.initSdk(initConfig); } /// load the Privilege from service Future loadPrivilege() async { // ProjectViewModel projectProvider = Provider.of(context, listen: false); // projectProvider.setPrivilegeModelList(privilege: _privilegeService.privilegeModelList); // projectProvider.setVidaPlusProjectList(_privilegeService.vidaPlusProjectListModel); // projectProvider.setHMCProjectList(_privilegeService.hMCProjectListModel); // projectProvider.setProjectsDetailList(_privilegeService.projectDetailListModel); // double lat = await AppSharedPreferences().getDouble(USER_LAT) ?? 0.0; // double long = await AppSharedPreferences().getDouble(USER_LONG) ?? 0.0; // AppSharedPreferences().clear(); // Clearing Shared Preferences On App Launch // await AppSharedPreferences().setDouble(USER_LAT, lat); // await AppSharedPreferences().setDouble(USER_LONG, long); // AppSharedPreferences().setString(APP_LANGUAGE, projectProvider.isArabic ? "ar" : "en"); // var themeNotifier = Provider.of(context, listen: false); // themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins')); PushNotificationHandler().init(context); // Asyncronously } @override void initState() { authVm = context.read(); super.initState(); initializeStuff(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.whiteColor, body: Stack( alignment: Alignment.center, children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 53), child: Image.asset(AppAssets.hmg_logo, fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width), ), Align( alignment: Alignment.bottomCenter, child: Column( mainAxisSize: MainAxisSize.min, children: [ Text( "Powered by", style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: AppColors.textColor, letterSpacing: -0.56, height: 16 / 14), ), SizedBox( height: 5, ), Utils.buildSvgWithAssets(icon: AppAssets.cloud_logo, width: 40, height: 40), SizedBox(height: 7), // Text( // "Version 1.1.0", // style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10), // ), SizedBox( height: 18, ) ], ), ) ], ), ); } }