6/27/1
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/views/auth/sms_verfy_page.dart';
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -16,16 +13,10 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../constant/info.dart';
|
||||
import '../../constant/links.dart';
|
||||
import '../../controller/auth/apple_signin_controller.dart';
|
||||
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';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
final controller = Get.put(LoginController());
|
||||
@@ -88,53 +79,45 @@ class LoginPage extends StatelessWidget {
|
||||
kolor: AppColor.blueColor,
|
||||
),
|
||||
!Platform.isAndroid
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.apple,
|
||||
size: 30,
|
||||
? GestureDetector(
|
||||
onTap: () async {
|
||||
User? user =
|
||||
await authController.signInWithApple();
|
||||
if (user != null) {
|
||||
box.write(BoxName.passengerID, user.uid);
|
||||
box.write(BoxName.email, user.email);
|
||||
await GoogleSignInHelper
|
||||
.signInFromLogin();
|
||||
// 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),
|
||||
),
|
||||
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,
|
||||
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(),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user