Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
signin_form.dart
Go to the documentation of this file.
1// import 'package:flutter/gestures.dart';
2// import 'package:flutter/material.dart';
3// import 'package:flutter_bloc/flutter_bloc.dart';
4// import 'package:flutter_screenutil/flutter_screenutil.dart';
5
6// import '../../../../../../core/ui/theme/color_palette.dart';
7// import '../../../../../../core/ui/widgets/custom_text_form_field.dart';
8// import '../../../../domain/entities/signin_request_entity.dart';
9// import '../../../bloc/authentication_bloc/authentication_bloc.dart';
10
11// class SignInForm extends StatefulWidget {
12// const SignInForm({super.key});
13
14// @override
15// State<SignInForm> createState() => _SignInFormState();
16// }
17
18// class _SignInFormState extends State<SignInForm> {
19// final _formKey = GlobalKey<FormState>();
20// final TextEditingController _emailController = TextEditingController();
21// final TextEditingController _passwordController = TextEditingController();
22// bool isObscure = true;
23
24// void _onSignInButtonClicked() {
25// if (_formKey.currentState!.validate()) {
26// context.read<AuthenticationBloc>().add(
27// SignInEvent(
28// reqEntity: SignInRequestEntity(
29// email: _emailController.text.trim(),
30// password: _passwordController.text.trim(),
31// ),
32// ),
33// );
34// }
35// }
36
37// _onAuthenticateViaBiomtric(CredentialsLoadedState state) {
38// if (state.credentials != null) {
39// setState(() {
40// _emailController.text = state.credentials!.email ?? '';
41// _passwordController.text = state.credentials!.password ?? '';
42// });
43// _onSignInButtonClicked();
44// }
45// }
46
47// @override
48// Widget build(BuildContext context) {
49// return BlocListener<AuthenticationBloc, AuthenticationState>(
50// listenWhen: (previous, current) => current is CredentialsLoadedState,
51// listener: (context, state) {
52// if (state is CredentialsLoadedState) {
53// _onAuthenticateViaBiomtric(state);
54// }
55// },
56// child: Form(
57// key: _formKey,
58// child: Column(
59// crossAxisAlignment: CrossAxisAlignment.start,
60// children: [
61// Align(
62// alignment: Alignment.center,
63// child: Text(
64// 'Sign In',
65// style: Theme.of(context).textTheme.displayLarge,
66// ),
67// ),
68// SizedBox(height: 40.sp),
69// CustomTextFormField(
70// hintText: 'Email',
71// controller: _emailController,
72// validator: (value) {
73// if (value == null || value.isEmpty) {
74// return 'Email is required';
75// }
76// return null;
77// },
78// suffixIcon: const Icon(Icons.mail_outline),
79// ),
80// SizedBox(height: 29.sp),
81// CustomTextFormField(
82// hintText: 'Password',
83// controller: _passwordController,
84// validator: (value) {
85// if (value == null || value.isEmpty) {
86// return 'Password is required';
87// }
88// return null;
89// },
90// isObscure: isObscure,
91// suffixIcon: InkWell(
92// onTap: () {
93// setState(() {
94// isObscure = !isObscure;
95// });
96// },
97// child: Icon(
98// isObscure ? Icons.lock_outlined : Icons.lock_open_outlined,
99// ),
100// ),
101// ),
102// SizedBox(height: 25.sp),
103// _buildForgetPasswordLabel(),
104// SizedBox(height: 30.sp),
105// SizedBox(
106// width: MediaQuery.of(context).size.width,
107// child: ElevatedButton(
108// onPressed: _onSignInButtonClicked,
109// child: const Text('Log In'),
110// ),
111// ),
112// SizedBox(height: 30.sp),
113// _buildSignUpLabel(),
114// ],
115// ),
116// ),
117// );
118// }
119
120// _buildForgetPasswordLabel() {
121// return RichText(
122// text: TextSpan(
123// children: [
124// TextSpan(
125// text: 'Forgot password',
126// style: Theme.of(context).textTheme.bodySmall?.copyWith(
127// color: ColorPalette.blue,
128// decoration: TextDecoration.underline,
129// ),
130// recognizer: TapGestureRecognizer()..onTap = () {},
131// ),
132// ],
133// style: Theme.of(context).textTheme.bodySmall,
134// ),
135// );
136// }
137
138// _buildSignUpLabel() {
139// return Align(
140// alignment: Alignment.center,
141// child: RichText(
142// text: TextSpan(
143// children: [
144// TextSpan(
145// text: "Don’t have an account? ",
146// style: Theme.of(context).textTheme.bodySmall?.copyWith(
147// color: ColorPalette.grey,
148// ),
149// ),
150// TextSpan(
151// text: 'Sign Up',
152// style: Theme.of(context).textTheme.bodySmall?.copyWith(
153// color: ColorPalette.blue,
154// decoration: TextDecoration.underline,
155// ),
156// recognizer: TapGestureRecognizer()..onTap = () {},
157// ),
158// ],
159// style: Theme.of(context).textTheme.bodySmall,
160// ),
161// ),
162// );
163// }
164// }