小编Mou*_*abr的帖子

Flutter:检测到滚动时隐藏和显示应用栏

我在应用栏动画方面遇到问题,我SilverAppBar在我的应用中使用, 。所以,问题是当我在我的列表中间并向上滚动时,应用栏不会出现,但它会在滚动到达项目列表顶部时出现。我已经测试了snap参数并给出了它true,但不是我期望的结果。我有为此创建自定义动画的想法,但我在 Flutter 方面经验不足,而且如果有一种方法可以添加参数或其他适合我的情况的小部件,那就太好了。

我正在使用的演示的实际代码:

  Widget _search() => Container(
        color: Colors.grey[400],
        child: SafeArea(
            child: Container(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: TextField(
              enabled: false,
              style: TextStyle(fontSize: 16, color: Colors.white),
              decoration: InputDecoration(
                prefix: SizedBox(width: 12),
                hintText: "Search",
                contentPadding:
                    EdgeInsets.symmetric(horizontal: 32.0, vertical: 14.0),
                border: InputBorder.none,
              ),
            ),
          ),
        )),
      );

  Container _buildBody() {
    return Container(
        child: new GridView.count(
      crossAxisCount: 2,
      children: List.generate(100, (index) {
        return Center(
          child: Text(
            'Item $index',
            style: Theme.of(context).textTheme.headline,
          ),
        );
      }),
    )); …
Run Code Online (Sandbox Code Playgroud)

animation scroll appbar flutter

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

animation ×1

appbar ×1

flutter ×1

scroll ×1