Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
sign_in_screen.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_bloc/flutter_bloc.dart';
3
4import '../../../../../core/constants/assets.dart';
5import '../../../../../core/ui/widgets/custom_scaffold.dart';
6import '../../../../../core/ui/widgets/custom_snackbar.dart';
7import '../../../../../core/ui/widgets/language_selector.dart';
8import '../../../domain/entities/credentials_entity.dart';
9import '../../bloc/authentication_bloc/authentication_bloc.dart';
10import 'views/signin_form_view.dart';
11import 'views/signin_with_biometric_view.dart';
12import 'package:flutter_svg/flutter_svg.dart';
13import 'package:flutter_screenutil/flutter_screenutil.dart';
14
15class SignInScreen extends StatelessWidget {
16 const SignInScreen({super.key});
17
18 @override
19 Widget build(BuildContext context) {
20 return BlocConsumer<AuthenticationBloc, AuthenticationState>(
21 listenWhen: (previous, current) => current is AuthenticationFailureState || current is CredentialsLoadedState,
22 listener: (context, state) {
24 if (state.credentials != null &&
25 state.credentials?.email != null &&
26 state.credentials?.password != null) {
27 context.read<AuthenticationBloc>().add(
30 email: state.credentials!.email!,
31 password: state.credentials!.password!,
32 ),
33 ),
34 );
35 }
36 }
39 context,
40 state.failure.color,
41 state.failure.message,
42 );
43 }
44 },
45 builder: (context, state) => CustomScaffold(
46 isLoading: state is AuthenticatingState,
47 body: SafeArea(
49 children: [
50 Expanded(
51 child: Center(
52 child: SingleChildScrollView(
54 children: [
55 Padding(
56 padding: EdgeInsets.symmetric(vertical: 10.sp),
57 child: SvgPicture.asset(
59 colorFilter: ColorFilter.mode(
60 Theme.of(context).colorScheme.onSurface,
61 BlendMode.srcIn,
62 ),
63 height: 50.sp,
64 ),
65 ),
66 SignInFormView(),
67 SigninWithBiometricView(),
68 ],
69 ),
70 ),
71 ),
72 ),
73 // Language selector at the bottom
74 Padding(
75 padding: EdgeInsets.only(bottom: 16.sp),
76 child: Row(
77 mainAxisAlignment: MainAxisAlignment.center,
78 children: [
79 // Text(
80 // 'Language:',
81 // style: TextStyle(
82 // fontSize: 14.sp,
83 // color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
84 // ),
85 // ),
86 // SizedBox(width: 8.sp),
87 const LanguageSelector(),
88 ],
89 ),
90 ),
91 ],
92 ),
93 ),
94 ),
95 );
96 }
97}
const SignInEvent({required this.reqEntity})
sealed class AuthenticationEvent extends Equatable reqEntity
const CredentialsLoadedState({required this.credentials})
const AuthenticationFailureState({required this.failure})
static const String logo
Definition assets.dart:9
static ScaffoldFeatureController< SnackBar, SnackBarClosedReason > display(final BuildContext context, final Color color, final String message,)
final CollectionsState state
final Widget child
override Widget build(BuildContext context)
const SignInScreen({super.key})
final EdgeInsets padding
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)