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

how to create horizontal listview builder in flutter?

hi I have Row in flutter and I want add some widget on row with listview.builder, listview sort all item vertically. but I want show them horizontally. in the image below you can see my code and the result.so how can i change the listview.builder to horizontal?
enter image description here

>Solution :

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

You need set height for your ListView if you want to use it horizontally, and set scrollDirection to Axis.horizontal:

Row(
        children: [
          IconButton(onPressed: () {}, icon: Icon(Icons.chevron_left)),
          Expanded(
              child: SizedBox(
            height: 10,
            child: ListView.builder(
              scrollDirection: Axis.horizontal,
              itemBuilder: (context, index) {
                return Container(
                  margin: EdgeInsets.symmetric(horizontal: 12),
                  height: 10,
                  width: 10,
                  color: Colors.red,
                );
              },
              itemCount: 10,
            ),
          )),
          IconButton(onPressed: () {}, icon: Icon(Icons.chevron_right)),
        ],
      ),
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