12/14/1
This commit is contained in:
@@ -3,35 +3,80 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.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',
|
||||
action: IconButton(
|
||||
onPressed: () async {
|
||||
print(box.read(BoxName.tokenFCM).toString());
|
||||
// await CRUD().post(link: AppLink.addTokens, payload: {
|
||||
// 'token': box.read(BoxName.tokenFCM).toString(),
|
||||
// 'passengerID': box.read(BoxName.pasengerID).toString()
|
||||
// }).then((value) => print('cccc'));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
color: AppColor.primaryColor,
|
||||
),
|
||||
),
|
||||
body: [
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user