Skip to content

Snappy1

  • Home
  • Android
  • What
  • How
  • Is
  • Can
  • Does
  • Do
  • Why
  • Are
  • Who
  • Toggle search form

[FIXED] android – Flutter listview horizontal + new line

Posted on November 11, 2022 By

Solution 1 :

In this case, you should try Wrap widget in flutter. By default, it will wrap in horizontal direction but if you want to wrap vertically then you can set direction.

Wrap(
  direction: Axis.vertical,
  children: [
    MyWidget(),
    MyWidget(),
    MyWidget(),
    MyWidget(),
    MyWidget(),
  ],
),

With row and column, if there is not enough space then we get the yellow and black overflow warning. But Wrap creates a new adjacent in the respective directive. This will complete your list view requirement.

There are many other options available which you can check here.

Solution 2 :

set property physics in Listview.separated to make the listview not scrollable
And also you need to set the width of the ItemCard() widget

return ListView.separated(physics: NeverScrollablePhysics(),

                separatorBuilder: (BuildContext context, int index) =>
                    const Divider(),
                itemBuilder: (context, index) {
                  return Container(
                    width: //your width size,
                    ItemCard(items[index])
                   );
                },
                scrollDirection: Axis.horizontal,
                itemCount: items.length);

Problem :

I want to implement a horizontal listview in Flutter, but not scrollable. I need it to continue on a new row when the space runs out in the horizontal direction. So far I’ve only got

 return ListView.separated(
                separatorBuilder: (BuildContext context, int index) =>
                    const Divider(),
                itemBuilder: (context, index) {
                  return ItemCard(items[index]);
                },
                scrollDirection: Axis.horizontal,
                itemCount: items.length);

Comments

Comment posted by Darish

why not try grid view?

READ  [FIXED] java - Different UI features for Logged In and Unlogged users
Powered by Inline Related Posts
Android Tags:android, android-layout, flutter

Post navigation

Previous Post: [FIXED] Xamarin.forms – Trouble behaviour between ListView & keyboard
Next Post: [FIXED] android – two elements in linear layout are packed to center instead of to the sides

Related Posts

[FIXED] java – Start activity in another activity in Android Android
[FIXED] java – Constrain layout is not working on all android devices screen size Android
[FIXED] java – Layout of app destroyed while recycling the recyclerview Android
[FIXED] How can I limit the gradient in Android Studio? Android
[FIXED] android – FirebaseUser getCurrentUser bug. Always return previous user id Android
[FIXED] java – How to set On back option for Navigation and Current activity Android

Archives

  • March 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuándo
  • ¿Cuántas
  • ¿Cuánto
  • ¿Qué
  • Android
  • Are
  • At
  • C'est
  • Can
  • Comment
  • Did
  • Do
  • Does
  • Est-ce
  • Est-il
  • For
  • Has
  • Hat
  • How
  • In
  • Is
  • Ist
  • Kann
  • Où
  • Pourquoi
  • Quand
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welchen
  • Welcher
  • Welches
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Who's
  • Why
  • Wie
  • Will
  • Wird
  • Wo
  • Woher
  • you can create a selvedge edge: You can make the edges of garter stitch more smooth by slipping the first stitch of every row.2022-02-04
  • you really only need to know two patterns: garter stitch

Recent Posts

  • Can VPN be traced by police?
  • Where were Kaiser-Frazer cars built?
  • How do you make gold rose gold paint?
  • What are the newest type of dentures?
  • Can you wear joggers as dress pants?

Recent Comments

No comments to show.

Copyright © 2023 Snappy1.

Powered by PressBook Grid Dark theme