12/14/1
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/links.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../functions/crud.dart';
|
||||
|
||||
class NotificationCaptainController extends GetxController {
|
||||
bool isloading = false;
|
||||
Map notificationData = {};
|
||||
|
||||
getNotifications() async {
|
||||
isloading = true;
|
||||
update();
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getNotificationCaptain,
|
||||
payload: {'driverID': box.read(BoxName.driverID)});
|
||||
if (res == "failure") {
|
||||
// print(res);
|
||||
Get.defaultDialog(
|
||||
title: 'There is no notification yet'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Back',
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
}
|
||||
notificationData = jsonDecode(res);
|
||||
// sql.insertData(notificationData['message'], TableName.captainNotification);
|
||||
|
||||
// print(notificationData);
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
updateNotification(String id) async {
|
||||
await CRUD().post(
|
||||
link: AppLink.updateNotificationCaptain,
|
||||
payload: {'isShown': true, 'id': id},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getNotifications();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,10 @@ import 'dart:math';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/views/auth/login_page.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../views/auth/verify_email_page.dart';
|
||||
|
||||
@@ -29,26 +31,27 @@ class RegisterController extends GetxController {
|
||||
|
||||
getBirthDate() {
|
||||
Get.defaultDialog(
|
||||
title: 'Select Date',
|
||||
content: SizedBox(
|
||||
width: 300,
|
||||
child: CalendarDatePicker(
|
||||
initialDate: DateTime.now().subtract(const Duration(days: 14 * 365)),
|
||||
firstDate: DateTime.parse('1940-06-01'),
|
||||
lastDate: DateTime.now().subtract(const Duration(days: 14 * 365)),
|
||||
onDateChanged: (date) {
|
||||
// Get the selected date and convert it to a DateTime object
|
||||
DateTime dateTime = date;
|
||||
// Call the getOrders() function from the controller
|
||||
birthDate = dateTime.toString().split(' ')[0];
|
||||
update();
|
||||
Get.back();
|
||||
},
|
||||
title: 'Select Date',
|
||||
titleStyle: AppStyle.title,
|
||||
content: SizedBox(
|
||||
width: 300,
|
||||
child: CalendarDatePicker(
|
||||
initialDate:
|
||||
DateTime.now().subtract(const Duration(days: 14 * 365)),
|
||||
firstDate: DateTime.parse('1940-06-01'),
|
||||
lastDate: DateTime.now().subtract(const Duration(days: 14 * 365)),
|
||||
onDateChanged: (date) {
|
||||
// Get the selected date and convert it to a DateTime object
|
||||
DateTime dateTime = date;
|
||||
// Call the getOrders() function from the controller
|
||||
birthDate = dateTime.toString().split(' ')[0];
|
||||
update();
|
||||
},
|
||||
|
||||
// onDateChanged: (DateTime value) {},
|
||||
// onDateChanged: (DateTime value) {},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
confirm: MyElevatedButton(title: 'Ok'.tr, onPressed: () => Get.back()));
|
||||
}
|
||||
|
||||
void changeGender(String value) {
|
||||
@@ -75,7 +78,7 @@ class RegisterController extends GetxController {
|
||||
'email': emailController.text.toString(),
|
||||
'phone': phoneController.text.toString(),
|
||||
'password': passwordController.text.toString(),
|
||||
'gender': gender,
|
||||
'gender': 'yet',
|
||||
'site': siteController.text,
|
||||
'birthdate': birthDate,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user