fist commit ftc staff app clone
This commit is contained in:
1
lib/view/screens/notifications/export_notifications.dart
Normal file
1
lib/view/screens/notifications/export_notifications.dart
Normal file
@@ -0,0 +1 @@
|
||||
export 'notifications_list_screen.dart';
|
||||
239
lib/view/screens/notifications/notifications_list_screen.dart
Normal file
239
lib/view/screens/notifications/notifications_list_screen.dart
Normal file
@@ -0,0 +1,239 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_app_badger/flutter_app_badger.dart';
|
||||
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class NotificationListScreen extends StatefulWidget {
|
||||
const NotificationListScreen({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<NotificationListScreen> createState() => _NotificationListScreenState();
|
||||
}
|
||||
|
||||
class _NotificationListScreenState extends State<NotificationListScreen> {
|
||||
final controller = Get.put(NotificationListScreenController());
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
try {
|
||||
FlutterAppBadger.removeBadge();
|
||||
} catch (e) {
|
||||
debugPrint(e.toString());
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScaffold(
|
||||
backgroundColor: CustomAppColors.kPrimaryColor,
|
||||
screenKey: controller.screenKey,
|
||||
onScreenTap: controller.removeFocus,
|
||||
// sideDrawer: const CustomDrawer(),
|
||||
showAppBar: true,
|
||||
appBar: CustomAppBarTitleOnly(context, titleText: 'Notifications'),
|
||||
body: Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 25.w),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(totalNotifications: "4"),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
NotificationListItemWidget(),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(),
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
NotificationListItemWidget(totalNotifications: "8"),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(),
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
NotificationListItemWidget(),
|
||||
SizedBox(
|
||||
height: 4.h,
|
||||
),
|
||||
const DateTextWidget(),
|
||||
NotificationListItemWidget(),
|
||||
SizedBox(height: 8.h),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
class DateTextWidget extends StatelessWidget {
|
||||
const DateTextWidget({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5.h),
|
||||
child: CustomTextWidget(
|
||||
alignment: Alignment.centerLeft,
|
||||
textAlign: TextAlign.left,
|
||||
text: "21 Dec, 2022",
|
||||
isExpanded: false,
|
||||
fontSize: 10.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontColor: CustomAppColors.kLightTextColor,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationListItemWidget extends StatelessWidget {
|
||||
NotificationListItemWidget({
|
||||
super.key,
|
||||
this.totalNotifications = '0',
|
||||
});
|
||||
|
||||
final NotificationListScreenController controller = Get.find();
|
||||
final String totalNotifications;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
final rotaShift = RotaShift(
|
||||
name: 'Dr. John Doe',
|
||||
staffRequired: '2',
|
||||
workerType: 'Nurse',
|
||||
location: 'Hospital A',
|
||||
startTime: '8:00 AM',
|
||||
endTime: '4:00 PM',
|
||||
breakTime: '30 min',
|
||||
notes: 'NA',
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return ShowDialogNotification(
|
||||
rotaShift: rotaShift,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
onDoubleTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return const HolidayRequestAcceptDialog(
|
||||
startDate: "Dec 18, 2022",
|
||||
endDate: "Dec 19, 2022",
|
||||
noOfDays: "2 days (16 hours)",
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
onLongPress: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return PrivacyPolicyDialog(
|
||||
privacyPolicy: controller.privacyPolicy,
|
||||
checkBoxOnChange: (value) {
|
||||
controller.privacyPolicyAccepted.value = value;
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10.w, vertical: 6.h),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: CustomAppColors.kSecondaryColor),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
CustomTextWidget(
|
||||
text: 'New Shift: Dec 21, 7AM - 7PM',
|
||||
isExpanded: false,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 14.sp,
|
||||
fontColor: CustomAppColors.kDarkBlueTextColor,
|
||||
),
|
||||
const Spacer(),
|
||||
CustomTextWidget(
|
||||
text: '07:30 PM',
|
||||
isExpanded: false,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 10.sp,
|
||||
fontColor: CustomAppColors.kLightTextColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 5.h),
|
||||
Row(
|
||||
children: [
|
||||
CustomTextWidget(
|
||||
alignment: Alignment.centerLeft,
|
||||
textAlign: TextAlign.left,
|
||||
text: "You have been assigned a new shift.",
|
||||
isExpanded: false,
|
||||
fontSize: 10.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontColor: CustomAppColors.kLightTextColor,
|
||||
),
|
||||
const Spacer(),
|
||||
totalNotifications != '0'
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(80.r),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: 22.h,
|
||||
width: 22.w,
|
||||
decoration: const BoxDecoration(
|
||||
color: CustomAppColors.kRedColor,
|
||||
),
|
||||
child: CustomTextWidget(
|
||||
alignment: Alignment.center,
|
||||
textAlign: TextAlign.left,
|
||||
text: totalNotifications,
|
||||
isExpanded: false,
|
||||
fontSize: 12.sp,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontColor: CustomAppColors.kWhiteColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user