Flutter 将尾部小部件推到颤振导航导轨的底部
如何将颤振导航导轨内的尾部部件推到导轨底部?我原以为这就像用扩展的小部件包装尾部小部件一样简单,但我得到了通常的颤振“需要绘制”错误消息 如果我添加一个列,其中第一个子项为SizedBox,具有固定高度,然后是我想要显示的小部件,我可以让它工作,但我需要“间隔符”来填充可用空间,而不是固定高度。下面是SizedBox示例,它确实填充了200px的空间,但是如何让它填充可用空间呢Flutter 将尾部小部件推到颤振导航导轨的底部,flutter,Flutter,如何将颤振导航导轨内的尾部部件推到导轨底部?我原以为这就像用扩展的小部件包装尾部小部件一样简单,但我得到了通常的颤振“需要绘制”错误消息 如果我添加一个列,其中第一个子项为SizedBox,具有固定高度,然后是我想要显示的小部件,我可以让它工作,但我需要“间隔符”来填充可用空间,而不是固定高度。下面是SizedBox示例,它确实填充了200px的空间,但是如何让它填充可用空间呢 // other navrail properties.... trailing: Column(
// other navrail properties....
trailing: Column(
children: [
SizedBox(
height: 200,
),
IconButton(icon: Icon(Icons.settings), onPressed: () {})
],
),
我找到了一个解决方案(或变通方法):
将NavigationRail
和定位的小部件放入堆栈中
:
Scaffold(
body: Row(
children: [
Stack(
children: [
NavigationRail(
selectedIndex: _selectedIndex,
extended: Styling.isLargeScreen(context),
destinations: _destinations
.map((d) => d.toNavigationDestination)
.toList(),
onDestinationSelected: (index) => _onItemTapped(index),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
color: Colors.amber,
height: 100,
),
)
],
),
Expanded(
child: _buildPage(_destinations.elementAt(_selectedIndex).key),
),
],
),
);
希望它能很快得到修复 我找到了一个解决方案(或变通方法):
将NavigationRail
和定位的小部件放入堆栈中
:
Scaffold(
body: Row(
children: [
Stack(
children: [
NavigationRail(
selectedIndex: _selectedIndex,
extended: Styling.isLargeScreen(context),
destinations: _destinations
.map((d) => d.toNavigationDestination)
.toList(),
onDestinationSelected: (index) => _onItemTapped(index),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
color: Colors.amber,
height: 100,
),
)
],
),
Expanded(
child: _buildPage(_destinations.elementAt(_selectedIndex).key),
),
],
),
);
希望它能很快得到修复 不幸的是你不能!一种方法是复制NavigationRail代码并调整尾随部分,以便将其展开。哇,真是一种痛苦。我可能正在考虑提交我的第一个功能请求!我试过,直到我意识到这是不可能的。你找到解决办法了吗?不幸的是你找不到!一种方法是复制NavigationRail代码并调整尾随部分,以便将其展开。哇,真是一种痛苦。我可能正在考虑提交我的第一个功能请求!我试过,直到我意识到这是不可能的。你找到解决办法了吗?