Initial commit

This commit is contained in:
Hamza-Ayed
2024-10-12 19:19:26 +03:00
parent 2e3ce78fe8
commit aca697578d
41 changed files with 2976 additions and 1188 deletions

View File

@@ -1,10 +1,10 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import '../../controller/notification/passenger_notification_controller.dart';
import '../widgets/elevated_btn.dart';
import '../widgets/my_scafold.dart';
import '../widgets/mycircular.dart';
@@ -19,64 +19,82 @@ class NotificationPage extends StatelessWidget {
title: 'Notifications',
body: [
GetBuilder<PassengerNotificationController>(
builder: (notificationCaptainController) =>
notificationCaptainController.isloading
? const MyCircularProgressIndicator()
: SafeArea(
child: ListView.builder(
itemCount: notificationCaptainController
.notificationData['message'].length,
itemBuilder: (BuildContext context, int index) {
if (notificationCaptainController
.notificationData['message'] ==
"No notification data found") {
Get.defaultDialog();
}
var res = notificationCaptainController
.notificationData['message'][index];
return Card(
elevation: 4,
color: res['isShown'] == 'true'
? AppColor.secondaryColor.withOpacity(.5)
: AppColor.secondaryColor.withOpacity(.9),
child: ListTile(
onTap: () {
Get.defaultDialog(
title: res['title'],
titleStyle: AppStyle.title,
content: SizedBox(
width: Get.width * .8,
// height: Get.height * .4,
child: Text(
res['body'],
style: AppStyle.title,
),
),
confirm: MyElevatedButton(
title: 'Ok',
onPressed: () {
notificationCaptainController
.updateNotification(
res['id'].toString());
}));
},
leading: res['isShown'] == 'true'
? const Icon(
Icons.notifications_off_outlined)
: const Icon(Icons.notifications_active),
title: Text(
res['title'],
style: AppStyle.title,
),
subtitle: Text(
res['body'],
style: AppStyle.subtitle,
),
),
builder: (notificationCaptainController) => notificationCaptainController
.isloading
? const MyCircularProgressIndicator() // iOS-style loading indicator
: SafeArea(
child: ListView.builder(
itemCount: notificationCaptainController
.notificationData['message'].length,
itemBuilder: (BuildContext context, int index) {
if (notificationCaptainController
.notificationData['message'] ==
"No notification data found") {
Get.defaultDialog(
title: 'No Notifications'.tr,
content: Text(
'No notification data found.'.tr,
),
);
}
var res = notificationCaptainController
.notificationData['message'][index];
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8, vertical: 4),
child: CupertinoListTile(
backgroundColor: res['isShown'] == 'true'
? AppColor.secondaryColor.withOpacity(.2)
: AppColor.secondaryColor.withOpacity(.8),
leading: res['isShown'] == 'true'
? const Icon(CupertinoIcons.bell_slash_fill)
: const Icon(CupertinoIcons.bell_fill),
title: Text(
res['title'],
style: AppStyle.title.copyWith(
color: CupertinoColors.black,
),
),
subtitle: Text(
res['body'],
style: AppStyle.subtitle.copyWith(
color: CupertinoColors.systemGrey,
),
),
onTap: () {
showCupertinoDialog(
context: context,
builder: (BuildContext context) {
return CupertinoAlertDialog(
title: Text(
res['title'],
style: AppStyle.title,
),
content: Text(
res['body'],
style: AppStyle.subtitle,
),
actions: [
CupertinoDialogAction(
child: const Text('Ok'),
onPressed: () {
notificationCaptainController
.updateNotification(
res['id'].toString());
Get.back();
},
),
],
);
},
);
},
),
))
);
},
),
),
)
],
);
}