Saly Glowner
Saly Glowner

Reputation: 63

Manage two Listview, to keep the first one showing when the user wants to scroll down to view the second listview items, Flutter

may i ask how to force the first Horizontal Listview Showing when i scroll the another Vertical Listview. This is My Screen

Screen

when i scrolling Down to view the Vertical Listview, the Second one to view the items. Then this happens

Scrolling Down

So the user can't see the First Horizontal ListView any more , he must to go up to view it. and this is my problem, i want that the Horizontal Listview to keep showing when the user scrolled the Vertical Listview Items down.

Thanks in Advance.

home: Scaffold(
        appBar: AppBar(
          title: Text(title),
        ),
        body: Container(
          child: ListView(
            shrinkWrap: true,
            children: [
              Container(
                color: Colors.white,
                margin: EdgeInsets.symmetric(vertical: 20.0),
                height: 200.0,
                child: ListView(... ), // Horizontal ListView
              ),
              Expanded(
                child: Container(
                    child: ParseLocal(), // Vertical ListView
                ),
              ),
            ],
          ),
        ),
      ),

Upvotes: 0

Views: 585

Answers (1)

John Joe
John Joe

Reputation: 12803

You don't need to wrap two widget with ListView since your two widgets is ListView.

home: Scaffold(
        appBar: AppBar(
          title: Text(title),
        ),
        body: Container(
          child: ListView(  // <--this can be removed
            shrinkWrap: true,
            children: [
              Container(
                color: Colors.white,
                margin: EdgeInsets.symmetric(vertical: 20.0),
                height: 200.0,
                child: ListView(... ), // Horizontal ListView
              ),
              Expanded(
                child: Container(
                    child: ParseLocal(), // Vertical ListView
                ),
              ),
            ],
          ),
        ),
      ),

Upvotes: 2

Related Questions