78 lines
3.5 KiB
Dart
78 lines
3.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:SEFER/constant/style.dart';
|
|
import 'package:SEFER/controller/notification/notification_captain_controller.dart';
|
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
|
import 'package:SEFER/views/widgets/mycircular.dart';
|
|
|
|
class NotificationCaptain extends StatelessWidget {
|
|
const NotificationCaptain({super.key});
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Get.put(NotificationCaptainController());
|
|
|
|
return MyScafolld(
|
|
title: 'Notifications'.tr,
|
|
body: [
|
|
GetBuilder<NotificationCaptainController>(
|
|
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,
|
|
child: ListTile(
|
|
onTap: () {
|
|
Get.defaultDialog(
|
|
title: res['title'],
|
|
titleStyle: AppStyle.title.copyWith(
|
|
fontWeight: FontWeight.bold),
|
|
content: SizedBox(
|
|
width: Get.width * .8,
|
|
height: Get.height * .4,
|
|
child: Text(
|
|
res['body'],
|
|
style: AppStyle.subtitle,
|
|
),
|
|
),
|
|
confirm: MyElevatedButton(
|
|
title: 'Ok',
|
|
onPressed: () {
|
|
//todo sql readen
|
|
notificationCaptainController
|
|
.updateNotification(res['id']);
|
|
}));
|
|
},
|
|
leading:
|
|
const Icon(Icons.notification_important),
|
|
title: Text(
|
|
res['title'],
|
|
style: AppStyle.title,
|
|
),
|
|
subtitle: Text(
|
|
res['body'],
|
|
style: AppStyle.subtitle,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
))
|
|
],
|
|
isleading: true,
|
|
);
|
|
}
|
|
}
|