Merge commit 'd365959bf1bb7921e728f8ad152548b21a44f9b5' into pipelines/run-20261111-0353-cupertino-out-runs-actions-7b6c

This commit is contained in:
2026-11-11 04:19:56 +00:00
40 changed files with 1566 additions and 2247 deletions
+9 -20
View File
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../chat/shell/chat_shell_terminal_keys.dart';
@@ -78,13 +77,10 @@ class TerminalBody extends StatelessWidget {
);
}
TextStyle? _noteStyle(BuildContext context) => cupertino
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
);
TextStyle? _noteStyle(BuildContext context) =>
Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
);
Widget _closeEnded(TerminalTab tab) {
void close() => unawaited(hub.close(tab));
@@ -92,9 +88,7 @@ class TerminalBody extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: cupertino
? CupertinoButton(onPressed: close, child: const Text('Close tab'))
: TextButton(onPressed: close, child: const Text('Close tab')),
child: TextButton(onPressed: close, child: const Text('Close tab')),
),
);
}
@@ -116,15 +110,10 @@ class TerminalBody extends StatelessWidget {
child: Text(error, style: _noteStyle(context)),
),
if (machines.isNotEmpty)
cupertino
? CupertinoButton(
onPressed: open,
child: const Text('New terminal'),
)
: FilledButton.tonal(
onPressed: open,
child: const Text('New terminal'),
),
FilledButton.tonal(
onPressed: open,
child: const Text('New terminal'),
),
],
),
);
+27 -62
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// One choice of a [TerminalMenuButton].
@@ -12,8 +11,7 @@ class TerminalChoice<T> {
final Key? key;
}
/// An icon button opening the host's menu: a Material popup menu, or a
/// Cupertino action sheet with Cancel.
/// An icon button opening the host's menu.
class TerminalMenuButton<T> extends StatelessWidget {
const TerminalMenuButton({
super.key,
@@ -38,66 +36,33 @@ class TerminalMenuButton<T> extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (!cupertino) {
return PopupMenuButton<T>(
tooltip: label,
icon: Icon(icon),
onSelected: onSelected,
itemBuilder: (_) => [
for (final choice in choices)
choice.checked == null
? PopupMenuItem<T>(
key: choice.key,
value: choice.value,
child: Text(choice.label),
)
: CheckedPopupMenuItem<T>(
key: choice.key,
value: choice.value,
checked: choice.checked!,
child: Text(choice.label),
),
if (info case final info?) ...[
const PopupMenuDivider(),
PopupMenuItem<T>(
key: const ValueKey('terminal-menu-info'),
enabled: false,
child: Text(info),
),
],
return PopupMenuButton<T>(
tooltip: label,
icon: Icon(icon),
onSelected: onSelected,
itemBuilder: (_) => [
for (final choice in choices)
choice.checked == null
? PopupMenuItem<T>(
key: choice.key,
value: choice.value,
child: Text(choice.label),
)
: CheckedPopupMenuItem<T>(
key: choice.key,
value: choice.value,
checked: choice.checked!,
child: Text(choice.label),
),
if (info case final info?) ...[
const PopupMenuDivider(),
PopupMenuItem<T>(
key: const ValueKey('terminal-menu-info'),
enabled: false,
child: Text(info),
),
],
);
}
return CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 8),
onPressed: () => _sheet(context),
child: Icon(cupertinoIcon, semanticLabel: label),
],
);
}
Future<void> _sheet(BuildContext context) async {
final picked = await showCupertinoModalPopup<T>(
context: context,
builder: (sheet) => CupertinoActionSheet(
title: Text(label),
message: info == null ? null : Text(info!),
actions: [
for (final choice in choices)
CupertinoActionSheetAction(
key: choice.key,
isDefaultAction: choice.checked ?? false,
onPressed: () => Navigator.of(sheet).pop(choice.value),
child: Text(
choice.checked ?? false ? '${choice.label} ✓' : choice.label,
),
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () => Navigator.of(sheet).pop(),
child: const Text('Cancel'),
),
),
);
if (picked != null) onSelected(picked);
}
}
+1 -10
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'terminal_body.dart';
@@ -17,9 +16,7 @@ PageRoute<void> terminalPageRoute({
}) {
Widget page(BuildContext _) =>
TerminalPage(hub: hub, layout: layout, cupertino: cupertino);
return cupertino
? CupertinoPageRoute<void>(builder: page)
: MaterialPageRoute<void>(builder: page);
return MaterialPageRoute<void>(builder: page);
}
/// The full-screen terminal page of a narrow window, opened and closed by
@@ -94,12 +91,6 @@ class TerminalPage extends StatelessWidget {
),
),
);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(middle: Text('Terminal')),
child: Material(type: MaterialType.transparency, child: body),
);
}
return Scaffold(
appBar: AppBar(title: const Text('Terminal')),
body: body,
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -123,12 +122,8 @@ class _TerminalPanelState extends State<TerminalPanel> {
),
),
);
final surface = widget.cupertino
? CupertinoColors.systemBackground.resolveFrom(context)
: Theme.of(context).colorScheme.surfaceContainerLow;
final divider = widget.cupertino
? CupertinoColors.separator.resolveFrom(context)
: Theme.of(context).colorScheme.outlineVariant;
final surface = Theme.of(context).colorScheme.surfaceContainerLow;
final divider = Theme.of(context).colorScheme.outlineVariant;
return Semantics(
container: true,
label: 'Terminal panel',
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../ui/adaptive/segmented_bar_pieces.dart';
@@ -31,31 +30,17 @@ class TerminalShortcutBubble extends StatelessWidget {
final label = running > 1
? 'Open terminal, $running running'
: 'Open terminal';
final icon = Icon(
cupertino
? CupertinoIcons.chevron_left_slash_chevron_right
: Icons.terminal,
size: 20,
);
final icon = Icon(Icons.terminal, size: 20);
final content = running > 1
? Badge.count(count: running, child: icon)
: icon;
final button = cupertino
? CupertinoButton.tinted(
key: const Key('terminal-shortcut-bubble'),
sizeStyle: CupertinoButtonSize.small,
padding: const EdgeInsets.all(10),
borderRadius: BorderRadius.circular(22),
onPressed: onOpen,
child: content,
)
: FloatingActionButton.small(
key: const Key('terminal-shortcut-bubble'),
heroTag: null,
tooltip: label,
onPressed: onOpen,
child: content,
);
final button = FloatingActionButton.small(
key: const Key('terminal-shortcut-bubble'),
heroTag: null,
tooltip: label,
onPressed: onOpen,
child: content,
);
return Semantics(
button: true,
label: label,
@@ -47,14 +47,14 @@ class TerminalTabStrip extends StatelessWidget {
padding: const EdgeInsetsDirectional.only(end: 4),
child: Semantics(
identifier: 'terminal-tab-$index',
child: _tab(context, tab, tab == selected),
child: _tab(tab, tab == selected),
),
),
],
),
),
),
_newTerminal(context),
_newTerminal(),
if (showModes)
TerminalMenuButton<_Option>(
cupertino: cupertino,
@@ -88,7 +88,7 @@ class TerminalTabStrip extends StatelessWidget {
String _label(TerminalTab tab) =>
hub.multiMachine ? '${tab.title} · ${tab.machineName}' : tab.title;
Widget _tab(BuildContext context, TerminalTab tab, bool selected) {
Widget _tab(TerminalTab tab, bool selected) {
final label = Text(
_label(tab),
maxLines: 1,
@@ -98,35 +98,6 @@ class TerminalTabStrip extends StatelessWidget {
: const TextStyle(fontStyle: FontStyle.italic),
);
void close() => unawaited(hub.close(tab));
if (cupertino) {
final color = selected
? CupertinoTheme.of(context).primaryColor
: CupertinoColors.label.resolveFrom(context);
return Row(
mainAxisSize: MainAxisSize.min,
children: [
CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 8),
onPressed: () => hub.select(tab),
child: DefaultTextStyle.merge(
style: TextStyle(
color: color,
fontWeight: selected ? FontWeight.w600 : null,
),
child: label,
),
),
CupertinoButton(
padding: EdgeInsets.zero,
onPressed: close,
child: const Icon(
CupertinoIcons.xmark_circle_fill,
semanticLabel: 'Close terminal',
),
),
],
);
}
return InputChip(
label: label,
selected: selected,
@@ -138,7 +109,7 @@ class TerminalTabStrip extends StatelessWidget {
);
}
Widget _newTerminal(BuildContext context) {
Widget _newTerminal() {
final machines = hub.connected;
if (machines.length > 1) {
return TerminalMenuButton<String>(
@@ -159,20 +130,11 @@ class TerminalTabStrip extends StatelessWidget {
}
final enabled = machines.isNotEmpty;
void open() => unawaited(hub.open());
return cupertino
? CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 8),
onPressed: enabled ? open : null,
child: const Icon(
CupertinoIcons.add,
semanticLabel: 'New terminal',
),
)
: IconButton(
tooltip: 'New terminal',
onPressed: enabled ? open : null,
icon: const Icon(Icons.add),
);
return IconButton(
tooltip: 'New terminal',
onPressed: enabled ? open : null,
icon: const Icon(Icons.add),
);
}
}
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'terminal_layout.dart';
@@ -28,17 +27,6 @@ class TerminalToggleButton extends StatelessWidget {
listenable: layout,
builder: (context, _) {
final shown = layout.visible;
if (cupertino) {
return CupertinoButton(
key: const ValueKey('shell.terminal'),
padding: EdgeInsets.zero,
onPressed: actions.toggle,
child: Icon(
CupertinoIcons.chevron_left_slash_chevron_right,
semanticLabel: label,
),
);
}
return IconButton(
key: const ValueKey('shell.terminal'),
tooltip: label,
+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,
+20 -67
View File
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../features/attention/domain/attention_models.dart';
@@ -8,9 +7,8 @@ import '../ui/motion/motion.dart';
///
/// The bell itself lives in the Runs heading, so without this the count would
/// be visible only on that destination; the web mirrors it on the rail and
/// dock tab. Material hosts use the framework [Badge]; Cupertino has no badge
/// control, so its tab bar and sidebar get the host's red count overlay. Zero
/// draws the bare icon, and a count labels the item exactly like the bell:
/// dock tab. Material hosts use the framework [Badge]. Zero draws the bare
/// icon, and a count labels the item exactly like the bell:
/// `Notifications, {n} needing attention`.
class AttentionDestinationIcon extends StatelessWidget {
const AttentionDestinationIcon({
@@ -21,24 +19,25 @@ class AttentionDestinationIcon extends StatelessWidget {
});
final int count;
/// Retained for callers that still pass it; the icon is always the Material
/// [Badge] whether this is set or not.
final bool cupertino;
final Widget child;
@override
Widget build(BuildContext context) {
final visible = count > 0;
final Widget icon = cupertino
? _CupertinoCountOverlay(count: count, visible: visible, child: child)
: Badge(
label: visible
? MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count)),
)
: null,
isLabelVisible: visible,
child: child,
);
final Widget icon = Badge(
label: visible
? MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count)),
)
: null,
isLabelVisible: visible,
child: child,
);
if (!visible) return icon;
// The number alone would read as a stray "3"; the item carries the bell's
// full label instead.
@@ -49,51 +48,6 @@ class AttentionDestinationIcon extends StatelessWidget {
}
}
/// The iOS tab-badge idiom: a red stadium with the count over the icon's
/// trailing corner. Content-driven size; only the overlap offset is fixed.
class _CupertinoCountOverlay extends StatelessWidget {
const _CupertinoCountOverlay({
required this.count,
required this.visible,
required this.child,
});
final int count;
final bool visible;
final Widget child;
@override
Widget build(BuildContext context) {
if (!visible) return child;
final style = CupertinoTheme.of(
context,
).textTheme.tabLabelTextStyle.copyWith(color: CupertinoColors.white);
return Stack(
clipBehavior: Clip.none,
children: [
child,
PositionedDirectional(
top: -6,
end: -10,
child: DecoratedBox(
decoration: ShapeDecoration(
color: CupertinoColors.systemRed.resolveFrom(context),
shape: const StadiumBorder(),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
child: MotionSwitcher(
scale: true,
child: Text('$count', key: ValueKey(count), style: style),
),
),
),
),
],
);
}
}
/// A small count on a tab icon: blue for activity (runs in progress, unread
/// chats), so it reads apart from the red needs-you count.
class ActivityBadge extends StatelessWidget {
@@ -108,6 +62,9 @@ class ActivityBadge extends StatelessWidget {
final int count;
final String label;
/// Retained for callers that still pass it; the badge uses the Material
/// theme colours whether this is set or not.
final bool cupertino;
final bool bottom;
final Widget child;
@@ -115,12 +72,8 @@ class ActivityBadge extends StatelessWidget {
@override
Widget build(BuildContext context) {
final visible = count > 0;
final color = cupertino
? CupertinoColors.systemBlue.resolveFrom(context)
: Theme.of(context).colorScheme.primary;
final text = cupertino
? CupertinoColors.white
: Theme.of(context).colorScheme.onPrimary;
final color = Theme.of(context).colorScheme.primary;
final text = Theme.of(context).colorScheme.onPrimary;
final stack = Stack(
clipBehavior: Clip.none,
children: [
+5 -1
View File
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
enum AppDestination { pipelines, runs, chat, search, settings }
@@ -20,6 +20,10 @@ AppDestination shellTabFor(AppDestination 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) {
+3 -12
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/motion/container_transform_route.dart';
import '../ui/motion/container_transform_source.dart';
@@ -93,17 +91,14 @@ PageRoute<void> detailPageRoute(
ContainerTransformLink? growFrom,
}) {
final page = DetailPane(destination: destination, builder: builder);
final cupertino = usesCupertinoHost(context);
if (growFrom != null) {
return ContainerTransformPageRoute<void>(
link: growFrom,
cupertino: cupertino,
cupertino: false,
builder: (_) => page,
);
}
return cupertino
? CupertinoPageRoute<void>(builder: (_) => page)
: MaterialPageRoute<void>(builder: (_) => page);
return MaterialPageRoute<void>(builder: (_) => page);
}
/// An open item's own bar over its content: what the content publishes
@@ -151,11 +146,10 @@ class _DetailPaneState extends State<DetailPane> {
// status-bar inset itself. The scaffold and the body's place in it stay
// the same either way, so switching never remounts the content.
final barless = spec?.barless ?? false;
final cupertino = usesCupertinoHost(context);
final bar = barless
? null
: SegmentedBar(
cupertino: cupertino,
cupertino: false,
automaticallyImplyLeading: widget.implyBack,
title: title,
subtitle: spec?.subtitle,
@@ -171,9 +165,6 @@ class _DetailPaneState extends State<DetailPane> {
// pads its lists by the bar's height (top) and by the system's or a
// floating tab bar's (bottom), floating its own tabs clear of them.
final content = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(navigationBar: bar, child: content);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
+4 -5
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import '../ui/motion/surface_visibility.dart';
/// The open item's own navigator beside a list on a wide window.
@@ -43,9 +41,10 @@ class _DetailPaneNavigatorState extends State<DetailPaneNavigator> {
@override
Widget build(BuildContext context) {
final Page<void> root = usesCupertinoHost(context)
? CupertinoPage<void>(key: _rootKey, child: widget.child)
: MaterialPage<void>(key: _rootKey, child: widget.child);
final Page<void> root = MaterialPage<void>(
key: _rootKey,
child: widget.child,
);
// Only the shown tab's pane answers the system Back: a page left open in
// another tab's pane stays there while Back acts on the current tab. The
// route asks every handler on it, so a hidden pane also ignores the call.
+2 -11
View File
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/host.dart';
import 'destination.dart';
/// The detail pane beside a list before anything is chosen: the
@@ -19,22 +17,15 @@ class EmptyDetailPane extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final details = destinationDetails(destination);
final color = cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
: Theme.of(context).colorScheme.onSurfaceVariant;
final color = Theme.of(context).colorScheme.onSurfaceVariant;
return Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
cupertino ? details.cupertinoIcon : details.icon,
size: 32,
color: color,
),
Icon(details.icon, size: 32, color: color),
const SizedBox(height: 12),
Text(
message,
+1 -8
View File
@@ -1,9 +1,7 @@
import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/resize_grip.dart';
/// How wide the divider's invisible grab area is, centred on its line.
@@ -17,12 +15,7 @@ class ListPaneDividerLine extends StatelessWidget {
const ListPaneDividerLine({super.key});
@override
Widget build(BuildContext context) => usesCupertinoHost(context)
? Container(
width: 1,
color: CupertinoColors.separator.resolveFrom(context),
)
: const VerticalDivider(width: 1);
Widget build(BuildContext context) => const VerticalDivider(width: 1);
}
/// The grab area over [ListPaneDividerLine]: dragging it (mouse or touch)
+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,