Merge branch 'master' into development_aamir

merge-requests/86/head
Aamir Muhammad 3 years ago
commit 2d6ffff8be

@ -35,6 +35,7 @@ class ItgDetailScreen extends StatefulWidget {
class _ItgDetailScreenState extends State<ItgDetailScreen> { class _ItgDetailScreenState extends State<ItgDetailScreen> {
int tabIndex = 0; int tabIndex = 0;
int animationIndex = 0;
PageController controller = PageController(); PageController controller = PageController();
bool showFabOptions = false; bool showFabOptions = false;
@ -82,6 +83,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void getDataFromState() { void getDataFromState() {
if (requestDetails == null) { if (requestDetails == null) {
animationIndex = animationIndex + 1;
requestDetails = AppState().requestAllList![AppState().itgWorkListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel; requestDetails = AppState().requestAllList![AppState().itgWorkListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1; providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
getItgData(); getItgData();
@ -95,151 +97,170 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
return Scaffold( return Scaffold(
appBar: AppBarWidget(context, title: LocaleKeys.details.tr()), appBar: AppBarWidget(context, title: LocaleKeys.details.tr()),
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: Stack( body: AnimatedSwitcher(
children: [ duration: const Duration(milliseconds: 500),
Column( switchInCurve: Curves.easeInToLinear,
children: [ transitionBuilder: (Widget child, Animation<double> animation) {
Container( Animation<Offset> custom = Tween<Offset>(
padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16), begin: const Offset(1.0, 0.0),
decoration: const BoxDecoration( end: Offset.zero,
borderRadius: BorderRadius.only( ).animate(animation);
bottomLeft: Radius.circular(25), return ClipRect(
bottomRight: Radius.circular(25), child: SlideTransition(
position: custom,
child: child,
// textDirection: TextDirection.ltr,
),
);
},
child: Stack(
key: ValueKey(animationIndex),
children: [
Column(
children: [
Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(25),
bottomRight: Radius.circular(25),
),
gradient: LinearGradient(
transform: GradientRotation(.83),
begin: Alignment.topRight,
end: Alignment.bottomLeft,
colors: [
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
],
),
), ),
gradient: LinearGradient( child: Row(
transform: GradientRotation(.83), children: [
begin: Alignment.topRight, myTab(LocaleKeys.requestDetails.tr(), 0),
end: Alignment.bottomLeft, myTab(LocaleKeys.approvalLevel.tr(), 1),
colors: [ myTab(LocaleKeys.requesterDetails.tr(), 2),
MyColors.gradiantEndColor,
MyColors.gradiantStartColor,
], ],
), ),
), ),
child: Row( PageView(
controller: controller,
onPageChanged: (pageIndex) {
setState(() {
tabIndex = pageIndex;
});
},
children: [ children: [
myTab(LocaleKeys.requestDetails.tr(), 0), RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []),
myTab(LocaleKeys.approvalLevel.tr(), 1), ApprovalLevelfragment(
myTab(LocaleKeys.requesterDetails.tr(), 2), wFHistory: itgRequest?.wFHistory ?? [],
voidCallback: reloadITG,
),
RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []),
], ],
), ).expanded,
), if (isApproveAvailable || isRejectAvailable || isCloseAvailable)
PageView( Container(
controller: controller, padding: const EdgeInsets.only(top: 14, bottom: 14, left: 21, right: 21),
onPageChanged: (pageIndex) { decoration: const BoxDecoration(
setState(() { color: Colors.white,
tabIndex = pageIndex; border: Border(
}); top: BorderSide(
}, color: MyColors.lightGreyEFColor,
children: [ width: 1.0,
RequestDetailFragment(fields: itgRequest?.fieldGoups?[1].fields ?? []), ),
ApprovalLevelfragment(
wFHistory: itgRequest?.wFHistory ?? [],
voidCallback: reloadITG,
),
RequestDetailFragment(fields: itgRequest?.fieldGoups?[0].fields ?? []),
],
).expanded,
if (isApproveAvailable || isRejectAvailable || isCloseAvailable)
Container(
padding: const EdgeInsets.only(top: 14, bottom: 14, left: 21, right: 21),
decoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(
color: MyColors.lightGreyEFColor,
width: 1.0,
), ),
), ),
), child: Row(
child: Row( children: [
if (isRejectAvailable)
DefaultButton(
LocaleKeys.reject.tr(),
() => performAction("REJECTED"),
colors: const [
Color(0xffE47A7E),
Color(0xffDE6D71),
],
).expanded,
if (isApproveAvailable && isRejectAvailable) 8.width,
if (isApproveAvailable)
DefaultButton(
LocaleKeys.approve.tr(),
() => performAction("APPROVED"),
colors: const [
Color(0xff28C884),
Color(0xff1BB271),
],
).expanded,
if (isCloseAvailable)
DefaultButton(
LocaleKeys.ok.tr(),
() => performAction("CLOSE"),
colors: const [
Color(0xff32D892),
Color(0xff1AB170),
],
).expanded,
8.width,
Container(
height: 43,
width: 43,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: MyColors.lightGreyE6Color,
),
child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor),
).onPress(() {
setState(() {
showFabOptions = true;
});
})
],
),
)
],
),
IgnorePointer(
ignoring: !showFabOptions,
child: AnimatedOpacity(
opacity: showFabOptions ? 1 : 0,
duration: const Duration(milliseconds: 250),
child: Container(
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 75 - 12),
width: double.infinity,
height: double.infinity,
color: Colors.white.withOpacity(.67),
alignment: Alignment.bottomRight,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
if (isRejectAvailable) myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() {
DefaultButton( if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) {
LocaleKeys.reject.tr(), animationIndex = animationIndex + 1;
() => performAction("REJECTED"), AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1;
colors: const [ requestDetails = null;
Color(0xffE47A7E), itgRequest = null;
Color(0xffDE6D71), tabIndex = 0;
], showFabOptions = false;
).expanded, getDataFromState();
if (isApproveAvailable && isRejectAvailable) 8.width, } else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) {
if (isApproveAvailable) Navigator.pop(context);
DefaultButton( }
LocaleKeys.approve.tr(), }),
() => performAction("APPROVED"), 12.height,
colors: const [ ...viewApiButtonsList(allowedActionList),
Color(0xff28C884),
Color(0xff1BB271),
],
).expanded,
if (isCloseAvailable)
DefaultButton(
LocaleKeys.ok.tr(),
() => performAction("CLOSE"),
colors: const [
Color(0xff32D892),
Color(0xff1AB170),
],
).expanded,
8.width,
Container(
height: 43,
width: 43,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: MyColors.lightGreyE6Color,
),
child: Icon(showFabOptions ? Icons.more_vert_rounded : Icons.more_horiz_rounded, color: MyColors.darkIconColor),
).onPress(() {
setState(() {
showFabOptions = true;
});
})
], ],
), ),
)
],
),
IgnorePointer(
ignoring: !showFabOptions,
child: AnimatedOpacity(
opacity: showFabOptions ? 1 : 0,
duration: const Duration(milliseconds: 250),
child: Container(
padding: const EdgeInsets.only(left: 21, right: 21, bottom: 75 - 12),
width: double.infinity,
height: double.infinity,
color: Colors.white.withOpacity(.67),
alignment: Alignment.bottomRight,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) {
AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1;
requestDetails = null;
itgRequest = null;
tabIndex = 0;
showFabOptions = false;
getDataFromState();
} else if (AppState().requestAllList!.length - 1 == AppState().itgWorkListIndex!) {
Navigator.pop(context);
}
}),
12.height,
...viewApiButtonsList(allowedActionList),
],
), ),
), ).onPress(() {
).onPress(() { setState(() {
setState(() { showFabOptions = false;
showFabOptions = false; });
}); }),
}), ),
), ],
], ),
), ),
floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable) floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable)
? Container( ? Container(
@ -514,6 +535,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
// Navigator.pop(context, "delegate_reload"); // Navigator.pop(context, "delegate_reload");
animationIndex=animationIndex+1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) { if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");
@ -534,9 +556,11 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void performDataCorrectionORReportGeneratedAction(String requestType, int taskId, int itemId, String employeeNumber) async { void performDataCorrectionORReportGeneratedAction(String requestType, int taskId, int itemId, String employeeNumber) async {
try { try {
Utils.showLoading(context); Utils.showLoading(context);
animationIndex = animationIndex + 1;
ITGRequest? itgRequest = await WorkListApiClient().grantITGRequest(requestType, taskId, itemId, employeeNumber, "", ""); ITGRequest? itgRequest = await WorkListApiClient().grantITGRequest(requestType, taskId, itemId, employeeNumber, "", "");
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) { if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");
@ -555,6 +579,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
} }
void reloadITG() { void reloadITG() {
animationIndex = animationIndex + 1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!); AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) { if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");

@ -55,6 +55,7 @@ class WorkListDetailScreen extends StatefulWidget {
class _WorkListDetailScreenState extends State<WorkListDetailScreen> { class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
int tabIndex = 0; int tabIndex = 0;
int animationIndex = 0;
PageController controller = PageController(); PageController controller = PageController();
bool showFabOptions = false; bool showFabOptions = false;
@ -187,7 +188,6 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
getDataFromState(); getDataFromState();
return Scaffold( return Scaffold(
appBar: AppBarWidget(context, title: LocaleKeys.details.tr()), appBar: AppBarWidget(context, title: LocaleKeys.details.tr()),
backgroundColor: Colors.white, backgroundColor: Colors.white,
@ -208,7 +208,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
); );
}, },
child: Stack( child: Stack(
key: ValueKey(AppState().workListIndex ?? 0), key: ValueKey(animationIndex),
children: [ children: [
Column( Column(
children: [ children: [
@ -350,6 +350,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
children: [ children: [
myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() { myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().workList!.length - 1 > AppState().workListIndex!) { if (AppState().workList!.length - 1 > AppState().workListIndex!) {
animationIndex = animationIndex + 1;
AppState().setWorkListIndex = AppState().workListIndex! + 1; AppState().setWorkListIndex = AppState().workListIndex! + 1;
workListData = null; workListData = null;
showFabOptions = false; showFabOptions = false;
@ -685,6 +686,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload); GenericResponseModel model = await WorkListApiClient().postNotificationActions(payload);
Utils.hideLoading(context); Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr()); Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
animationIndex=animationIndex+1;
AppState().workList!.removeAt(AppState().workListIndex!); AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) { if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");
@ -703,6 +705,7 @@ class _WorkListDetailScreenState extends State<WorkListDetailScreen> {
} }
void reloadWorkList() { void reloadWorkList() {
animationIndex = animationIndex + 1;
AppState().workList!.removeAt(AppState().workListIndex!); AppState().workList!.removeAt(AppState().workListIndex!);
if (AppState().workList!.isEmpty) { if (AppState().workList!.isEmpty) {
Navigator.pop(context, "delegate_reload"); Navigator.pop(context, "delegate_reload");

@ -21,7 +21,7 @@ AppBar AppBarWidget(BuildContext context,
children: [ children: [
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: Feedback.wrapForTap(() => Navigator.maybePop(context, true), context), onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor), child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
), ),
4.width, 4.width,

Loading…
Cancel
Save