long text field changed to separate field.

master
Sikander Saleem 8 months ago
parent 7c3f6a508f
commit 54aa610856

@ -40,6 +40,7 @@ class RequestDetailFragment extends StatelessWidget {
? LocaleKeys.noDataAvailable.tr().toText16().center
: ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: uiList,
),
),
@ -73,24 +74,27 @@ class RequestDetailFragment extends StatelessWidget {
List<Fields> fields = List.from(fieldsF);
bool isOdd = false;
if (fields.length % 2 != 0) {
isOdd = true;
fields.add(new Fields());
}
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);
List<Widget> longValueFields = [];
descriptionFormatView = ItemDetailViewGridItem(
longValueFields = fields
.where((Fields element) => (element.value?.length ?? 0) > 120)
.toList()
.map((Fields descriptionFormat) => ItemDetailViewGridItem(
2,
descriptionFormat.title,
descriptionFormat.value == null ? (descriptionFormat.multipleValue?.join(", ") ?? "") : descriptionFormat.value ?? "",
type: descriptionFormat.type,
showSpaceAfterLine: true,
maxLine: 0,
);
))
.toList();
fields.removeWhere((element) => (element.value?.length ?? 0) > 120);
if (fields.length % 2 != 0) {
isOdd = true;
fields.add(new Fields());
}
return Column(
@ -131,7 +135,13 @@ class RequestDetailFragment extends StatelessWidget {
childAspectRatio: (itemWidth / itemHeight),
),
),
if (descriptionFormatView != null) descriptionFormatView,
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: EdgeInsets.zero,
itemBuilder: (cxt, index) => longValueFields[index],
separatorBuilder: (cxt, index) => 16.height,
itemCount: longValueFields.length),
],
).objectContainerView();
return ListView.separated(

@ -53,8 +53,9 @@ class ItemDetailViewGridItem extends StatelessWidget {
final String? type;
final bool isNeedToShowEmptyDivider;
final int maxLine;
final bool showSpaceAfterLine;
ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false, this.type = "", this.maxLine = 6}) : super(key: key);
ItemDetailViewGridItem(this.index, this.title, this.value, {Key? key, this.isNeedToShowEmptyDivider = false, this.showSpaceAfterLine = false, this.type = "", this.maxLine = 6}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -92,7 +93,7 @@ class ItemDetailViewGridItem extends StatelessWidget {
: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine)
: Container(),
],
),
).paddingOnly(top: showSpaceAfterLine ? 16 : 0),
);
}
}

Loading…
Cancel
Save