@ -36,52 +36,95 @@ class WorkListScreen extends StatefulWidget {
class _WorkListScreenState extends State < WorkListScreen > {
List < WorkListItemTypeModelData > workListItemTypes = [
WorkListItemTypeModelData (
value: 0 ,
name: ' HR ' ,
fullName: LocaleKeys . humanResource . tr ( ) ,
active: false ,
color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' HRSSA ' ,
disable: false ) ,
value: 0 ,
name: ' HR ' ,
fullName: LocaleKeys . humanResource . tr ( ) ,
active: false ,
color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' HRSSA ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 , name: ' MR ' , fullName: LocaleKeys . moveOrder . tr ( ) , active: false , color: [ Color ( 0xff58DCFA ) , Color ( 0xff3CB9D5 ) ] , icon: " assets/images/miss_swipe.svg " , key: ' INVMOA ' , disable: false ) ,
value: 0 ,
name: ' MR ' ,
fullName: LocaleKeys . moveOrder . tr ( ) ,
active: false ,
color: [ Color ( 0xff58DCFA ) , Color ( 0xff3CB9D5 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' INVMOA ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 ,
name: ' PR ' ,
fullName: LocaleKeys . purchaseRequisition . tr ( ) ,
active: false ,
color: [ Color ( 0xff48EACF ) , Color ( 0xff3DCAB3 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' REQAPPRV ' ,
disable: false ) ,
value: 0 ,
name: ' PR ' ,
fullName: LocaleKeys . purchaseRequisition . tr ( ) ,
active: false ,
color: [ Color ( 0xff48EACF ) , Color ( 0xff3DCAB3 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' REQAPPRV ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 ,
name: ' PO ' ,
fullName: LocaleKeys . purchaseOrder . tr ( ) ,
active: false ,
color: [ Color ( 0xff5099E3 ) , Color ( 0xff3670AA ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' POAPPRV ' ,
disable: false ) ,
value: 0 ,
name: ' PO ' ,
fullName: LocaleKeys . purchaseOrder . tr ( ) ,
active: false ,
color: [ Color ( 0xff5099E3 ) , Color ( 0xff3670AA ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' POAPPRV ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 , name: ' ITG ' , fullName: LocaleKeys . ITGForms . tr ( ) , active: false , color: [ Color ( 0xffEB8C90 ) , Color ( 0xffDE6C70 ) ] , icon: " assets/images/miss_swipe.svg " , key: ' ITG ' , disable: false ) ,
value: 0 ,
name: ' ITG ' ,
fullName: LocaleKeys . ITGForms . tr ( ) ,
active: false ,
color: [ Color ( 0xffEB8C90 ) , Color ( 0xffDE6C70 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' ITG ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 ,
name: ' IC ' ,
fullName: LocaleKeys . itemCreation . tr ( ) ,
active: false ,
color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' INVITEM ' ,
disable: false ) ,
value: 0 ,
name: ' IC ' ,
fullName: LocaleKeys . itemCreation . tr ( ) ,
active: false ,
color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' INVITEM ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 , name: ' STAMP ' , fullName: LocaleKeys . stamp . tr ( ) , active: false , color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] , icon: " assets/images/miss_swipe.svg " , key: ' STAMP ' , disable: false ) ,
value: 0 ,
name: ' STAMP ' ,
fullName: LocaleKeys . stamp . tr ( ) ,
active: false ,
color: [ Color ( 0xff32D892 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' STAMP ' ,
disable: false ,
) ,
WorkListItemTypeModelData (
value: 0 , name: ' COC ' , fullName: LocaleKeys . itemCreation . tr ( ) , active: false , color: [ Color ( 0xff787299 ) , Color ( 0xff1AB170 ) ] , icon: " assets/images/miss_swipe.svg " , key: ' COC ' , disable: true ) ,
value: 0 ,
name: ' COC ' ,
fullName: LocaleKeys . itemCreation . tr ( ) ,
active: false ,
color: [ Color ( 0xff787299 ) , Color ( 0xff1AB170 ) ] ,
icon: " assets/images/miss_swipe.svg " ,
key: ' COC ' ,
disable: true ,
) ,
WorkListItemTypeModelData (
value: 0 , name: ' Payment Req ' , fullName: LocaleKeys . paymentRequest . tr ( ) , active: false , color: [ Color ( 0xff42d7bf ) , Color ( 0xff42d7bf ) ] , icon: " assets/images/PR.svg " , key: ' PAY_REQ ' , disable: false )
value: 0 ,
name: ' Payment Req ' ,
fullName: LocaleKeys . paymentRequest . tr ( ) ,
active: false ,
color: [ Color ( 0xff42d7bf ) , Color ( 0xff42d7bf ) ] ,
icon: " assets/images/PR.svg " ,
key: ' PAY_REQ ' ,
disable: false ,
) ,
] ;
int ? workListItemIndex ;
@ -171,6 +214,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
} ) ;
requestAllList = requestAllList + ( itgFormsModel ? . requestType ! [ i ] . requestDetails ? ? [ ] ) ;
}
AppState ( ) . setRequestAllList = requestAllList ;
itgFormsModel ? . requestType ! . insert ( 0 , RequestType ( requestDetails: requestAllList , requestTypeCode: " all " , requestTypeName: " All " ) ) ;
if ( ( itgFormsModel ? . requestType ? . length ? ? 0 ) > 0 ) {
@ -199,10 +243,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
_refreshController . refreshCompleted ( ) ;
Utils . showLoading ( context ) ;
pageNumber = 1 ;
List dataOnRefresh = await Future . wait ( [
providerData . fetchWorkListCounter ( context , showLoading: false ) ,
getWorkList ( showLoading: false , isCallingFromRefresh: true ) ,
] ) ;
List dataOnRefresh = await Future . wait ( [ providerData . fetchWorkListCounter ( context , showLoading: false ) , getWorkList ( showLoading: false , isCallingFromRefresh: true ) ] ) ;
calculateCounter ( ) ;
Utils . hideLoading ( context ) ;
setState ( ( ) { } ) ;
@ -232,131 +273,137 @@ class _WorkListScreenState extends State<WorkListScreen> {
return Scaffold (
backgroundColor: Colors . white ,
appBar: AppBarWidget ( context , title: LocaleKeys . workList . tr ( ) , showWorkListSettingButton: true ) ,
body: workListItemIndex = = null
? Utils . getNoDataWidget ( context )
: SizedBox (
width: double . infinity ,
height: double . infinity ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
SizedBox (
height: 40 ,
child: ListView . separated (
controller: _controller ,
itemBuilder: ( context , index ) {
return Container (
padding: const EdgeInsets . only ( left: 21 , right: 21 , top: 8 , bottom: 8 ) ,
alignment: Alignment . center ,
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 6 ) , color: workListItemIndex = = index ? MyColors . darkIconColor : MyColors . lightGreyEAColor ) ,
child: ( " ${ workListItemTypes [ index ] . name } ${ workListItemTypes [ index ] . value > 0 ? " ( $ {workListItemTypes[index].value } ) " : " " } " )
. toText12 ( color: workListItemIndex = = index ? MyColors . white : MyColors . black ) ,
) . onPress ( ( ) {
if ( pNotificationType ! = 1 ) {
pNotificationType = 1 ;
}
if ( workListItemIndex ! = index & & ! workListItemTypes [ index ] . disable ) {
workListItemIndex = index ;
pageNumber = 1 ;
if ( workListItemTypes [ index ] . value = = 0 ) {
workList = [ ] ;
itgRequestTypeIndex = null ;
} else {
workList = null ;
body:
workListItemIndex = = null
? Utils . getNoDataWidget ( context )
: SizedBox (
width: double . infinity ,
height: double . infinity ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
SizedBox (
height: 40 ,
child: ListView . separated (
controller: _controller ,
itemBuilder: ( context , index ) {
return Container (
padding: const EdgeInsets . only ( left: 21 , right: 21 , top: 8 , bottom: 8 ) ,
alignment: Alignment . center ,
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 6 ) , color: workListItemIndex = = index ? MyColors . darkIconColor : MyColors . lightGreyEAColor ) ,
child: ( " ${ workListItemTypes [ index ] . name } ${ workListItemTypes [ index ] . value > 0 ? " ( $ {workListItemTypes[index].value } ) " : " " } " ).toText12(
color: workListItemIndex = = index ? MyColors . white : MyColors . black ,
) ,
) . onPress ( ( ) {
if ( pNotificationType ! = 1 ) {
pNotificationType = 1 ;
}
setState ( ( ) { } ) ;
if ( workListItemTypes [ index ] . value > 0 ) {
getWorkList ( ) ;
if ( workListItemIndex ! = index & & ! workListItemTypes [ index ] . disable ) {
workListItemIndex = index ;
pageNumber = 1 ;
if ( workListItemTypes [ index ] . value = = 0 ) {
workList = [ ] ;
itgRequestTypeIndex = null ;
} else {
workList = null ;
}
setState ( ( ) { } ) ;
if ( workListItemTypes [ index ] . value > 0 ) {
getWorkList ( ) ;
}
}
}
} ) ;
} ,
separatorBuilder: ( context , index ) = > 8. width ,
shrinkWrap: true ,
itemCount: workListItemTypes . length ,
scrollDirection: Axis . horizontal ,
padding: const EdgeInsets . only ( left: 21 , right: 21 ) ,
} ) ;
} ,
separatorBuilder: ( context , index ) = > 8. width ,
shrinkWrap: true ,
itemCount: workListItemTypes . length ,
scrollDirection: Axis . horizontal ,
padding: const EdgeInsets . only ( left: 21 , right: 21 ) ,
) ,
) . paddingOnly ( top: 21 , bottom: 21 ) ,
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
workListItemTypes [ workListItemIndex ! ] . fullName . toSectionHeading ( ) . paddingOnly ( left: 21 , right: 21 ) ,
LocaleKeys . advancedSearch
. tr ( )
. toText14 ( isUnderLine: true , color: MyColors . textMixColor )
. onPress ( ( ) {
openBottomSheet ( context ) ;
} )
. paddingOnly ( left: 21 , right: 21 ) ,
] ,
) ,
) . paddingOnly ( top: 21 , bottom: 21 ) ,
Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
workListItemTypes [ workListItemIndex ! ] . fullName . toSectionHeading ( ) . paddingOnly ( left: 21 , right: 21 ) ,
LocaleKeys . advancedSearch . tr ( ) . toText14 ( isUnderLine: true , color: MyColors . textMixColor ) . onPress ( ( ) {
openBottomSheet ( context ) ;
} ) . paddingOnly ( left: 21 , right: 21 )
] ,
) ,
SmartRefresher (
SmartRefresher (
enablePullDown: true ,
enablePullUp: false ,
header: const MaterialClassicHeader (
color: MyColors . gradiantEndColor ,
) ,
header: const MaterialClassicHeader ( color: MyColors . gradiantEndColor ) ,
controller: _refreshController ,
onRefresh: _onRefresh ,
scrollController: _scrollController ,
child: SingleChildScrollView (
physics: const BouncingScrollPhysics ( ) ,
child: itgRequestTypeIndex ! = null
? Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
/ / todo this is commented for temporary purpose , have issue when selecting any itg category and click any item showing wrong details
/ / 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 ) ,
/ / ) ,
/ / ) . 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
child:
itgRequestTypeIndex ! = null
? Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
/ / todo this is commented for temporary purpose , have issue when selecting any itg category and click any item showing wrong details
/ / 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 ) ,
/ / ) ,
/ / ) . 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 ) ,
) )
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 ,
] ,
) ,
) . expanded ,
] ,
) ,
) ,
) ,
) ;
}
@ -388,13 +435,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
decoration: BoxDecoration (
color: Colors . white ,
borderRadius: BorderRadius . circular ( 10 ) ,
boxShadow: [
BoxShadow (
color: const Color ( 0xff000000 ) . withOpacity ( . 05 ) ,
blurRadius: 26 ,
offset: const Offset ( 0 , - 3 ) ,
) ,
] ,
boxShadow: [ BoxShadow ( color: const Color ( 0xff000000 ) . withOpacity ( . 05 ) , blurRadius: 26 , offset: const Offset ( 0 , - 3 ) ) ] ,
) ,
child: Row (
crossAxisAlignment: CrossAxisAlignment . start ,
@ -509,13 +550,7 @@ class _WorkListScreenState extends State<WorkListScreen> {
decoration: BoxDecoration (
color: Colors . white ,
borderRadius: BorderRadius . circular ( 10 ) ,
boxShadow: [
BoxShadow (
color: const Color ( 0xff000000 ) . withOpacity ( . 05 ) ,
blurRadius: 26 ,
offset: const Offset ( 0 , - 3 ) ,
) ,
] ,
boxShadow: [ BoxShadow ( color: const Color ( 0xff000000 ) . withOpacity ( . 05 ) , blurRadius: 26 , offset: const Offset ( 0 , - 3 ) ) ] ,
) ,
child: Row (
crossAxisAlignment: CrossAxisAlignment . start ,
@ -555,10 +590,6 @@ class _WorkListScreenState extends State<WorkListScreen> {
}
void _animateToIndex ( int index , double width ) {
_controller . animateTo (
index * width ,
duration: const Duration ( seconds: 1 ) ,
curve: Curves . fastOutSlowIn ,
) ;
_controller . animateTo ( index * width , duration: const Duration ( seconds: 1 ) , curve: Curves . fastOutSlowIn ) ;
}
}