Home > database >  How the listview content horizontally without looking over flutter?
How the listview content horizontally without looking over flutter?

Time:09-05

I need to show the listview content horizontally without looking over it. I maintain that the substance should be on a new line when the width is full. how might I do that?

CodePudding user response:

I think you're looking for Wrap, use it with a SingleChildScrollView like so:

SingleChildScrollView(
  child: Wrap(
    children: [
      // your children.
    ]
  )
)

CodePudding user response:

You can use aspect ratio to make a horizontally listview. An example starting code;

  Widget buildCard({
    required CardItem item,
  }) =>
      Container(
        width: 200,
        child: Column(
          children: [
            Expanded(
              child: AspectRatio(
                aspectRatio: 4 / 3,
                ...
                
          

  • Related