【问题标题】:Flutter | Text on top of bottom navigation bar screens颤振 |底部导航栏屏幕顶部的文本
【发布时间】:2021-11-02 10:35:26
【问题描述】:

我有bottom navigation 菜单项,我成功地通过页面进行了更改。我想要 在屏幕顶部添加一个文本小部件。如下代码所示

body: _kTabPages[_currentTabIndex],
bottomNavigationBar: bottomNavBar,

然后我把它改成了这个,

body: 
      Column(
        children: [
          Text('Hello Text'),
          _kTabPages[_currentTabIndex],
        ],
      ),
     
      bottomNavigationBar: bottomNavBar,

但是现在页面正在消失,我只剩下顶部的文本,底部的导航项,以及页面应该去的中间的空白屏幕。出现错误:

bottom overflowed by infinity pixels

【问题讨论】:

    标签: flutter flutter-layout


    【解决方案1】:

    this 我设法找到了通过 Expanded 包裹屏幕的解决方案,所以我现在的答案是

    body:
          Column(
            children: [
              Text('Hello Text'),
              Expanded(child: _kTabPages[_currentTabIndex]),
            ],
          ),
    
          bottomNavigationBar: bottomNavBar,
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-13
      • 2020-03-06
      相关资源
      最近更新 更多