PageView added to PR Info page

pull/3/head
haroon amjad 3 years ago
parent 5df7a77dbe
commit d7ab1c8dc2

@ -58,6 +58,7 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
List<GetPRActionHistoryList> actionHistoryList = []; List<GetPRActionHistoryList> actionHistoryList = [];
List<GetAttachementList> getAttachmentList = []; List<GetAttachementList> getAttachmentList = [];
int tabIndex = 0; int tabIndex = 0;
PageController controller = PageController();
@override @override
void initState() { void initState() {
@ -136,7 +137,7 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
body: ListView( body: ListView(
padding: _screenParams!.isPRInfo ? const EdgeInsets.all(0) : const EdgeInsets.all(21), padding: _screenParams!.isPRInfo ? const EdgeInsets.all(0) : const EdgeInsets.all(21),
physics: const BouncingScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
children: [ children: [
if (_screenParams!.isPRInfo) prLinesDataView(), if (_screenParams!.isPRInfo) prLinesDataView(),
if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(), if (moItemHistoryList.isNotEmpty) loadMoItemHistoryData(),
@ -150,6 +151,7 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
Widget prLinesDataView() { Widget prLinesDataView() {
return Column( return Column(
mainAxisSize: MainAxisSize.min,
children: [ children: [
Container( Container(
padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16), padding: const EdgeInsets.only(left: 21, right: 21, top: 16, bottom: 16),
@ -177,36 +179,88 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
), ),
), ),
if (tabIndex == 0) _screenParams!.getPRInformationList!.pRHeader![0].dESCRIPTION!.toText14().paddingOnly(top: 20, right: 21, left: 21), if (tabIndex == 0) _screenParams!.getPRInformationList!.pRHeader![0].dESCRIPTION!.toText14().paddingOnly(top: 20, right: 21, left: 21),
if (tabIndex == 0) // if (tabIndex == 0)
ListView.separated( // ListView.separated(
padding: const EdgeInsets.all(21), // padding: const EdgeInsets.all(21),
shrinkWrap: true, // shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), // physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column( // itemBuilder: (cxt, index) => Column(
children: [ // children: [
ItemDetailGrid( // ItemDetailGrid(
ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""), // ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""), // ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""),
), // ),
ItemDetailGrid( // ItemDetailGrid(
ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""), // ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""), // ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""),
), // ),
ItemDetailGrid( // ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""), // ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""), // ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""),
), // ),
ItemDetailGrid( // ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""), // ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""),
ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""), // ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""),
isItLast: true, // isItLast: true,
), // ),
], // ],
).objectContainerView(), // ).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height, // separatorBuilder: (cxt, index) => 12.height,
itemCount: _screenParams!.getPRInformationList!.pRLines!.length), // itemCount: _screenParams!.getPRInformationList!.pRLines!.length),
if (tabIndex == 1) getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21), // if (tabIndex == 1) getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21),
if (tabIndex == 2) getPRAttachments(), // if (tabIndex == 2) getPRAttachments(),
SizedBox(
height: MediaQuery.of(context).size.height,
child: PageView(
controller: controller,
onPageChanged: (pageIndex) {
setState(() {
tabIndex = pageIndex;
if (pageIndex == 1) {
getActionsDataFromApi();
}
if (pageIndex == 2) {
getAttachmentsDataFromApi();
}
});
},
children: [
// if (tabIndex == 0)
ListView.separated(
padding: const EdgeInsets.all(21),
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (cxt, index) => Column(
children: [
ItemDetailGrid(
ItemDetailViewCol("Cost Center", _screenParams!.getPRInformationList!.pRLines![index].cOSTCENTER ?? ""),
ItemDetailViewCol("Code", _screenParams!.getPRInformationList!.pRLines![index].iTEMCODE ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Unit", _screenParams!.getPRInformationList!.pRLines![index].uOM ?? ""),
ItemDetailViewCol("Price (SAR)", _screenParams!.getPRInformationList!.pRLines![index].uNITPRICE.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("Amount (SAR)", _screenParams!.getPRInformationList!.pRLines![index].lINEAMOUNT.toString() ?? ""),
ItemDetailViewCol("Quantity", _screenParams!.getPRInformationList!.pRLines![index].qUANTITY.toString() ?? ""),
),
ItemDetailGrid(
ItemDetailViewCol("AMU (Last 3 months)", _screenParams!.getPRInformationList!.pRLines![index].iTEMAMU.toString() ?? ""),
ItemDetailViewCol("PR Number", _screenParams!.getPRInformationList!.pRHeader![0].pRNUMBER!.toString() ?? ""),
isItLast: true,
),
],
).objectContainerView(),
separatorBuilder: (cxt, index) => 12.height,
itemCount: _screenParams!.getPRInformationList!.pRLines!.length),
// if (tabIndex == 1)
getPRActionsHistory(), //"ACTIONS".toText14().paddingOnly(top: 20, right: 21, left: 21),
// if (tabIndex == 2)
getPRAttachments(),
],
),
),
], ],
); );
} }
@ -550,7 +604,8 @@ class _ItemHistoryScreenState extends State<ItemHistoryScreen> {
if (index == 2) { if (index == 2) {
getAttachmentsDataFromApi(); getAttachmentsDataFromApi();
} }
tabIndex = index; // tabIndex = index;
controller.jumpToPage(index);
}); });
}).expanded; }).expanded;
} }

Loading…
Cancel
Save