This is my current code:
Widget _buildListItem(BuildContext context, DocumentSnapshot data) {
final record3 = Record3.fromSnapshot(data);
int iconCode = record3.ref;
List<IconData> _iconsDaily = [
Icons.shopping_cart,
Icons.cake_rounded,
Icons.card_giftcard,
Icons.control_point,
];
return Padding(
key: ValueKey(record3.name),
padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: new Container(
child: new ListView(
children: <Widget>[
new Text(
"Daily Goals",
),
new Container(
child: new ListView(
scrollDirection: Axis.horizontal,
children: new List.generate(4, (int index) {
return new Positioned(
child: new DailyButton(
onTap: () {
if (_iconsDaily[index] == Icons.control_point) {
showDialog(
context: context,
builder: (BuildContext context) =>
_buildPopupDialog(context),
);
}
},
iconData: _iconsDaily[index]),
);
}),
),
),
],
),
),
For some reason, it is not showing anything on the app and is throwing a lot of errors such as:
flutter: Another exception was thrown: RenderBox was not laid out: RenderPointerListener#c5f6b relayoutBoundary=up9 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter: Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#72b6b relayoutBoundary=up8 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
flutter: Another exception was thrown: RenderBox was not laid out: RenderPointerListener#37263 relayoutBoundary=up7 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
If I remove the ListView
and <Widget>
then it works fine:
return Padding(
key: ValueKey(record3.name),
child: new Container(
child: new ListView(
scrollDirection: Axis.horizontal,
children: new List.generate(4, (int index) {
return new Positioned(
child: new DailyButton(
onTap: () {
if (_iconsDaily[index] == Icons.control_point) {
showDialog(
context: context,
builder: (BuildContext context) =>
_buildPopupDialog(context),
);
}
},
iconData: _iconsDaily[index]),
);
}),
),
),
However, I don't want to remove these as I am not too sure how I to then add more features like Text
and Container
. Any help would be appreciated!