I'm still very new to flutter and I'm trying to create a comment list section where the child comment can be nested in the parent comment.
What I did was create a ListView inside a dynamic ListView in this case I used a 3rd party library PagewiseListView for lazy loading. But there was some error in building the List.
@override
Widget build(BuildContext context) {
return Scaffold(
body: pageWiseBuilder(context, _story.kids ?? [], PAGE_SIZE),
);
}
Widget pageWiseBuilder(BuildContext context, List<int> list, int pageSize) {
if (list != null && list.length > 0) {
return PagewiseListView(
padding: EdgeInsets.all(15.0),
pageSize: pageSize,
itemBuilder: this.itemBuilder,
pageFuture: (pageIndex) =>
_repository.fetchComments(list, pageIndex * pageSize, pageSize),
);
} else {
return Container();
}
}
Widget itemBuilder(BuildContext context, Comment entry, int index) {
return Column(
children: <Widget>[
ListTile(
title: Text(entry.by ??= ""),
subtitle: Html(
data: unescape.convert(entry.text ??= ""),
useRichText: true,
onLinkTap: (url) {
_launchURL(url);
},
showImages: true,
renderNewlines: true,
),
),
Divider(),
Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: SizedBox(height: 200.0,
child: ListView.builder(
physics: ClampingScrollPhysics(),
shrinkWrap: true,
itemCount: 5,
itemBuilder: (context, index) {
return Padding(
padding: EdgeInsets.only(top: 8.0),
child: Text('Nested list item $index'),
);
},
),
),
),
],
),
],
);
}
I/flutter ( 885): Another exception was thrown: RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter ( 885): Another exception was thrown: RenderBox was not laid out: RenderFlex#a1031 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 885): Another exception was thrown: RenderBox was not laid out: RenderFlex#11980 relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 885): Another exception was thrown: RenderFlex children have non-zero flex but incoming height constraints are unbounded.
I/flutter ( 885): Another exception was thrown: RenderBox was not laid out: RenderFlex#a33b5 relayoutBoundary=up6 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 885): Another exception was thrown: RenderBox was not laid out: RenderFlex#48c2a relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 885): Another exception was thrown: RenderBox was not laid out: RenderRepaintBoundary#d6726 relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter ( 885): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 549 pos 12: 'child.hasSize': is not true.
I/flutter ( 885): Another exception was thrown: NoSuchMethodError: The method '>' was called on null.
I/flutter ( 885): Another exception was thrown: 'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 549 pos 12: 'child.hasSize': is not true.