How to create scrollable row in flutter

Viewed 2198

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"),
          ],
       ),
      ),
   ],
  ),
3 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'),
   ]
  )
)

Something like this ?

new Column(
    children: [
     new Container(
         height: 100.0,
         child: Expanded(
            child: ListView.builder(
              shrinkWrap: true,
              itemBuilder: (context,int){
                return Container(
                  child: Row(
                      children: <Widget>[
                        new Text("text 1"),
                        new Text("text 2"),
                        new Text("text 3"),
                  ],
                );
              },
            ),
          ),
        ],
      ),
      ),
   ],
  ),
Related