Flutter: Stepper is not scrolling when added inside ListView

后端 未结 2 1524
轻奢々
轻奢々 2021-01-05 19:19

I have ListView which contains - 1. Banner Image 2. Container with some Text 3. Container with Some more Text 4. Container consist of Stepper.

I\'m unable to scrol

2条回答
  •  我在风中等你
    2021-01-05 19:43

    Found the solution. Stepper is already scroll-able widget, And as i was adding Stepper inside ListView it was becoming Scrollable widget inside another Scrollable widget.

    @FunMiles from Gitter suggested to use NestedScrollView widget instead of ListView & that solved my prob.

    class TestAppHomePage extends StatefulWidget {
      @override
      TestAppHomePageState createState() => new TestAppHomePageState();
    }
    
    class TestAppHomePageState extends State
        with TickerProviderStateMixin {
      ScrollController _scrollController = new ScrollController();
    
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(
            title: new Text('Test Title'),
            elevation: 0.0,
          ),
          body: new NestedScrollView(
            controller: _scrollController,
            headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
              return [
                new SliverList(
                  delegate:new SliverChildListDelegate([
                        new MyContents(),
                        new MyContents(),
                        new MyContents(),
                        new MyContents(),
                  ]),
                ),
              ];
            },
            body: new SimpleWidget(),
          ),
        );
      }
    }
    

提交回复
热议问题