|
|
|
import 'dart:async';
|
|
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:firebase_analytics/observer.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'analytics/google-analytics.dart';
|
|
|
|
import 'config/shared_pref_kay.dart';
|
|
|
|
import 'config/size_config.dart';
|
|
|
|
import 'core/service/AuthenticatedUserObject.dart';
|
|
|
|
import 'core/service/privilege_service.dart';
|
|
|
|
import 'core/viewModels/project_view_model.dart';
|
|
|
|
import 'locator.dart';
|
|
|
|
import 'models/Authentication/authenticated_user.dart';
|
|
|
|
import 'widgets/transitions/slide_up_page.dart';
|
|
|
|
|
|
|
|
AppSharedPreferences sharedPref = new AppSharedPreferences();
|
|
|
|
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
|
|
|
|
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_SplashScreenState createState() => _SplashScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _SplashScreenState extends State<SplashScreen> {
|
|
|
|
PrivilegeService _privilegeService = locator<PrivilegeService>();
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
Timer(
|
|
|
|
Duration(seconds: 1, milliseconds: 500),
|
|
|
|
() {
|
|
|
|
loadPrivilege().then((value) {
|
|
|
|
Navigator.of(context).pushReplacement(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (BuildContext context) => LandingPage(),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// load the Privilege from service
|
|
|
|
Future loadPrivilege() async {
|
|
|
|
await _privilegeService.getPrivilege();
|
|
|
|
Provider.of<ProjectViewModel>(context, listen: false).setPrivilegeModelList(privilege: _privilegeService.privilegeModelList);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Color(0xffF8F8F8),
|
|
|
|
body: Stack(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 53),
|
|
|
|
child: Image.asset(
|
|
|
|
'assets/images/new/hmg_logo.png',
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
width: MediaQuery.of(context).size.width,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Align(
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
TranslationBase.of(context).poweredBy,
|
|
|
|
style: TextStyle(fontSize: 14, fontFamily: "Poppins", fontWeight: FontWeight.w400, color: Color(0xff333C45), letterSpacing: -0.56, height: 16 / 14),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
SvgPicture.asset(
|
|
|
|
'assets/images/new/cloud_logo.svg',
|
|
|
|
width: 40,
|
|
|
|
height: 40,
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 7,
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
"Version 1.1.0",
|
|
|
|
style: TextStyle(fontSize: 10, fontFamily: "Poppins", fontWeight: FontWeight.w400, color: Color(0xff3989898), letterSpacing: 0, height: 12 / 10),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
height: 18,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|