mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 18:47:56 +00:00
changed the method of generating assets to be more declrative when it comes to names of the assets. it now include the file path name e.g (asset in the path "assets/images/home-images/home.png" will be generated as this "String assetsImagesHomeImageshome = "path" ". this will be very helpful in the future when we want to orgnize the assets dir.
68 lines
2.2 KiB
Dart
68 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
|
import 'package:syncrow_app/features/auth/view/widgets/login/login_view.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
|
|
|
class SplashView extends StatelessWidget {
|
|
const SplashView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocConsumer<AuthCubit, AuthState>(
|
|
listener: (context, state) {
|
|
if (state is AuthTokenSuccess) {
|
|
Navigator.pushNamedAndRemoveUntil(
|
|
context, Routes.homeRoute, (route) => false);
|
|
} else if (state is AuthTokenError) {
|
|
Future.delayed(const Duration(seconds: 1), () {
|
|
Navigator.pushReplacement(
|
|
context,
|
|
CustomPageRoute(builder: (context) => const LoginView()),
|
|
);
|
|
});
|
|
}
|
|
},
|
|
builder: (context, state) {
|
|
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.assetsImagesBackground,
|
|
),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: MediaQuery.sizeOf(context).width,
|
|
height: MediaQuery.sizeOf(context).height,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(Assets.assetsImagesVector),
|
|
fit: BoxFit.cover,
|
|
opacity: 0.9,
|
|
),
|
|
),
|
|
),
|
|
SvgPicture.asset(
|
|
Assets.assetsImagesLogo,
|
|
width: 240,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|