Reputation: 22906
Idea is to put a ListView.builder
and an Image
together side by side horizontally.
So, I put the ListView.builder
and the Image
in a Row.
This Row
is inside a ListView
which has other children too.
The problem is that before I introduced the Row
, the ListView.builder
was showing up properly. Now with Row
, ListView.builder
and an Image
are NOT being shown.
There are no errors, just the contents are invisible.
Row(
children: <Widget>[
ListView.builder
(
shrinkWrap: true,
physics: ClampingScrollPhysics(),
itemCount: list3.length,
itemBuilder: (BuildContext ctxt, int Index)
{
return new ListView
(
shrinkWrap: true,
padding: const EdgeInsets.all(1),
children: <Widget>
[
ListTile(
leading: CircleAvatar(
radius: 6.0,
backgroundColor: Colors.black,
),
title : Text(list3[Index], style: TextStyle(color: Colors.red, fontSize: 25,),)
),
]
);
},
),
Expanded(
child: Image(
image: NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg'),
height: 15,
width: 15,
fit: BoxFit.cover,
)
),
],
),
Upvotes: 1
Views: 4409
Reputation: 12934
The ListView
is inside a Row
and needs a width, so that the other element can expand in the remaining area. So wrap it inside a SizedBox
.
SizedBox(
width: 300,
child: ListView.builder(),
)
Upvotes: 1