I am new in Flutter. How to apply a Horizontal scroll view in Row. Please give me a solution if it works then I accept your answer Anyone here with a solution for this? Thanks in Advance. Here is my code.

  Row(
            // crossAxisAlignment: CrossAxisAlignment.start,
            children: categoryData.map((i) {
              print('i====>>>>>>>>>>>>>>>>>.${i['name']}');
              scrollDirection:
              Axis.horizontal;
              return FlatButton(
                color: Colors.blue,
                textColor: Colors.white,
                disabledColor: Colors.grey,
                disabledTextColor: Colors.black,
                padding: EdgeInsets.all(8.0),
                splashColor: Colors.blueAccent,
                onPressed: () {
                  /*...*/
                },
                child: Text(
                  '${i['name']}',
                  style: TextStyle(fontSize: 12.0),
                ),
              );
            }).toList(),
          ),

enter image description here


Solution 1: lazos

Use ListView instead of Row

ListView(
      scrollDirection: Axis.horizontal,
      children: <Widget>[
         FlatButton(...),
         FlatButton(...),
         FlatButton(...),
      ],
    )

...


Solution 2: Abhay Koradiya

There is no argument scrollDirection in Row. Put scrollview on top of ROW. Like

SingleChildScrollView(
  scrollDirection: Axis.horizontal,
  child: Row(.....),
)