Expanded(
                child: Container(
                  width: double.maxFinite,
                  decoration: const BoxDecoration(
                    color: Color(0xffF5f5f5),
                    borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(25),
                      topRight: Radius.circular(25),
                    ),
                  ),
                  child: Column(
                    children: [
                      Padding(
                        padding:
                            const EdgeInsets.only(left: 20, top: 25, right: 20),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text(
                              "Rekomendasi Untukmu",
                              style: TextStyle(
                                color: Colors.black,
                                fontSize: 15,
                                fontWeight: FontWeight.bold,
                              ),
                            ),
                            Icon(
                              Icons.more_horiz,
                              color: Colors.black,
                            ),
                          ],
                        ),
                      ),
                      //listview here my problem
                      ListView(
                        shrinkWrap: true,
                        scrollDirection: Axis.horizontal,
                      ),
                    ],
                  ),
                ),
              ),

i was try to make horizontal list view inside column, but i had an error. i was try to use shrinkwrap inside list view

     shrinkWrap: true, // use this

but it didnt work. Then i try make sizebox to fix height

SizedBox(
      height: 400, // fixed height
      child: ListView(...),

but still error. then i try make expanded for list view

children: <Widget>[
    Expanded( // wrap in Expanded
      child: ListView(...),

but still error.


Solution 1: john

horizontal listView doesnt work. Use Row with SingleChildScrollView instead.

SingleChildScrollView(
scrollDirection: Axis.horizontal,
    physics: const BouncingScrollPhysics(),
    child: Row(children: [
    //your list here

    ])
)