207 lines
5.7 KiB
Dart
207 lines
5.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
|
import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart';
|
|
import 'package:get/get.dart';
|
|
import 'new_rota_list_widget.dart';
|
|
|
|
class RotaDashboardScreen extends StatefulWidget {
|
|
const RotaDashboardScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<RotaDashboardScreen> createState() => _RotaDashboardScreenState();
|
|
}
|
|
|
|
class _RotaDashboardScreenState extends State<RotaDashboardScreen> {
|
|
final _controller = Get.put(RotaDashboardScreenController());
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CustomScaffold(
|
|
screenKey: _controller.screenKey,
|
|
onScreenTap: _controller.removeFocus,
|
|
showAppBar: true,
|
|
appBar: CustomAppBarTitleOnly(context, titleText: 'Rota'),
|
|
body: _tabWidget(),
|
|
);
|
|
}
|
|
|
|
Widget _tabWidget() {
|
|
return Column(
|
|
children: [
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 18.0.w,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: _buttons(
|
|
onTap: () {
|
|
Navigator.pushNamed(
|
|
context,
|
|
CustomRouteNames.kPickUpShiftsScreenRoute,
|
|
);
|
|
},
|
|
text: "Pick up Shifts")),
|
|
24.horizontalSpace,
|
|
Expanded(
|
|
child: _buttons(
|
|
onTap: () {
|
|
Navigator.pushNamed(
|
|
context,
|
|
CustomRouteNames.kBookHolidayScreenRoute,
|
|
);
|
|
},
|
|
text: "Book a Holiday")),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: Get.width,
|
|
alignment: Alignment.center,
|
|
child: TabBar(
|
|
controller: _controller.tabController,
|
|
unselectedLabelColor: CustomAppColors.kLightGreyColor,
|
|
labelColor: CustomAppColors.kSecondaryColor,
|
|
labelPadding: const EdgeInsets.all(0),
|
|
indicatorSize: TabBarIndicatorSize.tab,
|
|
indicatorColor: CustomAppColors.kSecondaryColor,
|
|
tabs: const [
|
|
Tab(
|
|
child: Text(
|
|
"List",
|
|
textAlign: TextAlign.center,
|
|
maxLines: 2,
|
|
),
|
|
),
|
|
Tab(
|
|
child: Text(
|
|
"Calendar",
|
|
textAlign: TextAlign.center,
|
|
maxLines: 2,
|
|
),
|
|
),
|
|
],
|
|
//Change
|
|
),
|
|
),
|
|
Expanded(
|
|
child: TabBarView(
|
|
controller: _controller.tabController,
|
|
children: [_yourRotaListTabView, _calandarTabView()],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _calandarTabView() {
|
|
return Column(
|
|
children: [
|
|
Flexible(
|
|
child: Obx(
|
|
() {
|
|
return CalendarWidget(
|
|
key: UniqueKey(),
|
|
markedDatesMap: _controller.markedDatesMap(),
|
|
minDate: DateTime.now().subtract(40.days),
|
|
targetDateTime: _controller.targetDateTime(),
|
|
canSelectRange: false,
|
|
onDayTap: _controller.onDateSelect,
|
|
);
|
|
},
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Obx(
|
|
() => NewRotaListWidget(
|
|
shifts: _controller.dateFilteredShiftsList(),
|
|
onCancelShiftTap: (int index, DaysArrayData data) {},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget get _yourRotaListTabView {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
_yourRotaHeader(),
|
|
Expanded(
|
|
child: Obx(
|
|
() => _controller.loadingShifts()
|
|
? const Center(child: CircularProgressIndicator())
|
|
: NewRotaListWidget(
|
|
shifts: _controller.myShiftsList(),
|
|
onCancelShiftTap: (int index, DaysArrayData data) {},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _yourRotaHeader() {
|
|
return InkWell(
|
|
onTap: () {
|
|
Navigator.pushNamed(context, CustomRouteNames.kYourRotaScreenRoute);
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
CustomTextWidget(
|
|
text: "Your Rota",
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w700,
|
|
isExpanded: false,
|
|
),
|
|
const CustomImageWidget(
|
|
imagePath: AssetsManager.kArrowNextIcon,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buttons({required VoidCallback onTap, required String text}) {
|
|
return InkWell(
|
|
onTap: onTap,
|
|
child: Container(
|
|
height: 42.r,
|
|
width: double.maxFinite,
|
|
padding: REdgeInsets.all(10).copyWith(right: 2.r),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: CustomAppColors.kSecondaryColor,
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
CustomTextWidget(
|
|
text: text,
|
|
isExpanded: false,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 14.sp),
|
|
Icon(
|
|
Icons.keyboard_arrow_right,
|
|
size: 20.r,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
}
|