Initial commit
This commit is contained in:
252
lib/app/auth_screen/login_screen.dart
Normal file
252
lib/app/auth_screen/login_screen.dart
Normal file
@@ -0,0 +1,252 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:driver/app/auth_screen/phone_number_screen.dart';
|
||||
import 'package:driver/app/auth_screen/signup_screen.dart';
|
||||
import 'package:driver/app/forgot_password_screen/forgot_password_screen.dart';
|
||||
import 'package:driver/constant/show_toast_dialog.dart';
|
||||
import 'package:driver/controllers/login_controller.dart';
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:driver/themes/round_button_fill.dart';
|
||||
import 'package:driver/themes/text_field_widget.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LoginScreen extends StatelessWidget {
|
||||
const LoginScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: LoginController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Log In to Your Account".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 22, fontFamily: AppThemeData.semiBold),
|
||||
),
|
||||
Text(
|
||||
"Sign in to access your eMart account and manage your deliveries seamlessly.".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontFamily: AppThemeData.regular),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: "Didn’t Have an account?".tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.to(const SignupScreen());
|
||||
},
|
||||
text: 'Sign up'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 32,
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Email Address'.tr,
|
||||
controller: controller.emailEditingController.value,
|
||||
hintText: 'Enter email address'.tr,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_mail.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Password'.tr,
|
||||
controller: controller.passwordEditingController.value,
|
||||
hintText: 'Enter password'.tr,
|
||||
obscureText: controller.passwordVisible.value,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_lock.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
suffix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
controller.passwordVisible.value = !controller.passwordVisible.value;
|
||||
},
|
||||
child: controller.passwordVisible.value
|
||||
? SvgPicture.asset(
|
||||
"assets/icons/ic_password_show.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
"assets/icons/ic_password_close.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)),
|
||||
),
|
||||
textInputAction: TextInputAction.done,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.to(const ForgotPasswordScreen());
|
||||
},
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
"Forgot Password".tr,
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300,
|
||||
color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.medium),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: Platform.isAndroid ? 10 : 30, horizontal: 16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
RoundedButtonFill(
|
||||
title: "Continue with Mobile Number".tr,
|
||||
textColor: isDark ? AppThemeData.grey100 : AppThemeData.grey900,
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey100,
|
||||
icon: SvgPicture.asset(
|
||||
"assets/icons/ic_phone.svg",
|
||||
colorFilter: const ColorFilter.mode(AppThemeData.grey900, BlendMode.srcIn),
|
||||
),
|
||||
isRight: false,
|
||||
onPress: () async {
|
||||
Get.to(const PhoneNumberScreen());
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RoundedButtonFill(
|
||||
title: "with Google".tr,
|
||||
textColor: isDark ? AppThemeData.grey100 : AppThemeData.grey900,
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey100,
|
||||
icon: SvgPicture.asset("assets/icons/ic_google.svg"),
|
||||
isRight: false,
|
||||
onPress: () async {
|
||||
controller.loginWithGoogle();
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Platform.isIOS
|
||||
? Expanded(
|
||||
child: RoundedButtonFill(
|
||||
title: "with Apple".tr,
|
||||
textColor: isDark ? AppThemeData.grey100 : AppThemeData.grey900,
|
||||
color: isDark ? AppThemeData.grey900 : AppThemeData.grey100,
|
||||
icon: SvgPicture.asset("assets/icons/ic_apple.svg"),
|
||||
isRight: false,
|
||||
onPress: () async {
|
||||
controller.loginWithApple();
|
||||
},
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (controller.emailEditingController.value.text.trim().isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter valid email".tr);
|
||||
} else if (controller.passwordEditingController.value.text.trim().isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter valid password".tr);
|
||||
} else {
|
||||
controller.loginWithEmailAndPassword();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: AppThemeData.primary300,
|
||||
width: Responsive.width(100, context),
|
||||
height: Responsive.width(16, context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Text(
|
||||
"Log in".tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey50,
|
||||
fontSize: 16,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
271
lib/app/auth_screen/otp_screen.dart
Normal file
271
lib/app/auth_screen/otp_screen.dart
Normal file
@@ -0,0 +1,271 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:driver/app/auth_screen/login_screen.dart';
|
||||
import 'package:driver/app/auth_screen/signup_screen.dart';
|
||||
import 'package:driver/app/cab_screen/cab_dashboard_screen.dart';
|
||||
import 'package:driver/app/dash_board_screen/dash_board_screen.dart';
|
||||
import 'package:driver/app/owner_screen/owner_dashboard_screen.dart';
|
||||
import 'package:driver/app/parcel_screen/parcel_dashboard_screen.dart';
|
||||
import 'package:driver/app/rental_service/rental_dashboard_screen.dart';
|
||||
import 'package:driver/constant/constant.dart';
|
||||
import 'package:driver/constant/show_toast_dialog.dart';
|
||||
import 'package:driver/controllers/otp_controller.dart';
|
||||
import 'package:driver/models/user_model.dart';
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:driver/utils/fire_store_utils.dart';
|
||||
import 'package:driver/utils/notification_service.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||
|
||||
class OtpScreen extends StatelessWidget {
|
||||
const OtpScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX<OtpController>(
|
||||
init: OtpController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
),
|
||||
body: controller.isLoading.value
|
||||
? Constant.loader()
|
||||
: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Verify Your Mobile Number".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 22, fontFamily: AppThemeData.semiBold),
|
||||
),
|
||||
Text(
|
||||
"Enter the OTP sent to your mobile number to verify and secure your account.".tr,
|
||||
textAlign: TextAlign.start,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey200 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 60,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: PinCodeTextField(
|
||||
length: 6,
|
||||
appContext: context,
|
||||
keyboardType: TextInputType.phone,
|
||||
enablePinAutofill: true,
|
||||
hintCharacter: "-",
|
||||
hintStyle: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.regular),
|
||||
textStyle: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.regular),
|
||||
pinTheme: PinTheme(
|
||||
fieldHeight: 50,
|
||||
fieldWidth: 50,
|
||||
inactiveFillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
selectedFillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
activeFillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
selectedColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
activeColor: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
inactiveColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
disabledColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
shape: PinCodeFieldShape.box,
|
||||
errorBorderColor: isDark ? AppThemeData.grey600 : AppThemeData.grey300,
|
||||
borderRadius: BorderRadius.all(Radius.circular(10))),
|
||||
cursorColor: AppThemeData.primary300,
|
||||
enableActiveFill: true,
|
||||
controller: controller.otpController.value,
|
||||
onCompleted: (v) async {},
|
||||
onChanged: (value) {},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Center(
|
||||
child: Text.rich(
|
||||
textAlign: TextAlign.center,
|
||||
TextSpan(
|
||||
text: "${'Did’t receive any code? '.tr} ",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.medium,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800,
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
controller.otpController.value.clear();
|
||||
controller.sendOTP();
|
||||
},
|
||||
text: 'Send Again'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.primary300 : AppThemeData.primary300,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 14,
|
||||
fontFamily: AppThemeData.medium,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: Platform.isAndroid ? 10 : 30),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Already Have an account?'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.offAll(const LoginScreen());
|
||||
},
|
||||
text: 'Log in'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
if (controller.otpController.value.text.length == 6) {
|
||||
ShowToastDialog.showLoader("Verify otp".tr);
|
||||
|
||||
PhoneAuthCredential credential = PhoneAuthProvider.credential(verificationId: controller.verificationId.value, smsCode: controller.otpController.value.text);
|
||||
String fcmToken = await NotificationService.getToken();
|
||||
await FirebaseAuth.instance.signInWithCredential(credential).then((value) async {
|
||||
if (value.additionalUserInfo!.isNewUser) {
|
||||
UserModel userModel = UserModel();
|
||||
userModel.id = value.user!.uid;
|
||||
userModel.countryCode = controller.countryCode.value;
|
||||
userModel.phoneNumber = controller.phoneNumber.value;
|
||||
userModel.fcmToken = fcmToken;
|
||||
userModel.provider = 'phone';
|
||||
|
||||
ShowToastDialog.closeLoader();
|
||||
Get.off(const SignupScreen(), arguments: {
|
||||
"userModel": userModel,
|
||||
"type": "mobileNumber",
|
||||
});
|
||||
} else {
|
||||
await FireStoreUtils.userExistOrNot(value.user!.uid).then((userExit) async {
|
||||
ShowToastDialog.closeLoader();
|
||||
if (userExit == true) {
|
||||
UserModel? userModel = await FireStoreUtils.getUserProfile(value.user!.uid);
|
||||
if (userModel!.role == Constant.userRoleDriver) {
|
||||
if (userModel.active == true) {
|
||||
userModel.fcmToken = await NotificationService.getToken();
|
||||
await FireStoreUtils.updateUser(userModel);
|
||||
if (userModel.isOwner == true) {
|
||||
Get.offAll(OwnerDashboardScreen());
|
||||
} else {
|
||||
if (userModel.serviceType == "delivery-service") {
|
||||
Get.offAll(const DashBoardScreen());
|
||||
} else if (userModel.serviceType == "cab-service") {
|
||||
Get.offAll(const CabDashboardScreen());
|
||||
} else if (userModel.serviceType == "parcel_delivery") {
|
||||
Get.offAll(const ParcelDashboardScreen());
|
||||
} else if (userModel.serviceType == "rental-service") {
|
||||
Get.offAll(const RentalDashboardScreen());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("This user is disable please contact to administrator".tr);
|
||||
await FirebaseAuth.instance.signOut();
|
||||
Get.offAll(const LoginScreen());
|
||||
}
|
||||
} else {
|
||||
await FirebaseAuth.instance.signOut();
|
||||
Get.offAll(const LoginScreen());
|
||||
ShowToastDialog.showToast("Account already created in other application. You are not able login this application.".tr);
|
||||
}
|
||||
} else {
|
||||
UserModel userModel = UserModel();
|
||||
userModel.id = value.user!.uid;
|
||||
userModel.countryCode = controller.countryCode.value;
|
||||
userModel.phoneNumber = controller.phoneNumber.value;
|
||||
userModel.fcmToken = fcmToken;
|
||||
userModel.provider = 'phone';
|
||||
|
||||
Get.off(const SignupScreen(), arguments: {
|
||||
"userModel": userModel,
|
||||
"type": "mobileNumber",
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Invalid Code".tr);
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Enter Valid otp".tr);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: AppThemeData.primary300,
|
||||
width: Responsive.width(100, context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Text(
|
||||
"Send Code".tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey50,
|
||||
fontSize: 16,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
177
lib/app/auth_screen/phone_number_screen.dart
Normal file
177
lib/app/auth_screen/phone_number_screen.dart
Normal file
@@ -0,0 +1,177 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:driver/app/auth_screen/login_screen.dart';
|
||||
import 'package:driver/app/auth_screen/signup_screen.dart';
|
||||
import 'package:driver/constant/show_toast_dialog.dart';
|
||||
import 'package:driver/controllers/phone_number_controller.dart';
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:driver/themes/text_field_widget.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/constant.dart';
|
||||
|
||||
class PhoneNumberScreen extends StatelessWidget {
|
||||
const PhoneNumberScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: PhoneNumberController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Log In Using Your Mobile Number".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 22, fontFamily: AppThemeData.semiBold),
|
||||
),
|
||||
Text(
|
||||
"Enter your mobile number to quickly access your account and start managing your deliveries.".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontFamily: AppThemeData.regular),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Didn’t Have an account?'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.to(const SignupScreen());
|
||||
},
|
||||
text: 'Sign up'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 32,
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Phone Number'.tr,
|
||||
controller: controller.phoneNUmberEditingController.value,
|
||||
hintText: 'Enter Phone Number'.tr,
|
||||
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
textInputAction: TextInputAction.done,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
],
|
||||
prefix: CountryCodePicker(
|
||||
onChanged: (value) {
|
||||
controller.countryCodeEditingController.value.text = value.dialCode ?? Constant.defaultCountryCode;
|
||||
},
|
||||
dialogTextStyle: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontWeight: FontWeight.w500, fontFamily: AppThemeData.medium),
|
||||
dialogBackgroundColor: isDark ? AppThemeData.grey800 : AppThemeData.grey100,
|
||||
initialSelection: controller.countryCodeEditingController.value.text,
|
||||
comparator: (a, b) => b.name!.compareTo(a.name.toString()),
|
||||
textStyle: TextStyle(fontSize: 14, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium),
|
||||
searchDecoration: InputDecoration(iconColor: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
searchStyle: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontWeight: FontWeight.w500, fontFamily: AppThemeData.medium),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: Platform.isAndroid ? 10 : 30),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Log in with'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.offAll(const LoginScreen());
|
||||
},
|
||||
text: 'E-mail'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (controller.phoneNUmberEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter mobile number".tr);
|
||||
} else {
|
||||
controller.sendCode();
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: AppThemeData.primary300,
|
||||
width: Responsive.width(100, context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Text(
|
||||
"Send Code".tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey50,
|
||||
fontSize: 16,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
811
lib/app/auth_screen/signup_screen.dart
Normal file
811
lib/app/auth_screen/signup_screen.dart
Normal file
@@ -0,0 +1,811 @@
|
||||
import 'package:country_code_picker/country_code_picker.dart';
|
||||
import 'package:driver/app/auth_screen/login_screen.dart';
|
||||
import 'package:driver/app/auth_screen/phone_number_screen.dart';
|
||||
import 'package:driver/constant/show_toast_dialog.dart';
|
||||
import 'package:driver/controllers/signup_controller.dart';
|
||||
import 'package:driver/models/car_makes.dart';
|
||||
import 'package:driver/models/car_model.dart';
|
||||
import 'package:driver/models/section_model.dart';
|
||||
import 'package:driver/models/vehicle_type.dart';
|
||||
import 'package:driver/models/zone_model.dart';
|
||||
import 'package:driver/themes/app_them_data.dart';
|
||||
import 'package:driver/themes/responsive.dart';
|
||||
import 'package:driver/themes/text_field_widget.dart';
|
||||
import 'package:driver/themes/theme_controller.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/constant.dart';
|
||||
|
||||
class SignupScreen extends StatelessWidget {
|
||||
const SignupScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
final isDark = themeController.isDark.value;
|
||||
return GetX(
|
||||
init: SignupController(),
|
||||
builder: (controller) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Create an Account".tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontSize: 22, fontFamily: AppThemeData.semiBold),
|
||||
),
|
||||
Text(
|
||||
"Sign up now to start your journey as a eMart driver and begin earning with every delivery.".tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.grey50 : AppThemeData.grey500, fontFamily: AppThemeData.regular),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Already Have an account?'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(child: SizedBox(width: 5)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.offAll(const LoginScreen());
|
||||
},
|
||||
text: 'Log in'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Service".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold, fontSize: 14, color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
DropdownButtonFormField<String>(
|
||||
hint: Text(
|
||||
'Service Type'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular),
|
||||
),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400, width: 1.2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Colors.red),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
),
|
||||
initialValue: controller.selectedService.value.isEmpty ? null : controller.selectedService.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedService.value = value!;
|
||||
if (value != "Delivery Service") {
|
||||
controller.getSection();
|
||||
}
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium),
|
||||
items: controller.service.map((item) {
|
||||
return DropdownMenuItem<String>(value: item, child: Text(item.toString()));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
controller.selectedService.value == "Delivery Service"
|
||||
? SizedBox()
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Continue as a.'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppThemeData.mediumTextStyle(
|
||||
fontSize: 14, color: isDark ? AppThemeData.greyDark700 : AppThemeData.grey700),
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: RadioListTile<String>(
|
||||
title: Text(
|
||||
'Individual'.tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.greyDark700 : AppThemeData.grey700),
|
||||
),
|
||||
value: 'Individual',
|
||||
groupValue: controller.selectedValue.value,
|
||||
activeColor: AppThemeData.primary300,
|
||||
onChanged: (value) {
|
||||
controller.selectedValue.value = value!;
|
||||
},
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: RadioListTile<String>(
|
||||
title: Text('Company'.tr,
|
||||
style: TextStyle(color: isDark ? AppThemeData.greyDark700 : AppThemeData.grey700)),
|
||||
value: 'Company',
|
||||
groupValue: controller.selectedValue.value,
|
||||
activeColor: AppThemeData.primary300,
|
||||
onChanged: (value) {
|
||||
controller.selectedValue.value = value!;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
controller.selectedValue.value == "Company"
|
||||
? SizedBox()
|
||||
: controller.selectedService.value == "Cab Service" ||
|
||||
controller.selectedService.value == "Rental Service" ||
|
||||
controller.selectedService.value == "Parcel Service"
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Select section".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
DropdownButtonFormField<SectionModel>(
|
||||
hint: Text(
|
||||
'Select Section'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular),
|
||||
),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400, width: 1.2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Colors.red),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
),
|
||||
initialValue: controller.selectedSection.value.id == null ? null : controller.selectedSection.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedSection.value = value!;
|
||||
controller.getVehicleType();
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium),
|
||||
items: controller.sectionList.map((item) {
|
||||
return DropdownMenuItem<SectionModel>(value: item, child: Text(item.name.toString()));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
controller.selectedService.value == "Cab Service" || controller.selectedService.value == "Rental Service"
|
||||
? Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Select Vehicle Type".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
DropdownButtonFormField<VehicleType>(
|
||||
hint: Text(
|
||||
'Vehicle Type'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular),
|
||||
),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400, width: 1.2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Colors.red),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
),
|
||||
initialValue: controller.selectedVehicleType.value.id == null
|
||||
? null
|
||||
: controller.selectedVehicleType.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedVehicleType.value = value!;
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium),
|
||||
items: controller.cabVehicleType.map((item) {
|
||||
return DropdownMenuItem<VehicleType>(value: item, child: Text(item.name.toString()));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Select Car Brand".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
DropdownButtonFormField<CarMakes>(
|
||||
hint: Text(
|
||||
'Car Brand'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular),
|
||||
),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400, width: 1.2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Colors.red),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
),
|
||||
initialValue:
|
||||
controller.selectedCarMakes.value.id == null ? null : controller.selectedCarMakes.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedCarMakes.value = value!;
|
||||
controller.getCarModel();
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium),
|
||||
items: controller.carMakesList.map((item) {
|
||||
return DropdownMenuItem<CarMakes>(value: item, child: Text(item.name.toString()));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Select car model".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
DropdownButtonFormField<CarModel>(
|
||||
hint: Text(
|
||||
'Car model'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular),
|
||||
),
|
||||
icon: const Icon(Icons.keyboard_arrow_down),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(
|
||||
color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400, width: 1.2),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: const BorderSide(color: Colors.red),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400),
|
||||
),
|
||||
),
|
||||
initialValue:
|
||||
controller.selectedCarModel.value.id == null ? null : controller.selectedCarModel.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedCarModel.value = value!;
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium),
|
||||
items: controller.carModelList.map((item) {
|
||||
return DropdownMenuItem<CarModel>(value: item, child: Text(item.name.toString()));
|
||||
}).toList(),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextFieldWidget(
|
||||
title: 'Car Plat Number'.tr,
|
||||
controller: controller.carPlatNumberEditingController.value,
|
||||
hintText: 'Enter Car Plat Number'.tr,
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
],
|
||||
)
|
||||
: SizedBox()
|
||||
],
|
||||
)
|
||||
: SizedBox(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldWidget(
|
||||
title: 'First Name'.tr,
|
||||
controller: controller.firstNameEditingController.value,
|
||||
hintText: 'Enter First Name'.tr,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_user.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TextFieldWidget(
|
||||
title: 'Last Name'.tr,
|
||||
controller: controller.lastNameEditingController.value,
|
||||
hintText: 'Enter Last Name'.tr,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_user.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Email Address'.tr,
|
||||
textInputType: TextInputType.emailAddress,
|
||||
controller: controller.emailEditingController.value,
|
||||
hintText: 'Enter Email Address'.tr,
|
||||
enable: controller.type.value == "google" || controller.type.value == "apple" ? false : true,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_mail.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Phone Number'.tr,
|
||||
controller: controller.phoneNUmberEditingController.value,
|
||||
hintText: 'Enter Phone Number'.tr,
|
||||
enable: controller.type.value == "mobileNumber" ? false : true,
|
||||
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||
textInputAction: TextInputAction.done,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
|
||||
],
|
||||
prefix: CountryCodePicker(
|
||||
enabled: controller.type.value == "mobileNumber" ? false : true,
|
||||
onChanged: (value) {
|
||||
controller.countryCodeEditingController.value.text = value.dialCode ?? Constant.defaultCountryCode;
|
||||
},
|
||||
dialogTextStyle: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: AppThemeData.medium),
|
||||
dialogBackgroundColor: isDark ? AppThemeData.grey800 : AppThemeData.grey100,
|
||||
initialSelection: controller.countryCodeEditingController.value.text,
|
||||
comparator: (a, b) => b.name!.compareTo(a.name.toString()),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14, color: isDark ? AppThemeData.grey50 : AppThemeData.grey900, fontFamily: AppThemeData.medium),
|
||||
searchDecoration: InputDecoration(iconColor: isDark ? AppThemeData.grey50 : AppThemeData.grey900),
|
||||
searchStyle: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: AppThemeData.medium),
|
||||
),
|
||||
),
|
||||
controller.selectedValue.value == "Company"
|
||||
? SizedBox()
|
||||
: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("Zone".tr,
|
||||
style: TextStyle(
|
||||
fontFamily: AppThemeData.semiBold,
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey100 : AppThemeData.grey800)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
DropdownButtonFormField<ZoneModel>(
|
||||
hint: Text(
|
||||
'Select zone'.tr,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey700 : AppThemeData.grey700,
|
||||
fontFamily: AppThemeData.regular,
|
||||
),
|
||||
),
|
||||
dropdownColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
decoration: InputDecoration(
|
||||
errorStyle: const TextStyle(color: Colors.red),
|
||||
isDense: true,
|
||||
filled: true,
|
||||
fillColor: isDark ? AppThemeData.grey900 : AppThemeData.grey50,
|
||||
disabledBorder: UnderlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, width: 1),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.primary300 : AppThemeData.primary300, width: 1),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, width: 1),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, width: 1),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(color: isDark ? AppThemeData.grey900 : AppThemeData.grey50, width: 1),
|
||||
),
|
||||
),
|
||||
initialValue: controller.selectedZone.value.id == null ? null : controller.selectedZone.value,
|
||||
onChanged: (value) {
|
||||
controller.selectedZone.value = value!;
|
||||
controller.update();
|
||||
},
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium),
|
||||
items: controller.zoneList.map((item) {
|
||||
return DropdownMenuItem<ZoneModel>(
|
||||
value: item,
|
||||
child: Text(item.name.toString()),
|
||||
);
|
||||
}).toList()),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
controller.type.value == "google" || controller.type.value == "apple" || controller.type.value == "mobileNumber"
|
||||
? const SizedBox()
|
||||
: Column(
|
||||
children: [
|
||||
TextFieldWidget(
|
||||
title: 'Password'.tr,
|
||||
controller: controller.passwordEditingController.value,
|
||||
hintText: 'Enter Password'.tr,
|
||||
obscureText: controller.passwordVisible.value,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_lock.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
suffix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
controller.passwordVisible.value = !controller.passwordVisible.value;
|
||||
},
|
||||
child: controller.passwordVisible.value
|
||||
? SvgPicture.asset(
|
||||
"assets/icons/ic_password_show.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
"assets/icons/ic_password_close.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
TextFieldWidget(
|
||||
title: 'Confirm Password'.tr,
|
||||
controller: controller.conformPasswordEditingController.value,
|
||||
hintText: 'Enter Confirm Password'.tr,
|
||||
obscureText: controller.conformPasswordVisible.value,
|
||||
prefix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: SvgPicture.asset(
|
||||
"assets/icons/ic_lock.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
suffix: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
controller.conformPasswordVisible.value = !controller.conformPasswordVisible.value;
|
||||
},
|
||||
child: controller.conformPasswordVisible.value
|
||||
? SvgPicture.asset(
|
||||
"assets/icons/ic_password_show.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)
|
||||
: SvgPicture.asset(
|
||||
"assets/icons/ic_password_close.svg",
|
||||
colorFilter: ColorFilter.mode(
|
||||
isDark ? AppThemeData.grey300 : AppThemeData.grey600,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
)),
|
||||
),
|
||||
textInputAction: TextInputAction.next,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomNavigationBar: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: 'Log in with'.tr,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey900,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
)),
|
||||
const WidgetSpan(
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
TextSpan(
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
Get.to(const PhoneNumberScreen());
|
||||
},
|
||||
text: 'Mobile Number'.tr,
|
||||
style: TextStyle(
|
||||
color: AppThemeData.primary300,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w500,
|
||||
decoration: TextDecoration.underline,
|
||||
decorationColor: AppThemeData.primary300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (controller.type.value == "google" || controller.type.value == "apple" || controller.type.value == "mobileNumber") {
|
||||
if (controller.firstNameEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter first name".tr);
|
||||
} else if (controller.lastNameEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter last name".tr);
|
||||
} else if (controller.emailEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter valid email".tr);
|
||||
} else if (controller.phoneNUmberEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter Phone number".tr);
|
||||
} else if (controller.selectedZone.value.id == null) {
|
||||
ShowToastDialog.showToast("Please select zone".tr);
|
||||
} else {
|
||||
controller.signUpWithEmailAndPassword();
|
||||
}
|
||||
} else {
|
||||
if (controller.firstNameEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter first name".tr);
|
||||
} else if (controller.lastNameEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter last name".tr);
|
||||
} else if (controller.emailEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter valid email".tr);
|
||||
} else if (controller.phoneNUmberEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter Phone number".tr);
|
||||
} else if (controller.passwordEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter password");
|
||||
} else if (controller.conformPasswordEditingController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter Confirm password".tr);
|
||||
} else if (controller.passwordEditingController.value.text !=
|
||||
controller.conformPasswordEditingController.value.text) {
|
||||
ShowToastDialog.showToast("Password and Confirm password doesn't match".tr);
|
||||
} else if (controller.selectedValue.value == "Individual" && controller.selectedZone.value.id == null) {
|
||||
ShowToastDialog.showToast("Please select zone".tr);
|
||||
} else {
|
||||
controller.signUpWithEmailAndPassword();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
color: AppThemeData.primary300,
|
||||
width: Responsive.width(100, context),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
child: Text(
|
||||
"Sign up".tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isDark ? AppThemeData.grey50 : AppThemeData.grey50,
|
||||
fontSize: 16,
|
||||
fontFamily: AppThemeData.medium,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user