小编Osa*_*ajm的帖子

如何在flutter中向NavigationRail添加分隔线

我需要在每个之间添加一个分隔线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), …
Run Code Online (Sandbox Code Playgroud)

dart flutter

6
推荐指数
0
解决办法
521
查看次数

标签 统计

dart ×1

flutter ×1