6/25/1
This commit is contained in:
@@ -22,6 +22,7 @@ import '../../controller/auth/google_sign.dart';
|
||||
import '../../controller/auth/login_controller.dart';
|
||||
import '../../controller/firebase/firbase_messge.dart';
|
||||
import '../../controller/functions/crud.dart';
|
||||
import '../../controller/functions/toast.dart';
|
||||
import '../home/profile/passenger_profile_page.dart';
|
||||
import '../widgets/mycircular.dart';
|
||||
import 'register_page.dart';
|
||||
@@ -52,143 +53,6 @@ class LoginPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
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;
|
||||
// },
|
||||
// ),
|
||||
// GetBuilder<LoginController>(
|
||||
// builder: (controller) => controller
|
||||
// .isloading
|
||||
// ? const MyCircularProgressIndicator()
|
||||
// : MyElevatedButton(
|
||||
// onPressed: () {
|
||||
// if (controller
|
||||
// .formKey.currentState!
|
||||
// .validate()) {
|
||||
// controller.login();
|
||||
// }
|
||||
// },
|
||||
// title: 'Submit'.tr,
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// )),
|
||||
Center(
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
@@ -224,21 +88,53 @@ class LoginPage extends StatelessWidget {
|
||||
kolor: AppColor.blueColor,
|
||||
),
|
||||
!Platform.isAndroid
|
||||
? MyElevatedButton(
|
||||
title: 'Sign In by Apple'.tr,
|
||||
onPressed: () async {
|
||||
User? user =
|
||||
await authController.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(BoxName.driverID, user.uid);
|
||||
box.write(
|
||||
BoxName.emailDriver, user.email);
|
||||
await GoogleSignInHelper
|
||||
.signInFromLogin();
|
||||
// Navigate to another screen or perform other actions
|
||||
} else {}
|
||||
},
|
||||
kolor: AppColor.primaryColor,
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.apple,
|
||||
size: 30,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 8), // Adjust spacing as needed
|
||||
MyElevatedButton(
|
||||
title: 'Sign in with Apple'.tr,
|
||||
onPressed: () async {
|
||||
try {
|
||||
User? user = await authController
|
||||
.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(
|
||||
BoxName.driverID, user.uid);
|
||||
box.write(BoxName.emailDriver,
|
||||
user.email);
|
||||
|
||||
// Provide user feedback
|
||||
await GoogleSignInHelper
|
||||
.signInFromLogin();
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed('/home');
|
||||
Toast.show(
|
||||
context,
|
||||
'Signed in successfully',
|
||||
AppColor.greenColor);
|
||||
} else {
|
||||
Toast.show(
|
||||
context,
|
||||
'Sign in failed. Please try again.',
|
||||
AppColor.yellowColor);
|
||||
}
|
||||
} catch (error) {
|
||||
print('Sign in error: $error');
|
||||
Toast.show(
|
||||
context,
|
||||
'An error occurred. Please check your connection and try again.',
|
||||
AppColor.redColor);
|
||||
}
|
||||
},
|
||||
kolor: Colors.black,
|
||||
),
|
||||
],
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
@@ -392,7 +288,7 @@ class LoginPage extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Grant Location'.tr,
|
||||
title: 'Next'.tr,
|
||||
onPressed: () async {
|
||||
await controller.getLocationPermission();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user