DesignAdaptiveShell.branches constructor

const DesignAdaptiveShell.branches({
  1. Key? key,
  2. required List<DesignNavigationDestination> destinations,
  3. required int selectedIndex,
  4. required ValueChanged<int>? onDestinationSelected,
  5. required DesignDestinationBuilder destinationBuilder,
  6. required DesignNavigationBuilder navigationBuilder,
  7. required List<WidgetBuilder> branches,
  8. List<GlobalKey<NavigatorState>>? navigatorKeys,
  9. DesignBranchBackBehavior backBehavior = DesignBranchBackBehavior.firstDestination,
  10. DesignNavigationMode? mode,
  11. bool showNavigation = true,
  12. double dampingRatio = 1,
  13. double stiffness = 700,
})

A shell whose body is one Navigator per destination, each starting on its branches root page, built when first shown and kept: each keeps its own stack. Choosing the selected destination again pops it to its root. Back (Android's, Escape's route pop) pops the selected branch, then at its root goes where backBehavior says, then leaves.

DesignAdaptiveShell.branches(destinations: const [DesignNavigationDestination(label: 'Home', icon: IconData(0xe318)), DesignNavigationDestination(label: 'Mail', icon: IconData(0xe158))], selectedIndex: 0, onDestinationSelected: (index) {}, destinationBuilder: (context, destination, details) => Text(destination.label), navigationBuilder: (context, details) => Row(children: details.destinations), branches: [(context) => const Text('Home'), (context) => const Text('Mail')])

Implementation

const DesignAdaptiveShell.branches({
  super.key,
  required this.destinations,
  required this.selectedIndex,
  required this.onDestinationSelected,
  required this.destinationBuilder,
  required this.navigationBuilder,
  required List<WidgetBuilder> this.branches,
  this.navigatorKeys,
  this.backBehavior = DesignBranchBackBehavior.firstDestination,
  this.mode,
  this.showNavigation = true,
  this.dampingRatio = 1,
  this.stiffness = 700,
}) : body = null,
     assert(dampingRatio > 0 && stiffness > 0);