【问题标题】:Flutter hide title of Silver app bar when expanded展开时 Flutter 隐藏 Silver 应用栏的标题
【发布时间】:2021-01-23 11:08:43
【问题描述】:

我在我的 Flutter 应用上实现了一个带有背景图片的银色应用栏。当银色应用栏处于展开模式时,我想隐藏银色应用栏的标题。我只想在标题折叠时显示标题我该如何实现这种行为?

SliverAppBar(
            expandedHeight: 250.0,
            floating: false,
            pinned: true,
            title: Text("Coporate News"),
            elevation: 8,
            flexibleSpace: FlexibleSpaceBar(
                centerTitle: true,
                title: Text(""),
                background: Stack(
                  children: [
                    Container(
                      height: 400,
                      child: Image.network(
                        news['url'],
                        fit: BoxFit.cover,
                      ),
                    ),        
     .......

【问题讨论】:

    标签: flutter


    【解决方案1】:

    您必须将pinned 属性设置为false:

    SliverAppBar(
                expandedHeight: 250.0,
                floating: false,
                pinned: false,
                title: Text("Coporate News"),
                elevation: 8,
                flexibleSpace: FlexibleSpaceBar(
                    centerTitle: true,
                    title: Text(""),
                    background: Stack(
                      children: [
                        Container(
                          height: 400,
                          child: Image.network(
                            news['url'],
                            fit: BoxFit.cover,
                          ),
                        ),        
         .......
    

    【讨论】:

    • 这没有帮助。
    猜你喜欢
    • 2018-06-06
    • 2018-11-18
    • 2014-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-31
    • 1970-01-01
    相关资源
    最近更新 更多