0

我有一个带有抽屉的窗格应用程序,当手机处于横向模式时,我会在窗格布局中显示它:

在此处输入图像描述

为了不在页面之间为抽屉设置动画,我将其放入Hero.

class SomePage extends Stateless Widget {
   Widget build(BuildContext context) {
    return Row(
       children: <Widget>[
         Hero(
           child: Material(
              elevation: 4.0,
              child: MyDrawer(),
              tag: "drawer",
           ),
           Expanded(
             child: Scaffold(
               appBar: ...,
               body: ...
             )
           ),
        ],
    );
  }
}

抽屉包含一个 CustomScrollView。

当用户使用Navigator.pushNamed(我使用MaterialAppwith onGenerateRoute)更改页面时,CustomScrollView 的滚动位置被重置。

如何在页面更改之间保持滚动位置(或者如何在不同页面上同步抽屉的滚动位置)?

4

0 回答 0