Home > Software design >  How do I make the widget run sequentially in flutter?
How do I make the widget run sequentially in flutter?

Time:04-24

I have the following code written in a flutter I want to make the pieces run in order (from 1 to the last piece) See the comment on line 34, how can I Do ?

        ....
          SingleChildScrollView(
                    scrollDirection: Axis.horizontal,
                    child: _clipsWidget(),    // <<< I want to write a code here that allows widgets (widget 1-widget 2....) to be executed in an orderly and sequential manner
                  ),
                ],
              ),
            ),
          ),
        ],
      ),
    );
  }

Widget _clipsWidget1() {
      return Container(
      height: 250,
      margin: const EdgeInsets.symmetric(horizontal: 16),
      child: Row(
        children: <Widget>[
         
          Column(
            children: <Widget>[
              Container(
          ....
              ),
              SizedBox(height: 20),
              Container(
           ....
              ),
 
  }
  Widget _clipsWidget2() {.....}
  
  Widget _clipsWidget3() {.....}
  
  Widget _clipsWidget4() {.....}

CodePudding user response:

To have multiple widgets arranged below each other, you can use a Row widget:

SingleChildScrollView(
  scrollDirection: Axis.horizontal,
  child: Row(
   children: [
     _clipsWidget1(),
     _clipsWidget2(),
     _clipsWidget3(),
     _clipsWidget4()
   ]
  )
)

CodePudding user response:

Does having to be shown sequentially over time mean that we need animations? Then you should use AnimatedList -> https://api.flutter.dev/flutter/widgets/AnimatedList-class.html

  • Related