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 ? LocaleKeys.noDataAvailable.tr().toText16().center
: ListView( : ListView(
shrinkWrap: true, shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: uiList, children: uiList,
), ),
), ),
@ -73,26 +74,29 @@ class RequestDetailFragment extends StatelessWidget {
List<Fields> fields = List.from(fieldsF); List<Fields> fields = List.from(fieldsF);
bool isOdd = false; bool isOdd = false;
List<Widget> longValueFields = [];
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) { if (fields.length % 2 != 0) {
isOdd = true; isOdd = true;
fields.add(new Fields()); 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);
descriptionFormatView = ItemDetailViewGridItem(
2,
descriptionFormat.title,
descriptionFormat.value == null ? (descriptionFormat.multipleValue?.join(", ") ?? "") : descriptionFormat.value ?? "",
type: descriptionFormat.type,
maxLine: 0,
);
}
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -131,7 +135,13 @@ class RequestDetailFragment extends StatelessWidget {
childAspectRatio: (itemWidth / itemHeight), 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(); ).objectContainerView();
return ListView.separated( return ListView.separated(

@ -53,8 +53,9 @@ class ItemDetailViewGridItem extends StatelessWidget {
final String? type; final String? type;
final bool isNeedToShowEmptyDivider; final bool isNeedToShowEmptyDivider;
final int maxLine; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -92,7 +93,7 @@ class ItemDetailViewGridItem extends StatelessWidget {
: (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine) : (value!.isEmpty ? "--" : value).toString().toText12Auto(color: MyColors.normalTextColor, maxLine: maxLine)
: Container(), : Container(),
], ],
), ).paddingOnly(top: showSpaceAfterLine ? 16 : 0),
); );
} }
} }

Loading…
Cancel
Save