You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HMG_Patient_App_New/lib/splashPage.dart

114 lines
4.2 KiB
Dart

2 months ago
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';
2 months ago
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/presentation/authantication/login.dart';
2 months ago
import 'package:hmg_patient_app_new/presentation/home/landing_page.dart';
2 months ago
import 'package:hmg_patient_app_new/theme/colors.dart';
2 months ago
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
2 months ago
import 'package:provider/provider.dart';
2 months ago
import 'core/consts.dart';
2 months ago
import 'core/utils/LocalNotification.dart';
import 'core/utils/push-notification-handler.dart';
class SplashPage extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashPage> {
@override
void initState() {
super.initState();
print("Splash init called.............");
2 months ago
Timer(
Duration(milliseconds: 500),
() async {
ApiConsts.setBackendURLs();
PushNotificationHandler().init(context); // Asyncronously
},
);
2 months ago
Timer(Duration(seconds: 3, milliseconds: 500), () async {
2 months ago
LocalNotification.init(onNotificationClick: (payload) {});
Navigator.of(context).pushReplacement(
2 months ago
FadePage(
2 months ago
// page: LandingPage(),
page: LoginScreen(),
2 months ago
),
);
});
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<ProjectViewModel>(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<ThemeNotifier>(context, listen: false);
// themeNotifier.setTheme(defaultTheme(fontName: projectProvider.isArabic ? 'Cairo' : 'Poppins'));
PushNotificationHandler().init(context); // Asyncronously
}
@override
Widget build(BuildContext context) {
return Scaffold(
2 months ago
backgroundColor: AppColors.whiteColor,
2 months ago
body: Stack(
alignment: Alignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 53),
2 months ago
child: Image.asset(AppAssets.hmg_logo, fit: BoxFit.fitWidth, width: MediaQuery.of(context).size.width),
2 months ago
),
Align(
alignment: Alignment.bottomCenter,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Powered by",
2 months ago
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: AppColors.textColor, letterSpacing: -0.56, height: 16 / 14),
2 months ago
),
SizedBox(
height: 5,
),
2 months ago
Utils.buildSvgWithAssets(icon: AppAssets.cloud_logo, width: 40, height: 40),
SizedBox(height: 7),
2 months ago
// Text(
// "Version 1.1.0",
// style: TextStyle(fontSize: 10, fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10),
// ),
SizedBox(
height: 18,
)
],
),
)
],
),
);
}
}