mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
60 lines
1.8 KiB
Dart
60 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
|
|
class SplashView extends StatelessWidget {
|
|
const SplashView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
//TODO remove this delay
|
|
Future.value().then((value) async {
|
|
var isLoggedIn = await const FlutterSecureStorage()
|
|
.read(key: Constants.tokenAccessKey) !=
|
|
null;
|
|
if (isLoggedIn) {
|
|
Navigator.pushReplacementNamed(context, Routes.homeRoute);
|
|
} else {
|
|
Navigator.pushReplacementNamed(context, Routes.authLogin);
|
|
}
|
|
});
|
|
return Scaffold(
|
|
body: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(
|
|
Assets.imagesBackground,
|
|
),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(Assets.imagesVector),
|
|
fit: BoxFit.cover,
|
|
opacity: 0.9,
|
|
),
|
|
),
|
|
),
|
|
SvgPicture.asset(
|
|
Assets.imagesLogo,
|
|
width: 240,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|