mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 05:27: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.
109 lines
4.2 KiB
Dart
109 lines
4.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/dont_have_an_account.dart';
|
|
import 'package:syncrow_app/features/auth/view/widgets/login/login_divider.dart';
|
|
import 'package:syncrow_app/features/auth/view/widgets/login/login_form.dart';
|
|
import 'package:syncrow_app/features/auth/view/widgets/login/login_with_google_facebook.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
|
import 'package:syncrow_app/generated/assets.dart';
|
|
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
|
|
|
class LoginView extends StatelessWidget {
|
|
const LoginView({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocConsumer<AuthCubit, AuthState>(
|
|
listener: (context, state) {
|
|
if (state is AuthError) {
|
|
// ScaffoldMessenger.of(context).showSnackBar(
|
|
// SnackBar(
|
|
// content: Text(state.message),
|
|
// ),
|
|
// );
|
|
} else if (state is AuthLoginSuccess) {
|
|
Navigator.popAndPushNamed(context, Routes.homeRoute);
|
|
}
|
|
},
|
|
builder: (context, state) {
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
body: Stack(
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
right: Constants.defaultPadding,
|
|
left: Constants.defaultPadding,
|
|
top: Constants.defaultPadding,
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Center(
|
|
child: SvgPicture.asset(
|
|
Assets.assetsImagesLogo,
|
|
width: 160,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 40,
|
|
),
|
|
TitleMedium(
|
|
text: 'Login',
|
|
style: context.titleMedium.copyWith(
|
|
fontWeight: FontsManager.extraBold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
const SizedBox(
|
|
height: 20,
|
|
),
|
|
const LoginForm(),
|
|
const LoginDivider(),
|
|
const LoginWithGoogleFacebook(),
|
|
const DontHaveAnAccount(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|