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
+4 -34
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'destination.dart';
@@ -10,48 +9,19 @@ class ShellDestinationMenu extends StatelessWidget {
required this.current,
required this.onSelected,
});
/// Retained for callers that still pass it; the menu is always the Material
/// popup whether this is set or not.
final bool cupertino;
final AppDestination current;
final ValueChanged<AppDestination> onSelected;
Future<void> _choose(BuildContext context) async {
final value = await showCupertinoModalPopup<AppDestination>(
context: context,
builder: (context) => CupertinoActionSheet(
title: const Text('Main navigation'),
actions: [
for (final destination in AppDestination.values)
CupertinoActionSheetAction(
isDefaultAction: destination == current,
onPressed: () => Navigator.pop(context, destination),
child: Text(destinationDetails(destination).label),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
),
);
if (value != null && context.mounted) onSelected(value);
}
@override
Widget build(BuildContext context) {
final child = Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(cupertino ? CupertinoIcons.square_grid_2x2 : Icons.apps),
const Text('Menu'),
],
children: const [Icon(Icons.apps), Text('Menu')],
);
if (cupertino) {
return Semantics(
button: true,
label: 'Main navigation',
child: CupertinoButton(onPressed: () => _choose(context), child: child),
);
}
return PopupMenuButton<AppDestination>(
tooltip: 'Main navigation',
onSelected: onSelected,