mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-27 18:04:55 +00:00
This commit adds the HomeCubit class along with its corresponding HomeState class. It also includes necessary imports and updates references to the previously used SpacesCubit to the new HomeCubit in various files. handled the multible onCreate -- HomeCubit
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.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,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|