77a88d09d3
Show Back only when Settings is reached through a pushed route, and remove duplicate Settings controls where the shell already provides navigation. Update focused widget coverage and document the destination behavior.
40 lines
1.4 KiB
Dart
40 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
enum AppDestination { pipelines, runs, chat, search, settings }
|
|
|
|
/// The tabs the shell's floating tab bar (or, on a wide window, its rail) offers,
|
|
/// in order. Settings is a destination the shell can show (its route is
|
|
/// `/settings`) and the rail and phone bar offer it too; it is a page of the
|
|
/// Pipelines tab, not a tab. Only the floating bar's width leaves Settings to
|
|
/// the Pipelines bar's gear.
|
|
const List<AppDestination> shellTabDestinations = [
|
|
AppDestination.pipelines,
|
|
AppDestination.runs,
|
|
AppDestination.chat,
|
|
AppDestination.search,
|
|
];
|
|
|
|
/// The tab that owns [destination] in the tab bar: itself, or Pipelines for
|
|
/// Settings (reached from the Pipelines bar).
|
|
AppDestination shellTabFor(AppDestination destination) =>
|
|
shellTabDestinations.contains(destination)
|
|
? destination
|
|
: AppDestination.pipelines;
|
|
|
|
/// The label and icons for [value].
|
|
///
|
|
({String label, IconData icon}) destinationDetails(AppDestination value) =>
|
|
switch (value) {
|
|
AppDestination.pipelines => (
|
|
label: 'Pipelines',
|
|
icon: Icons.account_tree_outlined,
|
|
),
|
|
AppDestination.runs => (label: 'Runs', icon: Icons.play_circle_outline),
|
|
AppDestination.chat => (label: 'Chat', icon: Icons.chat_bubble_outline),
|
|
AppDestination.search => (label: 'Search', icon: Icons.search),
|
|
AppDestination.settings => (
|
|
label: 'Settings',
|
|
icon: Icons.settings_outlined,
|
|
),
|
|
};
|