|
|
|
|
@ -19,6 +19,7 @@ import 'package:mohem_flutter_app/models/worklist_response_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
|
|
|
|
|
|
class WorkListScreen extends StatefulWidget {
|
|
|
|
|
WorkListScreen({Key? key}) : super(key: key);
|
|
|
|
|
@ -82,6 +83,8 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
|
|
|
|
|
late DashboardProviderModel providerData;
|
|
|
|
|
|
|
|
|
|
final RefreshController _refreshController = RefreshController(initialRefresh: false);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
@ -137,6 +140,11 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _onRefresh() async {
|
|
|
|
|
getWorkList();
|
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
@ -177,6 +185,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
workListItemIndex = index;
|
|
|
|
|
if (workListItemTypes[index].value == 0) {
|
|
|
|
|
workList = [];
|
|
|
|
|
itgRequestTypeIndex = null;
|
|
|
|
|
} else {
|
|
|
|
|
workList = null;
|
|
|
|
|
}
|
|
|
|
|
@ -195,58 +204,70 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 21, bottom: 21),
|
|
|
|
|
workListItemTypes[workListItemIndex].fullName.toSectionHeading().paddingOnly(left: 21, right: 21),
|
|
|
|
|
if (itgRequestTypeIndex != null)
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
RequestType type = itgFormsModel!.requestType![index];
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
|
|
|
|
|
child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (itgRequestTypeIndex != index) {
|
|
|
|
|
itgRequestTypeIndex = index;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: itgFormsModel?.requestType?.length ?? 0,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
SmartRefresher(
|
|
|
|
|
enablePullDown: true,
|
|
|
|
|
enablePullUp: false,
|
|
|
|
|
header: const MaterialClassicHeader(
|
|
|
|
|
color: MyColors.gradiantEndColor,
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 16, bottom: 16),
|
|
|
|
|
itgRequestTypeIndex != null
|
|
|
|
|
? Expanded(
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0,
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Expanded(
|
|
|
|
|
child: workList != null
|
|
|
|
|
? ((workList!).isEmpty
|
|
|
|
|
? LocaleKeys.noHistoryAvailable.tr().toText16().center
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
controller: _refreshController,
|
|
|
|
|
onRefresh: _onRefresh,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
physics: const BouncingScrollPhysics(),
|
|
|
|
|
child: itgRequestTypeIndex != null
|
|
|
|
|
? Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 40,
|
|
|
|
|
child: ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return rowItem(workListItemTypes[workListItemIndex], workList![index], index);
|
|
|
|
|
RequestType type = itgFormsModel!.requestType![index];
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 8, bottom: 8),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(30), color: itgRequestTypeIndex == index ? MyColors.darkIconColor : MyColors.lightGreyEAColor),
|
|
|
|
|
child: ("${type.requestTypeName}").toText12(color: itgRequestTypeIndex == index ? MyColors.white : MyColors.black),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (itgRequestTypeIndex != index) {
|
|
|
|
|
itgRequestTypeIndex = index;
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: workList?.length ?? 0,
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
))
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
),
|
|
|
|
|
separatorBuilder: (context, index) => 8.width,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: itgFormsModel?.requestType?.length ?? 0,
|
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21),
|
|
|
|
|
),
|
|
|
|
|
).paddingOnly(top: 16, bottom: 16),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return itgRowItem(workListItemTypes[workListItemIndex], itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails![index], index);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: itgFormsModel!.requestType![itgRequestTypeIndex!].requestDetails?.length ?? 0,
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: workList != null
|
|
|
|
|
? ((workList!).isEmpty
|
|
|
|
|
? Utils.getNoDataWidget(context).paddingOnly(top: 100)
|
|
|
|
|
: ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return rowItem(workListItemTypes[workListItemIndex], workList![index], index);
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) => 12.height,
|
|
|
|
|
itemCount: workList?.length ?? 0,
|
|
|
|
|
padding: const EdgeInsets.all(21),
|
|
|
|
|
))
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
)).expanded,
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -321,10 +342,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
DateUtil.formatDateToDate(DateUtil.convertStringToDate(requestDetails.modifiedDate!), false).toText10(color: MyColors.lightTextColor).expanded,
|
|
|
|
|
RotatedBox(
|
|
|
|
|
quarterTurns: AppState().isArabic(context) ? 2:4,
|
|
|
|
|
child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor)
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -403,11 +421,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
DateUtil.formatDateToDate(DateUtil.convertSimpleStringDateToDate(workData.bEGINDATE!), false).toText10(color: MyColors.lightTextColor).expanded,
|
|
|
|
|
RotatedBox(
|
|
|
|
|
quarterTurns: AppState().isArabic(context) ? 2:4,
|
|
|
|
|
child: SvgPicture.asset("assets/images/arrow_next.svg", color:MyColors.darkIconColor)
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: MyColors.darkIconColor)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|