how to scroll outer scrollview when inner scrollview reaches to the end in flutter?

大憨熊 提交于 2019-12-11 14:52:36

问题


I have a SingleChildScrollView as a child widget inside its parent SingleChildScrollView widget as in the image below,

Currently when I scroll down the touching area in the inner scrollview, the inner scrollview scrolls down and nothing moves when it reaches the bottom.

But I want the whole screen(outer scrollview) starts scrolling when the inner scrollview reaches the bottom as below. (It doesn't matter if I have to tap again in order to scroll the outer scrollview)

How could I achieve the behaviour ?

edit

please see my code below:

class ExampleState extends State<Example> {
   String title = "text text text text texwtxtwtwxtx wtxwtxwtwtxt";
   String description = "textexxtett t exte tx tetexxt text text text";

   @override
   Widget build(BuildContext context) {
      return Scaffold(
             body: SingleChildScrollView(
                   child: ConstrainedBox(
                          constraints: BoxConstraints(
                          minHeight: MediaQuery.of(context).size.height,
                          ),
                          child: Column(
                                 mainAxisSize: MainAxisSize.min, 
                                 children: [
                                           ConstrainedBox(
                                           constraints: BoxConstraints(
                                           minHeight: MediaQuery.of(context).size.height * 0.15,
                                           maxHeight: MediaQuery.of(context).size.height * 0.30,
              ),
                                           child: Container(
                                                  padding: EdgeInsets.fromLTRB(25, 0, 25, 25),
                                                  child: SingleChildScrollView(child: Column(
                                                         children: [
                                                     Text("$title\n"),
                                                  Text("$description")
                                                  ]))))]))));}},

来源:https://stackoverflow.com/questions/56916868/how-to-scroll-outer-scrollview-when-inner-scrollview-reaches-to-the-end-in-flutt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!