This commit is contained in:
Hamza-Ayed
2024-05-29 16:09:37 +03:00
parent 058fb67a41
commit 4af52f4392
44 changed files with 9509 additions and 2044 deletions

View File

@@ -1,3 +1,6 @@
import 'dart:io';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
@@ -7,9 +10,9 @@ import '../../../constant/box_name.dart';
import '../../../constant/colors.dart';
import '../../../constant/info.dart';
import '../../../constant/style.dart';
import '../../../controller/auth/apple_sigin.dart';
import '../../../controller/auth/captin/login_captin_controller.dart';
import '../../../controller/auth/google_sign.dart';
import '../../../controller/functions/location_background_controller.dart';
import '../../../main.dart';
import '../../widgets/elevated_btn.dart';
import '../../widgets/my_scafold.dart';
@@ -19,7 +22,7 @@ class LoginCaptin extends StatelessWidget {
// final controller = Get.put(LoginCaptinController());
LoginCaptin({super.key});
final AuthController authController = Get.put(AuthController());
@override
Widget build(BuildContext context) {
Get.put(LoginCaptinController());
@@ -177,7 +180,7 @@ class LoginCaptin extends StatelessWidget {
Center(
child: Container(
decoration: AppStyle.boxDecoration1,
height: Get.height * .6,
height: Get.height * .7,
width: Get.width * .9,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -208,6 +211,35 @@ class LoginCaptin extends StatelessWidget {
},
kolor: AppColor.redColor,
),
!Platform.isAndroid
? MyElevatedButton(
title: 'Sign In by Apple'.tr,
onPressed: () async {
User? user = await authController
.signInWithApple();
if (user != null) {
print(
"Successfully signed in: ${user.email}");
print(
"Successfully signed in: ${user.uid}");
box.write(BoxName.driverID, user.uid);
box.write(
BoxName.emailDriver, user.email);
Get.find<LoginCaptinController>()
.loginFromSignInGoogle(
box.read(BoxName.driverID).toString(),
box
.read(BoxName.emailDriver)
.toString(),
);
// Navigate to another screen or perform other actions
} else {
print("Sign-in failed");
}
},
kolor: AppColor.primaryColor,
)
: const SizedBox(),
// MyElevatedButton(
// title: 'Sign In by Google'.tr,
// onPressed: () async {
@@ -297,7 +329,7 @@ class LoginCaptin extends StatelessWidget {
RichText(
text: TextSpan(
text:
'By selecting "I Agree" below, I have reviewed and agree to the Terms of Use and acknowledge the '
"By selecting 'I Agree' below, I have reviewed and agree to the Terms of Use and acknowledge the "
.tr,
style: AppStyle.title,
children: <TextSpan>[
@@ -318,8 +350,8 @@ class LoginCaptin extends StatelessWidget {
),
));
}),
const TextSpan(
text: '. I am at least 18 years of age.',
TextSpan(
text: '. I am at least 18 years of age.'.tr,
),
],
),