84 lines
3.8 KiB
Dart
Executable File
84 lines
3.8 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:sefer_driver/constant/colors.dart';
|
|
import 'package:sefer_driver/constant/style.dart';
|
|
|
|
import '../../controller/notification/passenger_notification_controller.dart';
|
|
import '../widgets/elevated_btn.dart';
|
|
import '../widgets/my_scafold.dart';
|
|
import '../widgets/mycircular.dart';
|
|
|
|
class NotificationPage extends StatelessWidget {
|
|
const NotificationPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(PassengerNotificationController());
|
|
return MyScafolld(
|
|
isleading: true,
|
|
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,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
))
|
|
],
|
|
);
|
|
}
|
|
}
|