6

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 3

14

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'),
   ]
  )
)
Sign up to request clarification or add additional context in comments.

2 Comments

can we get in touch, would like to learn flutter,can you help me with it?
@Pranay yeah sure, you can connect me on linkedIN , and I also teach FLUTTER through online classes, if you are interested you can join that too. linkedin.com/in/vicky-salunkhe
1

Replace the Column widget by ListView.

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

Regards

Comments

0

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"),
                  ],
                );
              },
            ),
          ),
        ],
      ),
      ),
   ],
  ),

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.