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> {
int tabIndex = 0;
int animationIndex = 0;
PageController controller = PageController();
bool showFabOptions = false;
@ -82,6 +83,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
void getDataFromState() {
if (requestDetails == null) {
animationIndex = animationIndex + 1;
requestDetails = AppState().requestAllList![AppState().itgWorkListIndex!]; // ModalRoute.of(context)!.settings.arguments as WorkListResponseModel;
providerData.itgFormsModel!.totalCount = providerData.itgFormsModel!.totalCount! - 1;
getItgData();
@ -95,7 +97,24 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
return Scaffold(
appBar: AppBarWidget(context, title: LocaleKeys.details.tr()),
backgroundColor: Colors.white,
body: Stack(
body: AnimatedSwitcher(
duration: const Duration(milliseconds: 500),
switchInCurve: Curves.easeInToLinear,
transitionBuilder: (Widget child, Animation<double> animation) {
Animation<Offset> custom = Tween<Offset>(
begin: const Offset(1.0, 0.0),
end: Offset.zero,
).animate(animation);
return ClipRect(
child: SlideTransition(
position: custom,
child: child,
// textDirection: TextDirection.ltr,
),
);
},
child: Stack(
key: ValueKey(animationIndex),
children: [
Column(
children: [
@ -218,6 +237,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
children: [
myFab(LocaleKeys.skip.tr(), "assets/images/skip.svg").onPress(() {
if (AppState().requestAllList!.length - 1 > AppState().itgWorkListIndex!) {
animationIndex = animationIndex + 1;
AppState().itgWorkListIndex = AppState().itgWorkListIndex! + 1;
requestDetails = null;
itgRequest = null;
@ -241,6 +261,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
),
],
),
),
floatingActionButton: (!isApproveAvailable && !isRejectAvailable && !isCloseAvailable)
? Container(
height: 43,
@ -514,6 +535,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
// Navigator.pop(context, "delegate_reload");
animationIndex=animationIndex+1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
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 {
try {
Utils.showLoading(context);
animationIndex = animationIndex + 1;
ITGRequest? itgRequest = await WorkListApiClient().grantITGRequest(requestType, taskId, itemId, employeeNumber, "", "");
Utils.hideLoading(context);
Utils.showToast(LocaleKeys.yourChangeHasBeenSavedSuccessfully.tr());
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload");
@ -555,6 +579,7 @@ class _ItgDetailScreenState extends State<ItgDetailScreen> {
}
void reloadITG() {
animationIndex = animationIndex + 1;
AppState().requestAllList!.removeAt(AppState().itgWorkListIndex!);
if (AppState().requestAllList!.isEmpty) {
Navigator.pop(context, "delegate_reload");

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

@ -21,7 +21,7 @@ AppBar AppBarWidget(BuildContext context,
children: [
GestureDetector(
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),
),
4.width,

Loading…
Cancel
Save