Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create scrollable row in flutter

Tags:

layout

flutter

i tried creating scrollable row in flutter

but after trying multiple methods in some i am facing issue of height being fixed or list is not scrolling

posting one of the code i tried.

looking forward for a way where i can scroll in a row and don't need to fix a height for the widget.

new Column(
    children: [
     new Container(
         height: 100.0,
         child: ListView(
            scrollDirection: Axis.horizontal,
              children: <Widget>[
                new Text("text 1"),
                new Text("text 2"),
                new Text("text 3"),
          ],
       ),
      ),
   ],
  ),
like image 903
Pranay Avatar asked Aug 29 '26 19:08

Pranay


2 Answers

I have already answered somewhat related question where you don't need to give a fix height to the widgets and your widgets can scroll in horizontal direction

you can check it here

https://stackoverflow.com/a/51937651/9236994

TIP: Use SingleChildScrollView widget

SingleChildScrollView(
  scrollDirection: Axis.horizontal,
  child: Row(
   children: <Widget>[
     Text('hi'),
     Text('hi'),
     Text('hi'),
   ]
  )
)
like image 123
Vicky Salunkhe Avatar answered Sep 01 '26 14:09

Vicky Salunkhe


Replace the Column widget by ListView.

You can take a look at https://api.flutter.dev/flutter/widgets/ListView-class.html

Regards

like image 30
Herllon Cardoso Avatar answered Sep 01 '26 12:09

Herllon Cardoso



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!