为什么sliverlist在我的customrollroll视图中不起作用?

戴维·塔博拉(Deyvi Tabora)

我正在尝试添加一个白名单,但是它对我不起作用,我对使用flutter非常陌生,我感到困惑。

@override
Widget build(BuildContext context) {
return Scaffold(
  body: const CustomScrollView(
    slivers: <Widget>[
      SliverAppBar(
        title: Text('Sample Slivers'),
        leading: Icon(Icons.menu),
        backgroundColor: Colors.orangeAccent,
        expandedHeight: 90.0,
        floating: true,
        pinned: true,
        snap: false,
      ),
      SliverList(
        delegate: SliverChildBuilderDelegate((context) {}),
      )
    ],
  ),
  bottomNavigationBar: _navigatorAppBar(),
  floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
  floatingActionButton: _buildFab(),
);
}
}

img

莫比纳
  1. 删除的const关键字CustomScrollView

  2. 替换SliverChildBuilderDelegate((context) {})为:

SliverChildBuilderDelegate((context, index) {})

完整代码:

@override
Widget build(BuildContext context) {
return Scaffold(
  body: CustomScrollView(
    slivers: <Widget>[
      SliverAppBar(
        title: Text('Sample Slivers'),
        leading: Icon(Icons.menu),
        backgroundColor: Colors.orangeAccent,
        expandedHeight: 90.0,
        floating: true,
        pinned: true,
        snap: false,
      ),
      SliverList(
        delegate: SliverChildBuilderDelegate((context, index) {}),
      )
    ],
  ),
  bottomNavigationBar: _navigatorAppBar(),
  floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
  floatingActionButton: _buildFab(),
);
}

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么多重继承在Django视图中不起作用?

来自分类Dev

ScrollView在我的视图中不起作用

来自分类Dev

为什么我的局部视图不起作用?

来自分类Dev

为什么我的地图函数返回视图不起作用?

来自分类Dev

为什么Html.Hidden在C#ASP.NET MVC剃刀视图中不起作用?

来自分类Dev

为什么Vue .sync命令在路由器视图中不起作用?

来自分类Dev

为什么检索到的mongodb数据的if / else在Jade视图中不起作用

来自分类Dev

Layout_below在我的列表视图中不起作用

来自分类Dev

Layout_below在我的列表视图中不起作用

来自分类Dev

为什么我的printf不起作用?

来自分类Dev

为什么我的列表不起作用?

来自分类Dev

为什么我的for循环不起作用?

来自分类Dev

为什么我的代码不起作用?

来自分类Dev

为什么getchar()对我不起作用?

来自分类Dev

为什么我的排序不起作用?

来自分类Dev

为什么我的递归不起作用?

来自分类Dev

为什么我的线程不起作用?

来自分类Dev

为什么我的ItemListener不起作用?

来自分类Dev

为什么我的OpenGL不起作用?

来自分类Dev

为什么我的if(-f)不起作用?

来自分类Dev

为什么我的测试不起作用?

来自分类Dev

为什么我的阵列不起作用?

来自分类Dev

为什么我的lambda不起作用?

来自分类Dev

为什么我的setOnKeyListener()不起作用?

来自分类Dev

为什么我的菜单不起作用?

来自分类Dev

为什么我的TTS不起作用?

来自分类Dev

为什么我的延误不起作用?

来自分类Dev

为什么我的排序不起作用?

来自分类Dev

为什么我的模态不起作用?