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.
This commit is contained in:
2026-11-11 03:48:41 +00:00
parent baac6eca9a
commit 9bdabb32d9
33 changed files with 1646 additions and 2326 deletions
+19 -55
View File
@@ -1,10 +1,8 @@
import '../ui/motion/fade_through_stack.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/floating_destination_bar.dart';
import 'attention_badge.dart';
import 'destination.dart';
@@ -37,6 +35,9 @@ class AdaptiveShell extends StatefulWidget {
final ListPaneWidthStore listPaneWidthStore;
final Map<AppDestination, WidgetBuilder> destinationBodies;
/// Retained for callers that still pass it; the shell always draws the
/// Material controls and scaffold whether this is set or not.
final bool cupertino;
/// The destination a route owner selected. When null the shell keeps its own
@@ -120,7 +121,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
key: const ValueKey('shell.badge.chat.unread'),
count: _bar.badge(destination, ShellBadgeKind.unread),
label: 'unread chats',
cupertino: widget.cupertino,
cupertino: false,
child: icon,
);
}
@@ -130,12 +131,12 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final attention = widget.attentionCount > 0;
return AttentionDestinationIcon(
count: widget.attentionCount,
cupertino: widget.cupertino,
cupertino: false,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: attention ? 0 : _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
cupertino: false,
child: icon,
),
);
@@ -202,7 +203,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
alignment: AlignmentDirectional.bottomStart,
child: FloatingDestinationBar(
showLabels: true,
cupertino: widget.cupertino,
cupertino: false,
currentIndex: index,
onTap: (value) => _select(shellTabDestinations[value]),
items: _destinationItems(),
@@ -240,24 +241,6 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
},
child: child,
);
if (widget.cupertino) {
return backable(
ShellSystemInsets(
padding: system,
child: CupertinoPageScaffold(
navigationBar: topBar,
child: SafeArea(
top: false,
bottom: false,
child: FloatingBarOverlay(
bar: bar,
child: _destinationStack(contents),
),
),
),
),
);
}
return backable(
ShellSystemInsets(
padding: system,
@@ -352,10 +335,7 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
final item = destinationDetails(destination);
return FloatingDestinationItem(
key: ValueKey('shell.destination.${destination.name}'),
icon: _icon(
destination,
widget.cupertino ? item.cupertinoIcon : item.icon,
),
icon: _icon(destination, item.icon),
label: item.label,
);
}).toList();
@@ -367,18 +347,17 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
String label, {
required bool page,
}) {
final cupertino = widget.cupertino;
final onBack = spec?.onBack ?? (page ? _closePage : null);
final published = spec?.actions ?? const <Widget>[];
final onSearch = widget.onSearch;
return SegmentedBar(
cupertino: cupertino,
cupertino: false,
automaticallyImplyLeading: false,
leading: onBack == null
? null
: SegmentedBackButton(
key: const ValueKey('shell.back'),
cupertino: cupertino,
cupertino: false,
onPressed: onBack,
),
title: spec?.title ?? label,
@@ -401,22 +380,12 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
// A screen whose main pill is its own field (Search) needs no
// separate Search action.
else if (onSearch != null && spec?.titleWidget == null && !page)
cupertino
? CupertinoButton(
key: const ValueKey('shell.search'),
padding: EdgeInsets.zero,
onPressed: onSearch,
child: const Icon(
CupertinoIcons.search,
semanticLabel: 'Search',
),
)
: IconButton(
key: const ValueKey('shell.search'),
onPressed: onSearch,
tooltip: 'Search',
icon: const Icon(Icons.search),
),
IconButton(
key: const ValueKey('shell.search'),
onPressed: onSearch,
tooltip: 'Search',
icon: const Icon(Icons.search),
),
...widget.barActions,
],
);
@@ -438,10 +407,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
/// split never remounts it.
///
/// It rebuilds itself when [listenable] (the focused destination's published
/// bar) changes; [initial] supplies the size and obstruction, which do not
/// depend on the published contents.
class _ListPaneBar extends StatelessWidget
implements ObstructingPreferredSizeWidget {
/// bar) changes; [initial] supplies the size, which does not depend on the
/// published contents.
class _ListPaneBar extends StatelessWidget implements PreferredSizeWidget {
const _ListPaneBar({
required this.listenable,
required this.initial,
@@ -461,10 +429,6 @@ class _ListPaneBar extends StatelessWidget
@override
Size get preferredSize => initial.preferredSize;
@override
bool shouldFullyObstruct(BuildContext context) =>
initial.shouldFullyObstruct(context);
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: listenable,