9bdabb32d9
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.
40 lines
1.2 KiB
Dart
40 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'destination.dart';
|
|
|
|
/// Native, labeled destination access when the full tab bar cannot fit a rail.
|
|
class ShellDestinationMenu extends StatelessWidget {
|
|
const ShellDestinationMenu({
|
|
super.key,
|
|
required this.cupertino,
|
|
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;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final child = Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: const [Icon(Icons.apps), Text('Menu')],
|
|
);
|
|
return PopupMenuButton<AppDestination>(
|
|
tooltip: 'Main navigation',
|
|
onSelected: onSelected,
|
|
itemBuilder: (context) => [
|
|
for (final destination in AppDestination.values)
|
|
CheckedPopupMenuItem(
|
|
value: destination,
|
|
checked: destination == current,
|
|
child: Text(destinationDetails(destination).label),
|
|
),
|
|
],
|
|
child: Padding(padding: const EdgeInsets.all(8), child: child),
|
|
);
|
|
}
|
|
}
|