1

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,
                                                  )
                                                ),
                                          ],
                                        ),  

2 Answers 2

3

Wrap your ListView.builder with Expanded.

Sign up to request clarification or add additional context in comments.

Comments

1

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(),
)

1 Comment

Thanks to you too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.