|
|
|
|
@ -69,46 +69,70 @@ class RequestDetailFragment extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget detailView(List<Fields> fields) {
|
|
|
|
|
Widget detailView(List<Fields> fieldsF) {
|
|
|
|
|
List<Fields> fields = List.from(fieldsF);
|
|
|
|
|
|
|
|
|
|
bool isOdd = false;
|
|
|
|
|
if (fields.length % 2 != 0) {
|
|
|
|
|
isOdd = true;
|
|
|
|
|
fields.add(new Fields());
|
|
|
|
|
}
|
|
|
|
|
return GridView.builder(
|
|
|
|
|
itemCount: fields.length,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
if (fields[index].value == null) {
|
|
|
|
|
return ItemDetailViewGridItem(
|
|
|
|
|
index,
|
|
|
|
|
fields[index].title,
|
|
|
|
|
fields[index].multipleValue?.join(", ") ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return ItemDetailViewGridItem(
|
|
|
|
|
index,
|
|
|
|
|
fields[index].title,
|
|
|
|
|
fields[index].value ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
childAspectRatio: (itemWidth / itemHeight),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
int descriptionFormatIndex = fields.indexWhere((element) => element.title == "Description Format" || element.title == "Description Format"); // todo add arabic in future
|
|
|
|
|
Widget? descriptionFormatView;
|
|
|
|
|
if (descriptionFormatIndex >= 0) {
|
|
|
|
|
Fields descriptionFormat = fields[descriptionFormatIndex];
|
|
|
|
|
fields.removeAt(descriptionFormatIndex);
|
|
|
|
|
|
|
|
|
|
descriptionFormatView = ItemDetailViewGridItem(
|
|
|
|
|
2,
|
|
|
|
|
descriptionFormat.title,
|
|
|
|
|
descriptionFormat.value == null ? (descriptionFormat.multipleValue?.join(", ") ?? "") : descriptionFormat.value ?? "",
|
|
|
|
|
type: descriptionFormat.type,
|
|
|
|
|
maxLine: 0,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
GridView.builder(
|
|
|
|
|
itemCount: fields.length,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
if (fields[index].value == null) {
|
|
|
|
|
return ItemDetailViewGridItem(
|
|
|
|
|
index,
|
|
|
|
|
fields[index].title,
|
|
|
|
|
fields[index].multipleValue?.join(", ") ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return ItemDetailViewGridItem(
|
|
|
|
|
index,
|
|
|
|
|
fields[index].title,
|
|
|
|
|
fields[index].value ?? "",
|
|
|
|
|
isNeedToShowEmptyDivider: (fields.length == index + 1)
|
|
|
|
|
? isOdd
|
|
|
|
|
? true
|
|
|
|
|
: false
|
|
|
|
|
: false,
|
|
|
|
|
type: fields[index].type,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 2,
|
|
|
|
|
childAspectRatio: (itemWidth / itemHeight),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (descriptionFormatView != null) descriptionFormatView,
|
|
|
|
|
],
|
|
|
|
|
).objectContainerView();
|
|
|
|
|
return ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|