Files
pipelines/app/lib/shell/destination.dart
T
alan 9bdabb32d9 Remove Cupertino shell branches
Keep the Material-only shell path while preserving public cupertino parameters for callers. Narrow matching tests to Material hosts and behavior because the app always runs under MaterialApp.
2026-11-11 03:48:41 +00:00

56 lines
1.7 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum AppDestination { pipelines, runs, chat, search, settings }
/// The destinations the shell's tab bar offers, in order. Settings is a
/// destination the shell can show (its route is `/settings`), but it opens
/// as a page from the Pipelines bar's gear instead of being a tab.
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].
///
/// [cupertinoIcon] is retained in the record for callers that still read it;
/// the shell itself draws [icon] on its Material path.
({String label, IconData icon, IconData cupertinoIcon}) destinationDetails(
AppDestination value,
) => switch (value) {
AppDestination.pipelines => (
label: 'Pipelines',
icon: Icons.account_tree_outlined,
cupertinoIcon: CupertinoIcons.arrow_branch,
),
AppDestination.runs => (
label: 'Runs',
icon: Icons.play_circle_outline,
cupertinoIcon: CupertinoIcons.play_circle,
),
AppDestination.chat => (
label: 'Chat',
icon: Icons.chat_bubble_outline,
cupertinoIcon: CupertinoIcons.chat_bubble_2,
),
AppDestination.search => (
label: 'Search',
icon: Icons.search,
cupertinoIcon: CupertinoIcons.search,
),
AppDestination.settings => (
label: 'Settings',
icon: Icons.settings_outlined,
cupertinoIcon: CupertinoIcons.gear,
),
};