Untitled
unknown
dart
4 years ago
76 kB
4
Indexable
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:iketfaa_delivery/App/Common/Services/translation_service.dart';
import 'package:iketfaa_delivery/App/Common/Utilities/Constants/AppColors.dart';
import 'package:iketfaa_delivery/App/Common/Widgets/primary_button.dart';
import 'package:iketfaa_delivery/App/Delivery/Modules/DeliveryUser/DeliveryDriver/DeliveryDriverRegistration/controller/delivery_registration_driver_controller.dart';
import 'package:iketfaa_delivery/App/Delivery/Utilities/Widgets/delivery_white_button.dart';
import 'package:iketfaa_delivery/App/Delivery/Utilities/Widgets/show_modal_list_item.dart';
import 'dart:math' as math;
class DeliveryRegistrationDriverView
extends GetView<DeliveryDriverRegistrationController> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColors.backgroundColor,
body: GestureDetector(
onTap: () {
controller.unFocusKeyboard(context);
},
child: SafeArea(
child: SingleChildScrollView(
child: Obx(
() => controller.registirationPage[controller.indexPage.value],
),
),
),
),
);
}
}
class RegistrationPage5 extends GetView<DeliveryDriverRegistrationController> {
RegistrationPage5({
Key? key,
}) : super(key: key);
final GlobalKey<FormState> registrationKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Column(
children: [
SizedBox(height: 30),
GreenAppBar(
index: 5,
title: 'Agreement'.tr,
),
SizedBox(height: 30),
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: AppColors.white,
boxShadow: [
BoxShadow(
color: AppColors.grey.withOpacity(0.4),
blurRadius: 7,
offset: Offset(0, 3),
spreadRadius: 0.3,
),
],
),
child: Column(
children: [
SizedBox(height: 15),
Text('agree&accept'.tr, style: Get.textTheme.headline5),
SizedBox(height: 15),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Obx(
() => Checkbox(
value: controller.checkValue.value,
activeColor: AppColors.primary,
onChanged: (value) {
controller.checkValue.value = value ?? false;
},
),
),
SizedBox(height: 5),
Flexible(
child: Text(
'agreementParagraph'.tr,
style: Get.textTheme.headline6,
overflow: TextOverflow.fade,
),
),
],
),
SizedBox(height: 30),
PrimaryButton(
text: 'Send request',
function: () async {
if (!controller.checkValue.value) {
return controller.commonTools
.showFailedSnackBar('pleaseAcceptConditions'.tr);
} else {
await controller.addDriverToDatabase(context);
}
},
width: Get.width * 0.7,
padding: 14.0,
),
],
),
),
],
);
}
}
class RegistrationPage4 extends GetView<DeliveryDriverRegistrationController> {
RegistrationPage4({
Key? key,
}) : super(key: key);
final GlobalKey<FormState> registrationKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Column(
children: [
SizedBox(height: 30),
GreenAppBar(
index: 4,
title: 'Your documents'.tr,
),
SizedBox(height: 30),
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: AppColors.white,
boxShadow: [
BoxShadow(
color: AppColors.grey.withOpacity(0.4),
blurRadius: 7,
offset: Offset(0, 3),
spreadRadius: 0.3,
),
],
),
child: Column(
children: [
PhotoWidgetGetter(
title: 'acopyoftheNationalID'.tr,
onTap: () {
controller.loadImagesAssets(1);
},
index: 1,
),
PhotoWidgetGetter(
title: 'acopyofthedrivinglicense'.tr,
onTap: () {
controller.loadImagesAssets(2);
},
index: 2,
),
PhotoWidgetGetter(
title: 'clearfrontimageforthevehicle'.tr,
onTap: () {
controller.loadImagesAssets(3);
},
index: 3,
),
PhotoWidgetGetter(
title: 'clearrearimageforthevehicle'.tr,
onTap: () {
controller.loadImagesAssets(4);
},
index: 4,
),
PhotoWidgetGetter(
title: 'acopyofthecarlicense'.tr,
onTap: () {
controller.loadImagesAssets(5);
},
index: 5,
),
SizedBox(height: 30),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SmallButton(
onTap: () {
if (controller.checkIfFilesNotSelected()) {
return controller.commonTools
.showFailedSnackBar('pleaseSelectAllImages'.tr);
} else {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value += 1;
}
}
},
title: 'next'.tr,
border: true,
color: AppColors.white,
fontColor: AppColors.black,
),
SmallButton(
onTap: () {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value -= 1;
}
},
title: 'back'.tr,
color: AppColors.grey,
),
],
),
],
),
),
],
);
}
}
class RegistrationPage3 extends GetView<DeliveryDriverRegistrationController> {
final GlobalKey<FormState> registrationKey = new GlobalKey<FormState>();
RegistrationPage3({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Obx(
() => Form(
key: registrationKey,
child: Column(
children: [
SizedBox(height: 30),
GreenAppBar(
index: 3,
title: 'Your accommodation information'.tr,
),
SizedBox(height: 30),
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: AppColors.white,
boxShadow: [
BoxShadow(
color: AppColors.grey.withOpacity(0.4),
blurRadius: 7,
offset: Offset(0, 3),
spreadRadius: 0.3,
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'district'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 10.0,
),
DeliveryWhiteButton(
onTap: () {
chooseDistrectlBottomSheet(context);
},
title: controller.districtValue.value,
),
SizedBox(height: 25.0),
Text(
'city'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 10.0,
),
DeliveryWhiteButton(
onTap: () {
if (controller.currentDistrict != null) {
chooseCityModalBottomSheet(context);
} else {
controller.commonTools
.showFailedSnackBar('chooseDistrict'.tr);
}
},
title: controller.cityValue.value),
SizedBox(height: 25.0),
CustomizedTextField(
textFieldController:
controller.neighborhoodController.value,
hint: 'enterNeighborhood'.tr,
title: 'neighborhood'.tr,
textInputType: TextInputType.text,
validator: (value) => controller.commonTools
.neighborhoodValidate(
value, controller.neighborhoodController.value),
),
SizedBox(height: 25),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SmallButton(
onTap: () {
controller.unFocusKeyboard(context);
if (controller.currentDistrict == null)
return controller.commonTools
.showFailedSnackBar('chooseDistrict'.tr);
if (controller.currentCity == null)
return controller.commonTools
.showFailedSnackBar('chooseCity'.tr);
if (registrationKey.currentState!.validate()) {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value += 1;
}
}
},
title: 'next'.tr,
border: true,
color: AppColors.white,
fontColor: AppColors.black,
),
SmallButton(
onTap: () {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value -= 1;
}
},
title: 'back'.tr,
color: AppColors.grey,
),
],
),
],
),
)
],
),
),
);
}
void chooseDistrectlBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseDistrict'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: controller.deliveryHubController
.dashboardController.regions.value.districts!.length,
itemBuilder: (context, index) {
return ShowModalListItem(
title: TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.regions
.value
.districts![index]
.districtAR
.toString()
: controller
.deliveryHubController
.dashboardController
.regions
.value
.districts![index]
.districtEN
.toString(),
onTap: () {
controller.districtValue.value =
TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.regions
.value
.districts![index]
.districtAR
.toString()
: controller
.deliveryHubController
.dashboardController
.regions
.value
.districts![index]
.districtEN
.toString();
controller.currentDistrict = controller
.deliveryHubController
.dashboardController
.regions
.value
.districts![index];
Navigator.pop(context);
},
);
},
),
)
],
),
),
);
},
);
}
void chooseCityModalBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseCity'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: controller.currentDistrict!.cities!.length,
itemBuilder: (context, index) {
return ShowModalListItem(
title: TranslationService().isLocaleArabic()
? controller
.currentDistrict!.cities![index].cityAR
.toString()
: controller
.currentDistrict!.cities![index].cityEN
.toString(),
onTap: () {
controller.cityValue.value =
TranslationService().isLocaleArabic()
? controller
.currentDistrict!.cities![index].cityAR
.toString()
: controller
.currentDistrict!.cities![index].cityEN
.toString();
controller.currentCity =
controller.currentDistrict!.cities![index];
Navigator.pop(context);
},
);
}),
)
],
),
),
);
},
);
}
}
class RegistrationPage2 extends GetView<DeliveryDriverRegistrationController> {
RegistrationPage2({Key? key}) : super(key: key);
final GlobalKey<FormState> registrationKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Obx(
() => Form(
key: registrationKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 30),
GreenAppBar(
index: 2,
title: 'Your vehicle information'.tr,
),
SizedBox(height: 30),
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: AppColors.white,
boxShadow: [
BoxShadow(
color: AppColors.grey.withOpacity(0.4),
blurRadius: 7,
offset: Offset(0, 3),
spreadRadius: 0.3,
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'carType'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 10.0,
),
DeliveryWhiteButton(
onTap: () {
chooseCarTypeModalBottomSheet(context);
},
title: controller.carTypeValue.value,
),
SizedBox(height: 25.0),
Text(
'carModel'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 10.0,
),
DeliveryWhiteButton(
onTap: () {
if (controller.currentCarType != null) {
chooseCarModelModalBottomSheet(context);
} else {
controller.commonTools
.showFailedSnackBar('chooseCarType'.tr);
}
},
title: controller.carModelValue.value,
),
SizedBox(height: 25.0),
Text(
'manufacturingyear'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 10.0,
),
DeliveryWhiteButton(
onTap: () {
chooseManfacturingDateBottomSheet(context);
},
title: controller.currentCarManfacturingYear.value,
),
SizedBox(height: 25),
Text(
'vehicleplateletter&numbers'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 15.0,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: TextFormField(
inputFormatters: [
LengthLimitingTextInputFormatter(3),
],
focusNode: controller.textFirstFocusNode,
readOnly: controller.readOnlyTextFieldLetter.value,
validator: (value) => controller.commonTools
.plateLetterCarValidate(value,
controller.plateLetterController.value),
onChanged: (value) {
if (value.length == 3) {
FocusScope.of(context)
.requestFocus(controller.textSecondFocusNode);
}
},
textAlign: TextAlign.center,
controller: controller.plateLetterController.value,
style: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.8),
fontWeight: FontWeight.w600,
),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(
left: 2.0, right: 2.0, top: 2),
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleLetterPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.grey, width: 1.0),
),
focusedBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleLetterPlateBorderRadius,
borderSide: const BorderSide(
color: AppColors.primary, width: 1.0),
),
errorBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleLetterPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.red, width: 1.0),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleLetterPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.red, width: 1.0),
),
filled: true,
fillColor: AppColors.white,
hintText: 'plateletter'.tr,
hintStyle: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.8),
fontWeight: FontWeight.w600,
),
),
),
),
Flexible(
child: TextFormField(
inputFormatters: [
LengthLimitingTextInputFormatter(4),
],
focusNode: controller.textSecondFocusNode,
validator: (value) => controller.commonTools
.plateNumberCarValidate(value,
controller.plateNumberController.value),
onChanged: (value) {
if (value.length == 0) {
FocusScope.of(context)
.requestFocus(controller.textFirstFocusNode);
}
},
textAlign: TextAlign.center,
controller: controller.plateNumberController.value,
style: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.8),
fontWeight: FontWeight.w600,
),
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(
left: 2.0, right: 2.0, top: 2),
border: OutlineInputBorder(),
enabledBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleNumberPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.grey, width: 1.0),
),
focusedBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleNumberPlateBorderRadius,
borderSide: const BorderSide(
color: AppColors.primary, width: 1.0),
),
errorBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleNumberPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.red, width: 1.0),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: controller
.textFieldVehicleNumberPlateBorderRadius,
borderSide: const BorderSide(
color: Colors.red, width: 1.0),
),
filled: true,
fillColor: AppColors.white,
hintText: 'platenumber'.tr,
hintStyle: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.8),
fontWeight: FontWeight.w600,
),
),
),
),
],
),
SizedBox(height: 25.0),
Text(
'carclass'.tr,
style: Get.textTheme.headline4,
),
SizedBox(
height: 15.0,
),
DeliveryWhiteButton(
onTap: () {
chooseCarClassBottomSheet(context);
},
title: controller.currentCarClassValue.value),
SizedBox(height: 25),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SmallButton(
onTap: () {
controller.unFocusKeyboard(context);
if (controller.currentCarType == null)
return controller.commonTools
.showFailedSnackBar('chooseCarType'.tr);
if (controller.currentCarModels == null)
return controller.commonTools
.showFailedSnackBar('chooseCarModel'.tr);
if (controller.currentCarManfacturingYear ==
'select'.tr)
return controller.commonTools.showFailedSnackBar(
'chooseCarManfacturingYear'.tr);
if (controller.currentCarClass == null)
return controller.commonTools
.showFailedSnackBar('chooseCarClass'.tr);
if (registrationKey.currentState!.validate()) {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value += 1;
}
}
},
title: 'next'.tr,
border: true,
fontColor: AppColors.black,
color: AppColors.white,
),
SmallButton(
onTap: () {
if (controller.indexPage.value >= 0 &&
controller.indexPage.value <
controller.registirationPage.length) {
controller.indexPage.value -= 1;
}
},
title: 'back'.tr,
color: AppColors.grey,
),
],
),
],
),
),
],
),
),
);
}
void chooseCarTypeModalBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseCarType'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: controller.deliveryHubController
.dashboardController.cars.value.carTypes!.length,
itemBuilder: (context, index) {
return ShowModalListItem(
title: TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.cars
.value
.carTypes![index]
.typeAR
.toString()
: controller
.deliveryHubController
.dashboardController
.cars
.value
.carTypes![index]
.typeEN
.toString(),
onTap: () {
controller.carTypeValue.value =
TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.cars
.value
.carTypes![index]
.typeAR
.toString()
: controller
.deliveryHubController
.dashboardController
.cars
.value
.carTypes![index]
.typeEN
.toString();
controller.currentCarType = controller
.deliveryHubController
.dashboardController
.cars
.value
.carTypes![index];
//controller.carModel = 'select'.obs;
Navigator.pop(context);
},
);
},
),
)
],
),
),
);
},
);
}
void chooseCarModelModalBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseCarModel'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: controller.currentCarType!.carModels!.length,
itemBuilder: (context, index) {
return ShowModalListItem(
title: TranslationService().isLocaleArabic()
? controller
.currentCarType!.carModels![index].modelAR
.toString()
: controller
.currentCarType!.carModels![index].modelEN
.toString(),
onTap: () {
controller.carModelValue.value =
TranslationService().isLocaleArabic()
? controller.currentCarType!
.carModels![index].modelAR
.toString()
: controller.currentCarType!
.carModels![index].modelEN
.toString();
controller.currentCarModels =
controller.currentCarType!.carModels![index];
Navigator.pop(context);
},
);
}),
)
],
),
),
);
},
);
}
void chooseManfacturingDateBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseCarManfacturingYear'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView(
physics: BouncingScrollPhysics(),
shrinkWrap: true,
children: controller.manfacturingCars
.map((e) => ShowModalListItem(
onTap: () {
controller.currentCarManfacturingYear.value =
e.toString();
Navigator.pop(context);
},
title: e,
))
.toList(),
),
)
],
),
),
);
},
);
}
void chooseCarClassBottomSheet(context) {
showModalBottomSheet(
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
decoration: BoxDecoration(
//color: Colors.transparent,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Container(
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Wrap(
children: <Widget>[
Container(height: 10),
Center(
child: Text(
'chooseCarClass'.tr,
style: Get.textTheme.headline5,
),
),
Container(height: 10),
Container(
height: Get.width * 0.8,
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses!
.length,
itemBuilder: (context, index) {
return ShowModalListItem(
onTap: () {
controller.currentCarClass = controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses![index];
controller.currentCarClassValue.value =
TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses![index]
.classAR
.toString()
: controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses![index]
.classEN
.toString();
Navigator.pop(context);
},
title: TranslationService().isLocaleArabic()
? controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses![index]
.classAR
.toString()
: controller
.deliveryHubController
.dashboardController
.carClasses
.value
.carClasses![index]
.classEN
.toString(),
);
}),
)
],
),
),
);
},
);
}
}
class RegistrationPage1 extends GetView<DeliveryDriverRegistrationController> {
RegistrationPage1({Key? key}) : super(key: key);
final GlobalKey<FormState> registrationKey = new GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Obx(
() => Form(
key: registrationKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 30),
GreenAppBar(
index: 1,
title: 'Your personal information'.tr,
),
SizedBox(height: 30),
Container(
margin: EdgeInsets.symmetric(horizontal: 15),
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(15)),
color: AppColors.white,
boxShadow: [
BoxShadow(
color: AppColors.grey.withOpacity(0.4),
blurRadius: 7,
offset: Offset(0, 3),
spreadRadius: 0.3)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomizedTextField(
textFieldController: controller.fullNameController.value,
hint: 'enteryourfullname'.tr,
title: 'fullname'.tr,
subtitle: '(MustmatchyournameinID)'.tr,
textInputType: TextInputType.text,
validator: (value) => controller.commonTools.nameValidate(
value, controller.fullNameController.value),
),
SizedBox(height: 15),
CustomizedTextField(
textFieldController: controller.iDNumberController.value,
hint: 'enteryourIDnumber'.tr,
title: 'nationalIDnumber'.tr,
textInputType: TextInputType.number,
validator: (value) => controller.commonTools
.idNumberValidate(
value, controller.iDNumberController.value),
maxLength: 10,
),
SizedBox(height: 15),
Text(
'dateofbirth'.tr,
style: Get.textTheme.headline5,
),
DeliveryRegistrationButton(
onTap: () {
chooseDateOfBirth(context);
},
title: controller.currentBirthDate.value,
),
SizedBox(height: 15),
CustomizedTextField(
textFieldController: controller.emailController.value,
hint: 'enteryourEmailAdrees'.tr,
title: 'emailAdrees'.tr,
textInputType: TextInputType.emailAddress,
validator: (value) => controller.commonTools
.emailValidate(value, controller.emailController.value),
),
SizedBox(height: 15),
Text(
'iDexpirydate'.tr,
style: Get.textTheme.headline5,
),
DeliveryRegistrationButton(
onTap: () {
chooseExpiryDateOfId(context);
},
title: controller.currentExpiryDate.value,
),
SizedBox(height: 15),
SizedBox(height: 15),
Text('profilepicture'.tr, style: Get.textTheme.headline5),
SizedBox(height: 5),
Text('(Musthaveawhitebackground&withoutanyfilter)'.tr,
style: Get.textTheme.headline6),
SizedBox(height: 10),
Visibility(
visible: controller.driverPersonalImage.value.path != (''),
child: Container(
height: Get.width * 0.43,
width: Get.width * 0.86,
margin: EdgeInsets.only(bottom: 30.0),
child: Center(
child: Container(
height: Get.width * 0.38,
width: Get.width * 0.4,
child: Obx(
() => Container(
margin: EdgeInsets.only(right: 10.0),
child: Stack(
children: [
Container(
alignment: Alignment.center,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Container(
child: Image.file(
controller.driverPersonalImage.value,
),
),
),
),
Positioned.fill(
child: Container(
height: Get.width * 0.38,
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.2),
borderRadius: BorderRadius.circular(
15.0,
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomRight,
child: InkWell(
onTap: () async {
controller.driverPersonalImage.value =
File('');
},
child: Container(
width: 40,
height: 40,
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(5.0),
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 40,
child: Icon(
Icons.delete,
color: AppColors.white,
),
),
),
),
),
),
],
),
),
),
),
),
),
),
Visibility(
visible: controller.driverPersonalImage.value.path == '',
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: Get.width * 0.3,
height: Get.width * 0.12,
decoration: BoxDecoration(
color: AppColors.primary,
borderRadius: BorderRadius.circular(30),
),
child: Material(
color: AppColors.primary,
borderRadius: BorderRadius.circular(30),
child: InkWell(
borderRadius: BorderRadius.circular(30),
onTap: () => controller.loadImagesAssets(0),
child: Center(
child: Text(
'select'.tr,
style: Get.textTheme.headline4!.copyWith(
color: AppColors.white,
),
),
),
),
),
),
],
),
),
SizedBox(height: 20),
CustomizedTextField(
textFieldController:
controller.mobileNumberController.value,
hint: 'yourmobilenumber'.tr,
title: 'mobileNubmber'.tr,
textInputType: TextInputType.number,
validator: (value) => controller.commonTools
.phoneNumberValidate(
value, controller.mobileNumberController.value),
codeKey: Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
'+966 | ',
style: Get.textTheme.headline6,
),
),
maxLength: 10,
),
SizedBox(height: 20),
SmallButton(
onTap: () {
controller.unFocusKeyboard(context);
if (!registrationKey.currentState!.validate()) {
return;
}
if (controller.currentBirthDate.value == 'select'.tr) {
controller.commonTools
.showFailedSnackBar('enterBirthDate');
return;
}
if (controller.currentExpiryDate.value == 'select'.tr) {
controller.commonTools
.showFailedSnackBar('enterExpireDate');
return;
}
if (controller.driverPersonalImage.value.path == '') {
controller.commonTools
.showFailedSnackBar('choosePersonalImage');
return;
}
if (controller.indexPage.value >= 0) {
controller.indexPage.value += 1;
}
},
title: 'next'.tr,
border: true,
color: AppColors.white,
fontColor: AppColors.black,
),
SizedBox(height: 20),
],
),
),
],
),
),
);
}
void chooseDateOfBirth(context) {
showModalBottomSheet(
isScrollControlled: true,
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: Get.width,
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Center(
child: Text(
'choose Date of birth'.tr,
style: Get.textTheme.headline4,
),
),
),
Container(
color: AppColors.white,
height: Get.width * 0.5,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: DateTime.now(),
maximumYear: 2022,
minimumYear: 1950,
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (datetime) {
controller.selectedDateOfBirth = datetime;
}),
),
Container(
color: AppColors.white,
width: Get.width,
child: Container(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
print('s');
controller.dateOfBirthDay.value =
controller.selectedDateOfBirth.day;
controller.dateOfBirthMonth.value =
controller.selectedDateOfBirth.month;
controller.dateOfBirthYear.value =
controller.selectedDateOfBirth.year;
controller.currentBirthDate.value =
'${controller.dateOfBirthDay.value}/${controller.dateOfBirthMonth.value}/${controller.dateOfBirthYear.value}';
Navigator.pop(context);
},
child: Container(
padding: EdgeInsets.all(30.0),
child: Center(
child: Text(
'ok'.tr,
style: Get.textTheme.headline5,
),
),
),
),
),
),
),
],
),
);
});
}
void chooseExpiryDateOfId(context) {
showModalBottomSheet(
isScrollControlled: true,
elevation: 5,
backgroundColor: AppColors.white.withOpacity(0),
context: context,
builder: (BuildContext bc) {
return Container(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(15),
topRight: Radius.circular(15),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Container(
width: Get.width,
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: AppColors.white,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0),
),
),
child: Center(
child: Text(
'choose Expire Date'.tr,
style: Get.textTheme.headline4,
),
),
),
Container(
color: AppColors.white,
height: Get.width * 0.5,
child: CupertinoDatePicker(
dateOrder: DatePickerDateOrder.dmy,
initialDateTime: DateTime.now(),
maximumYear: 2050,
minimumYear: 2020,
mode: CupertinoDatePickerMode.date,
onDateTimeChanged: (datetime) {
controller.selectedExpiryDateOfID = datetime;
}),
),
Container(
color: AppColors.white,
width: Get.width,
child: Container(
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
controller.expiryDay.value =
controller.selectedExpiryDateOfID.day;
controller.expiryMonth.value =
controller.selectedExpiryDateOfID.month;
controller.expiryYear.value =
controller.selectedExpiryDateOfID.year;
controller.currentExpiryDate.value =
'${controller.expiryDay.value}/${controller.expiryMonth.value}/${controller.expiryYear.value}';
Navigator.pop(context);
},
child: Container(
padding: EdgeInsets.all(30.0),
child: Center(
child: Text(
'ok'.tr,
style: Get.textTheme.headline5,
),
),
),
),
),
),
),
],
),
);
});
}
}
class PhotoWidgetGetter extends GetView<DeliveryDriverRegistrationController> {
final String title;
final VoidCallback onTap;
final int index;
final File? image;
const PhotoWidgetGetter(
{Key? key,
required this.title,
required this.onTap,
required this.index,
this.image})
: super(key: key);
@override
Widget build(BuildContext context) {
return Obx(
() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
width: Get.width,
),
Text(
title.tr,
style: Get.textTheme.headline5,
),
SizedBox(height: 10),
Container(
color: controller.getCorrectFileByIndex(index)!.path.isEmpty
? AppColors.grey.withOpacity(0.3)
: AppColors.white,
width: Get.width * 0.7,
height: Get.width * 0.55,
child: controller.getCorrectFileByIndex(index)!.path.isEmpty
? Center(
child: Icon(
Icons.photo,
color: AppColors.grey,
size: 35,
),
)
: Obx(
() => Container(
margin: EdgeInsets.only(right: 10.0),
child: Stack(
children: [
Container(
alignment: Alignment.center,
child: ClipRRect(
borderRadius: BorderRadius.circular(15.0),
child: Container(
child: Image.file(
controller.getCorrectFileByIndex(index)!,
),
),
),
),
Positioned.fill(
child: Align(
alignment: Alignment.bottomCenter,
child: InkWell(
onTap: () async {
controller.deleteFileByIndex(index);
},
child: Container(
width: 40,
height: 40,
margin: EdgeInsets.all(5.0),
padding: EdgeInsets.all(5.0),
child: CircleAvatar(
backgroundColor: Colors.red,
radius: 40,
child: Icon(
Icons.delete,
color: AppColors.white,
),
),
),
),
),
),
],
),
),
),
),
SizedBox(height: 10),
Visibility(
visible: controller.getCorrectFileByIndex(index)!.path.isEmpty,
child: SmallButton(
onTap: onTap,
title: 'select'.tr,
border: false,
),
),
SizedBox(
height: 20.0,
),
],
),
);
}
}
class GreenAppBar extends GetView<DeliveryDriverRegistrationController> {
final int index;
final String title;
const GreenAppBar({
Key? key,
required this.index,
required this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
height: Get.width * 0.18,
child: Stack(
children: [
Positioned(
bottom: 0,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25),
bottomRight: Radius.circular(25),
topRight: Radius.circular(25),
),
gradient: LinearGradient(
colors: [
AppColors.primary.withOpacity(0.9),
AppColors.primaryDark,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
margin: EdgeInsets.only(left: 20, right: 10),
height: Get.width * 0.16,
width: Get.width * 0.92,
child: Center(
child: Text(
title,
style:
Get.textTheme.headline5!.copyWith(color: AppColors.white),
),
),
),
),
Positioned(
top: 0,
right: 0,
child: InkWell(
onTap: () {
if (controller.indexPage.value == 0) {
Get.back();
}
if (controller.indexPage.value > 0) {
controller.indexPage.value -= 1;
}
},
child: Container(
margin: EdgeInsets.only(left: 5, right: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(12),
bottomRight: Radius.circular(12),
topRight: Radius.circular(12),
),
color: AppColors.lightGreen,
boxShadow: [
BoxShadow(color: AppColors.grey.withOpacity(0.7))
]),
width: Get.width * 0.17,
height: Get.width * 0.13,
child: Material(
color: Colors.transparent,
child: Center(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(width: 5),
Transform.rotate(
angle: TranslationService().isLocaleArabic()
? (180 * math.pi / 180)
: 0,
child: Icon(
Icons.arrow_back_ios_new_rounded,
size: 17,
),
),
SizedBox(width: 5),
Text(
'$index/5',
style: Get.textTheme.headline6,
),
],
),
),
),
),
),
),
],
),
);
}
}
class SmallButton extends StatelessWidget {
final VoidCallback onTap;
final Color? color;
final String title;
final bool? border;
final Color? fontColor;
const SmallButton({
Key? key,
this.color,
required this.onTap,
required this.title,
this.border,
this.fontColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: Get.width * 0.3,
height: Get.width * 0.13,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: (border == true)
? Border.all(color: AppColors.primary.withOpacity(0.8))
: Border.all(color: AppColors.grey.withOpacity(0.0)),
),
child: Material(
borderRadius: BorderRadius.circular(25),
color: (color != null) ? color : AppColors.primary,
child: InkWell(
borderRadius: BorderRadius.circular(25),
onTap: onTap,
child: Center(
child: Text(
title.tr,
style: Get.textTheme.headline5!.copyWith(
color: (fontColor == null) ? AppColors.white : fontColor),
),
),
),
),
);
}
}
class DeliveryRegistrationButton extends StatelessWidget {
final VoidCallback onTap;
final String title;
const DeliveryRegistrationButton({
Key? key,
required this.onTap,
required this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 7),
width: Get.width * 0.8,
height: Get.width * 0.13,
decoration: BoxDecoration(
border: Border.all(width: 0.8, color: AppColors.grey),
borderRadius: BorderRadius.circular(25),
),
child: Material(
borderRadius: BorderRadius.circular(25),
color: AppColors.backgroundColor,
child: InkWell(
borderRadius: BorderRadius.circular(25),
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title.tr,
style: Get.textTheme.headline6!.copyWith(fontSize: 13),
),
Icon(Icons.arrow_drop_down)
],
),
),
),
),
);
}
}
// ignore: must_be_immutable
class CustomizedTextField extends StatelessWidget {
CustomizedTextField(
{Key? key,
required this.textFieldController,
required this.title,
required this.hint,
required this.textInputType,
this.subtitle,
this.validator,
this.codeKey,
this.maxLength,
this.leading})
: super(key: key);
TextEditingController textFieldController = TextEditingController();
String title;
String hint;
String? subtitle;
TextInputType textInputType;
Widget? codeKey;
int? maxLength;
Widget? leading;
final FormFieldValidator<String?>? validator;
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
leading ?? SizedBox(),
leading == null
? SizedBox()
: SizedBox(
width: 10.0,
),
Text(
title.tr,
style: Get.textTheme.headline5,
),
SizedBox(
width: 10.0,
),
Text(
(subtitle != null) ? subtitle!.tr : '',
style: Get.textTheme.headline6,
)
],
),
SizedBox(
height: 10.0,
),
TextFormField(
inputFormatters: [
LengthLimitingTextInputFormatter(maxLength ?? 100),
],
controller: textFieldController,
validator: validator,
keyboardType: textInputType,
maxLines: 1,
textAlign: TextAlign.start,
style: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.8),
fontWeight: FontWeight.w600,
),
decoration: InputDecoration(
contentPadding: EdgeInsets.only(top: 5, left: 15, right: 15),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(35.0),
),
enabledBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 0.9),
borderRadius: BorderRadius.circular(35.0),
),
focusedBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(35.0),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(35.0),
),
filled: true,
fillColor: AppColors.white,
hintText: hint.tr,
hintStyle: Get.textTheme.headline6!.copyWith(
color: AppColors.grey.withOpacity(0.4),
fontWeight: FontWeight.w400,
),
prefixIcon: codeKey,
),
),
],
);
}
}
Editor is loading...