description format section seperated in itg forms

master_eventActivity
Sikander Saleem 1 year ago
parent c35074576a
commit a33da491f9

@ -69,13 +69,34 @@ class RequestDetailFragment extends StatelessWidget {
); );
} }
Widget detailView(List<Fields> fields) { Widget detailView(List<Fields> fieldsF) {
List<Fields> fields = List.from(fieldsF);
bool isOdd = false; bool isOdd = false;
if (fields.length % 2 != 0) { if (fields.length % 2 != 0) {
isOdd = true; isOdd = true;
fields.add(new Fields()); fields.add(new Fields());
} }
return GridView.builder(
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, itemCount: fields.length,
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
@ -109,6 +130,9 @@ class RequestDetailFragment extends StatelessWidget {
crossAxisCount: 2, crossAxisCount: 2,
childAspectRatio: (itemWidth / itemHeight), childAspectRatio: (itemWidth / itemHeight),
), ),
),
if (descriptionFormatView != null) descriptionFormatView,
],
).objectContainerView(); ).objectContainerView();
return ListView.separated( return ListView.separated(
shrinkWrap: true, shrinkWrap: true,

@ -52,8 +52,9 @@ class ItemDetailViewGridItem extends StatelessWidget {
final String? value; final String? value;
final String? type; final String? type;
final bool isNeedToShowEmptyDivider; final bool isNeedToShowEmptyDivider;
final int maxLine;
ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false, this.type = ""}) : super(key: key); ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false, this.type = "", this.maxLine = 6}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -76,10 +77,11 @@ class ItemDetailViewGridItem extends StatelessWidget {
), ),
), ),
child: isNeedToShowEmptyDivider child: isNeedToShowEmptyDivider
? Container() ? SizedBox()
: Column( : Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [ children: [
title != null ? Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))) : Container(), title != null ? Flexible(child: "$title:".toText12Auto(isBold: true, color: const Color(0xff2BB8A6))) : Container(),
4.width, 4.width,
@ -87,7 +89,7 @@ class ItemDetailViewGridItem extends StatelessWidget {
? type!.toLowerCase() == "table" ? type!.toLowerCase() == "table"
? getStringFromJSON(value!) ? getStringFromJSON(value!)
// : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5)) // : Flexible(child: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 5))
: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: 6) : (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine)
: Container(), : Container(),
], ],
), ),

Loading…
Cancel
Save