10/26/1
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:SEFER/controller/auth/facebook_login.dart';
|
||||
import 'package:SEFER/views/auth/captin/contact_us_page.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -20,6 +21,7 @@ import '../../../controller/auth/google_sign.dart';
|
||||
import '../../../controller/functions/location_permission.dart';
|
||||
import '../../../controller/functions/overlay_permisssion.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../print.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import '../../widgets/my_scafold.dart';
|
||||
import '../../widgets/mycircular.dart';
|
||||
@@ -48,400 +50,332 @@ class LoginCaptin extends StatelessWidget {
|
||||
else
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(25),
|
||||
child:
|
||||
// Container(
|
||||
// decoration: const BoxDecoration(
|
||||
// boxShadow: [
|
||||
// BoxShadow(
|
||||
// offset: Offset(3, 3),
|
||||
// color: AppColor.accentColor,
|
||||
// blurRadius: 3)
|
||||
// ],
|
||||
// color: AppColor.secondaryColor,
|
||||
// ),
|
||||
// child: Form(
|
||||
// key: controller.formKey,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(16.0),
|
||||
// child: SingleChildScrollView(
|
||||
// child: Column(
|
||||
// children: [
|
||||
// TextFormField(
|
||||
// keyboardType: TextInputType.emailAddress,
|
||||
// controller: controller.emailController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// fillColor: AppColor.accentColor,
|
||||
// hoverColor: AppColor.accentColor,
|
||||
// focusColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Email'.tr,
|
||||
// hintText: 'Enter your email address'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// (!value.contains('@') ||
|
||||
// !value.contains('.'))) {
|
||||
// return 'Please enter Your Email.'.tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 30,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// keyboardType: TextInputType.phone,
|
||||
// cursorColor: AppColor.accentColor,
|
||||
// controller: controller.phoneController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// focusColor: AppColor.accentColor,
|
||||
// fillColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Phone'.tr,
|
||||
// hintText: 'Enter your phone number'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// value.length != 10) {
|
||||
// return 'Please enter your phone number.'
|
||||
// .tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 15,
|
||||
// ),
|
||||
// TextFormField(
|
||||
// obscureText: true,
|
||||
// keyboardType: TextInputType.emailAddress,
|
||||
// controller: controller.passwordController,
|
||||
// decoration: InputDecoration(
|
||||
// focusedBorder: OutlineInputBorder(
|
||||
// borderSide: const BorderSide(
|
||||
// color: AppColor.primaryColor,
|
||||
// width: 2.0,
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
// ),
|
||||
// fillColor: AppColor.accentColor,
|
||||
// hoverColor: AppColor.accentColor,
|
||||
// focusColor: AppColor.accentColor,
|
||||
// border: const OutlineInputBorder(
|
||||
// borderRadius: BorderRadius.all(
|
||||
// Radius.circular(12))),
|
||||
// labelText: 'Password'.tr,
|
||||
// hintText:
|
||||
// 'Please enter your phone number.'.tr,
|
||||
// ),
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty) {
|
||||
// return 'Please enter Your Password.'.tr;
|
||||
// }
|
||||
// if (value.length < 6) {
|
||||
// return 'Password must br at least 6 character.'
|
||||
// .tr;
|
||||
// }
|
||||
// return null;
|
||||
// },
|
||||
// ),
|
||||
// controller.isloading
|
||||
// ? const MyCircularProgressIndicator()
|
||||
// : MyElevatedButton(
|
||||
// onPressed: () {
|
||||
// if (controller.formKey.currentState!
|
||||
// .validate()) {
|
||||
// controller.login();
|
||||
// }
|
||||
// },
|
||||
// title: 'Submit'.tr,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
|
||||
Center(
|
||||
controller.isGoogleDashOpen
|
||||
? registerWitoutGoogle(controller)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(25),
|
||||
child: Center(
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: Get.height * .7,
|
||||
width: Get.width * .9,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/logo.gif',
|
||||
height: Get.width * .3,
|
||||
width: Get.width * .3,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
Platform.isIOS && controller.isTest == 0
|
||||
? Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
keyboardType: TextInputType
|
||||
.emailAddress,
|
||||
controller: controller
|
||||
.emailController,
|
||||
decoration: InputDecoration(
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
const BorderSide(
|
||||
color: AppColor
|
||||
.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(10),
|
||||
),
|
||||
fillColor:
|
||||
AppColor.accentColor,
|
||||
hoverColor:
|
||||
AppColor.accentColor,
|
||||
focusColor:
|
||||
AppColor.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: Get.height * .7,
|
||||
width: Get.width * .9,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/logo.gif',
|
||||
height: Get.width * .3,
|
||||
width: Get.width * .3,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
Platform.isIOS && controller.isTest == 0
|
||||
? Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.all(16.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
keyboardType:
|
||||
TextInputType
|
||||
.emailAddress,
|
||||
controller: controller
|
||||
.emailController,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
const BorderSide(
|
||||
color: AppColor
|
||||
.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
10),
|
||||
),
|
||||
fillColor: AppColor
|
||||
.accentColor,
|
||||
hoverColor: AppColor
|
||||
.accentColor,
|
||||
focusColor: AppColor
|
||||
.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius
|
||||
.all(Radius
|
||||
.circular(
|
||||
12))),
|
||||
labelText: 'Email'.tr,
|
||||
hintText:
|
||||
'Enter your email address'
|
||||
.tr,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
(!value.contains(
|
||||
'@') ||
|
||||
!value.contains(
|
||||
'.'))) {
|
||||
return 'Please enter Your Email.'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType
|
||||
.emailAddress,
|
||||
controller: controller
|
||||
.passwordController,
|
||||
decoration: InputDecoration(
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
const BorderSide(
|
||||
color: AppColor
|
||||
.primaryColor,
|
||||
width: 2.0,
|
||||
labelText: 'Email'.tr,
|
||||
hintText:
|
||||
'Enter your email address'
|
||||
.tr,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(10),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
(!value.contains(
|
||||
'@') ||
|
||||
!value.contains(
|
||||
'.'))) {
|
||||
return 'Please enter Your Email.'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
fillColor:
|
||||
AppColor.accentColor,
|
||||
hoverColor:
|
||||
AppColor.accentColor,
|
||||
focusColor:
|
||||
AppColor.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius:
|
||||
BorderRadius.all(
|
||||
Radius
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
TextFormField(
|
||||
obscureText: true,
|
||||
keyboardType:
|
||||
TextInputType
|
||||
.emailAddress,
|
||||
controller: controller
|
||||
.passwordController,
|
||||
decoration:
|
||||
InputDecoration(
|
||||
focusedBorder:
|
||||
OutlineInputBorder(
|
||||
borderSide:
|
||||
const BorderSide(
|
||||
color: AppColor
|
||||
.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
10),
|
||||
),
|
||||
fillColor: AppColor
|
||||
.accentColor,
|
||||
hoverColor: AppColor
|
||||
.accentColor,
|
||||
focusColor: AppColor
|
||||
.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius
|
||||
.all(Radius
|
||||
.circular(
|
||||
12))),
|
||||
labelText: 'Password'.tr,
|
||||
hintText:
|
||||
'Please enter your phone number.'
|
||||
.tr,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter Your Password.'
|
||||
.tr;
|
||||
}
|
||||
if (value.length < 6) {
|
||||
return 'Password must br at least 6 character.'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
labelText:
|
||||
'Password'.tr,
|
||||
hintText:
|
||||
'Please enter your phone number.'
|
||||
.tr,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter Your Password.'
|
||||
.tr;
|
||||
}
|
||||
if (value.length <
|
||||
6) {
|
||||
return 'Password must br at least 6 character.'
|
||||
.tr;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
GetBuilder<
|
||||
LoginDriverController>(
|
||||
builder: (controller) =>
|
||||
controller.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: MyElevatedButton(
|
||||
onPressed:
|
||||
() async {
|
||||
if (controller
|
||||
.formKey
|
||||
.currentState!
|
||||
.validate()) {
|
||||
await Get.find<LoginDriverController>()
|
||||
.loginUsingCredentials(
|
||||
controller
|
||||
.passwordController
|
||||
.text,
|
||||
controller
|
||||
.emailController
|
||||
.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
title:
|
||||
'Submit'
|
||||
.tr,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
GetBuilder<
|
||||
LoginDriverController>(
|
||||
builder: (controller) =>
|
||||
controller.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: MyElevatedButton(
|
||||
onPressed:
|
||||
() async {
|
||||
if (controller
|
||||
.formKey
|
||||
.currentState!
|
||||
.validate()) {
|
||||
await Get.find<
|
||||
LoginDriverController>()
|
||||
.loginUsingCredentials(
|
||||
controller
|
||||
.passwordController
|
||||
.text,
|
||||
controller
|
||||
.emailController
|
||||
.text,
|
||||
);
|
||||
}
|
||||
},
|
||||
title:
|
||||
'Submit'.tr,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: Get.height * .3,
|
||||
width: Get.width * .8,
|
||||
child: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'Sign in with Google for easier email and name entry'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'Or'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
controller
|
||||
.changeGoogleDashOpen();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets
|
||||
.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.blueColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.email,
|
||||
color: AppColor
|
||||
.yellowColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Create new Account'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight:
|
||||
FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await GoogleSignInHelper()
|
||||
.signInFromLogin();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.redColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
FontAwesome.google,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Sign In by Google'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
height: Get.height * .3,
|
||||
width: Get.width * .8,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Sign in with Google for easier email and name entry'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await GoogleSignInHelper().signInFromLogin();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.redColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
FontAwesome.google,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Sign In by Google'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
!Platform.isAndroid
|
||||
? GestureDetector(
|
||||
onTap: () async {
|
||||
User? user = await authController
|
||||
.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(
|
||||
BoxName.driverID, user.uid);
|
||||
box.write(BoxName.emailDriver,
|
||||
user.email);
|
||||
Get.find<LoginDriverController>()
|
||||
.loginUsingCredentials(
|
||||
box
|
||||
.read(BoxName.driverID)
|
||||
.toString(),
|
||||
box
|
||||
.read(BoxName.emailDriver)
|
||||
.toString(),
|
||||
);
|
||||
// Navigate to another screen or perform other actions
|
||||
} else {}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius:
|
||||
BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.apple,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Sign in with Apple'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
!Platform.isAndroid
|
||||
? GestureDetector(
|
||||
onTap: () async {
|
||||
User? user = await authController
|
||||
.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(BoxName.driverID, user.uid);
|
||||
box.write(
|
||||
BoxName.emailDriver, user.email);
|
||||
Get.find<LoginDriverController>()
|
||||
.loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box
|
||||
.read(BoxName.emailDriver)
|
||||
.toString(),
|
||||
);
|
||||
// Navigate to another screen or perform other actions
|
||||
} else {}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.apple,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Sign in with Apple'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
))),
|
||||
))),
|
||||
GestureDetector(
|
||||
onTap: () => Get.to(() => ContactUsPage()),
|
||||
child: Text(
|
||||
@@ -458,6 +392,156 @@ class LoginCaptin extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Column registerWitoutGoogle(LoginDriverController controller) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: TextFormField(
|
||||
obscureText: false, // Email should not be obscured
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: controller.emailController,
|
||||
decoration: InputDecoration(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
fillColor: AppColor.accentColor,
|
||||
hoverColor: AppColor.accentColor,
|
||||
focusColor: AppColor.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
labelText: 'Email'
|
||||
.tr, // English: Email / Arabic: البريد الإلكتروني
|
||||
hintText: 'Please enter your Email.'
|
||||
.tr, // English: Please enter your Email / Arabic: يرجى إدخال بريدك الإلكتروني
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your Email.'
|
||||
.tr; // English: Please enter your Email / Arabic: يرجى إدخال بريدك الإلكتروني
|
||||
}
|
||||
if (!value.contains('@')) {
|
||||
return 'Email must be correct.'
|
||||
.tr; // English: Email must be correct / Arabic: البريد الإلكتروني يجب أن يكون صحيحاً
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: TextFormField(
|
||||
obscureText: true, // Password should be obscured
|
||||
keyboardType: TextInputType.text,
|
||||
controller: controller.passwordController,
|
||||
decoration: InputDecoration(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
fillColor: AppColor.accentColor,
|
||||
hoverColor: AppColor.accentColor,
|
||||
focusColor: AppColor.accentColor,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
labelText: 'Password'
|
||||
.tr, // English: Password / Arabic: كلمة المرور
|
||||
hintText: 'Please enter your Password.'
|
||||
.tr, // English: Please enter your Password / Arabic: يرجى إدخال كلمة المرور
|
||||
),
|
||||
validator: (value) {
|
||||
if (value!.isEmpty) {
|
||||
return 'Please enter your Password.'
|
||||
.tr; // English: Please enter your Password / Arabic: يرجى إدخال كلمة المرور
|
||||
}
|
||||
if (value.length < 6) {
|
||||
return 'Password must be at least 6 characters.'
|
||||
.tr; // English: Password must be at least 6 characters / Arabic: يجب أن تكون كلمة المرور مكونة من 6 أحرف على الأقل
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
),
|
||||
controller.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: MyElevatedButton(
|
||||
onPressed: () {
|
||||
if (controller.formKey.currentState!.validate()) {
|
||||
String email = controller.emailController
|
||||
.text; // Assume you have this controller
|
||||
String uniqueId =
|
||||
controller.generateUniqueIdFromEmail(email);
|
||||
Log.print('Generated ID: $uniqueId');
|
||||
box.write(BoxName.driverID, uniqueId);
|
||||
box.write(BoxName.emailDriver,
|
||||
controller.emailController.text.toString());
|
||||
controller.loginUsingCredentialsWithoutGoogle(
|
||||
controller.passwordController.text.toString(),
|
||||
controller.emailController.text.toString(),
|
||||
);
|
||||
}
|
||||
},
|
||||
title: 'Next'.tr,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 200,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
await GoogleSignInHelper().signInFromLogin();
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.redColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
FontAwesome.google,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Sign In by Google'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Padding agreedPage() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
|
||||
Reference in New Issue
Block a user