user9846301
user9846301

Reputation:

Another exception was thrown: A RenderFlex overflowed by 265 pixels on the right on Flutter

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

Upvotes: 1

Views: 298

Answers (2)

Abhay Koradiya
Abhay Koradiya

Reputation: 2117

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

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

Upvotes: 2

lazos
lazos

Reputation: 1075

Use ListView instead of Row

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

...

Upvotes: 1

Related Questions