94 lines
3.1 KiB
Dart
94 lines
3.1 KiB
Dart
import 'dart:async';
|
|
import 'dart:developer';
|
|
|
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:regroup/Global.dart';
|
|
import 'package:regroup/Utils/Common/NoInternet.dart';
|
|
import 'package:regroup/onboarding/Signup/view_model/getUserprofile.dart';
|
|
import 'package:regroup/resources/routes/route_name.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
// import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
Future.delayed(const Duration(seconds: 2), () async {
|
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
token = prefs.getString('access-token');
|
|
emailid = prefs.getString('email');
|
|
myusername = prefs.getString('username');
|
|
fullname = prefs.getString('fullname');
|
|
phonenumber = prefs.getString('phone');
|
|
|
|
if (token == null || token!.isEmpty) {
|
|
Get.toNamed(RouteName.onboarding1);
|
|
} else {
|
|
await Getuserdetails().Getuser().then((value) {
|
|
if (getuserobj?.data?.userData?.isProfileUpdated == 0) {
|
|
String? accountype =
|
|
getuserobj?.data?.userData?.principalTypeXid.toString();
|
|
|
|
if (accountype == "1") {
|
|
Get.toNamed(RouteName.tellusindividualscreen,
|
|
arguments: {'pageroute': "mainscreen"});
|
|
} else if (accountype == "2") {
|
|
Get.toNamed(RouteName.tellusbusinessscreen,
|
|
arguments: {'pageroute': "mainscreen"});
|
|
}
|
|
} else {
|
|
Get.toNamed(RouteName.mainscreen);
|
|
}
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xff222935),
|
|
body: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: MediaQuery.of(context).size.height,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
const Color(0xff009DAB).withOpacity(0.25),
|
|
const Color(0xff35798C).withOpacity(0.44),
|
|
const Color(0xffD90B2E).withOpacity(0.33),
|
|
const Color(0xffD90B2E).withOpacity(0.52),
|
|
const Color(0xffD90B2E).withOpacity(0.59),
|
|
],
|
|
)),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SvgPicture.asset(
|
|
"assets/images/svg/mainsplash.svg",
|
|
width: 211.w,
|
|
height: 211.h,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|