我需要在每个之间添加一个分隔线NavigationRailDestination
。里面 NavigationRail
有我们添加的目的地NavigationRailDestination
。
它只接受 type 的孩子NavigationRailDestination
。
我尝试以这种方式执行此操作,但这不是我想要的,有不必要的填充,我无法使用它,并且当我单击它时它会执行操作
这是我的代码:
NavigationRail(
backgroundColor: customTheme.card,
leading: IconButton(
onPressed: () => Navigator.of(context).pop(),
icon: Icon(
FeatherIcons.chevronLeft,
size: 20,
color: theme.colorScheme.onBackground,
)),
selectedIndex: _selectedIndex,
onDestinationSelected: (int index) {
setState(() {
_selectedIndex = index;
controller.animateToPage(index,
duration: const Duration(milliseconds: 250),
curve: Curves.easeInOut);
});
},
labelType: NavigationRailLabelType.selected,
/*------------- Build Tabs -------------------*/
destinations: [
NavigationRailDestination(
icon: const Icon(Icons.dashboard),
selectedIcon: const Icon(Icons.dashboard),
label: FxText.titleSmall('Dashboard',
fontWeight: 500, color: theme.colorScheme.primary),
),
NavigationRailDestination(
icon: Divider(color: Colors.black),
selectedIcon: Divider(color: Colors.black),
label: FxText.titleSmall('',
fontWeight: 100, color: theme.colorScheme.primary),
padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
),
NavigationRailDestination(
icon: const Icon(Icons.tour),
selectedIcon: const Icon(Icons.tour),
label: FxText.titleSmall('Tours',
fontWeight: 600, color: theme.colorScheme.primary),
),
NavigationRailDestination(
icon: const Icon(Icons.flight),
selectedIcon: const Icon(Icons.flight),
label: FxText.titleSmall('Flights',
fontWeight: 600, color: theme.colorScheme.primary),
),
NavigationRailDestination(
icon: const Icon(Icons.hotel),
selectedIcon: const Icon(Icons.hotel),
label: FxText.titleSmall('Hotels',
fontWeight: 600, color: theme.colorScheme.primary),
),
NavigationRailDestination(
icon: Divider(color: Colors.black),
selectedIcon: Divider(color: Colors.black),
label: FxText.titleSmall('',
fontWeight: 100, color: theme.colorScheme.primary),
padding:EdgeInsets.only(top:1,left: 10,right:10,bottom: 1)
),
NavigationRailDestination(
icon: const Icon(Icons.payment),
selectedIcon: const Icon(Icons.payment),
label: FxText.titleSmall('Payments',
fontWeight: 600, color: theme.colorScheme.primary),
),
],
),
Run Code Online (Sandbox Code Playgroud)
这是我想要得到的结果,但图标和分隔线之间没有空间:
归档时间: |
|
查看次数: |
521 次 |
最近记录: |