Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

AssertionError ('package:flutter/src/rendering/viewport.dart': Failed assertion: line 1874 pos 16: 'constraints.hasBoundedHeight': is not true.)

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

but still error.

>Solution :

horizontal listView doesnt work. Use Row with SingleChildScrollView instead.

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading