How to scroll page in flutter

后端 未结 9 1229
情话喂你
情话喂你 2021-01-30 20:05

My code for a page is like this. i need to scroll part below appbar.

@override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new          


        
9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-30 20:18

    Use LayoutBuilder and Get the output you want

    Wrap the SingleChildScrollView with LayoutBuilder and implement the Builder function.

    we can use a LayoutBuilder to get the box contains or the amount of space available.

    LayoutBuilder(
        builder: (BuildContext context, BoxConstraints constraints){
          return SingleChildScrollView(
            child: Stack(
              children: [
                Container(
                  height: constraints.maxHeight,
                ),
                topTitle(context),
                middleView(context),
                bottomView(context),
              ],
            ),
          );
        }
    )
    

提交回复
热议问题