buildNavigationRail method

Widget buildNavigationRail(
  1. BuildContext context,
  2. int index
)

Implementation

Widget buildNavigationRail(BuildContext context, int index) => Column(
      mainAxisSize: MainAxisSize.max,
      children: [
        const Gap(5),
        if (Navigator.canPop(context))
          SafeArea(
              top: true,
              child: GhostButton(
                  density: ButtonDensity.icon,
                  child: context.inSheet
                      ? const Icon(Icons.x_bold)
                      : const Icon(Icons.caret_left_bold),
                  onPressed: () => Arcane.pop(context))),
        ...tabs
            .mapIndexed((tab, railIndex) => switch (tab) {
                  NavTab tab => IconButton(
                      icon: Icon(
                          railIndex == index
                              ? (tab.selectedIcon ?? tab.icon)
                              : tab.icon,
                          color: railIndex == index
                              ? Theme.of(context).colorScheme.primary
                              : null),
                      onPressed: index == railIndex
                          ? null
                          : () => onIndexChanged?.call(railIndex),
                    ),
                  NavItem item => item.builder(context),
                })
            .toList(),
      ],
    ).padTop(railTopPadding);