feat(garage_ui): an item view in four layouts, a breadcrumb and a file drop target
ItemView draws a set of named things as a list, a two line list, a table with sortable headers or a grid, and ItemViewModeSwitch lets whoever is looking pick. Columns drop from the end on a narrow pane before the name gets squeezed. Breadcrumb is ghost buttons with chevrons. FileDropTarget takes files dragged in from outside and shows the focus ring while one is held over it; it sits on desktop_drop, which is a new dependency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KHotisA4hV2xmuZsHTksFX
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
cc2fe99d02
commit
444933b004
@@ -0,0 +1,46 @@
|
||||
import "package:flutter/widgets.dart";
|
||||
import "package:flutter_lucide/flutter_lucide.dart";
|
||||
|
||||
import "button.dart";
|
||||
|
||||
/// One step in a [Breadcrumb].
|
||||
class BreadcrumbItem {
|
||||
const BreadcrumbItem({required this.label, this.onPressed});
|
||||
|
||||
final String label;
|
||||
|
||||
/// null for somewhere you cant go, which is how the last one is drawn
|
||||
/// whatever you pass - its where you allready are.
|
||||
final VoidCallback? onPressed;
|
||||
}
|
||||
|
||||
/// Where you are, as a run of ghost buttons with a chevron between them.
|
||||
///
|
||||
/// Buttons rather than links, because everything else on a Garage page that
|
||||
/// takes you somewhere is a button and a row of underlined text would be the
|
||||
/// only thing on the screen that wasnt.
|
||||
///
|
||||
/// It wraps. A path deeper than the pane is wide goes onto a second line
|
||||
/// instead of scrolling sideways or folding its middle into a menu - you can
|
||||
/// allways see the whole of where you are.
|
||||
class Breadcrumb extends StatelessWidget {
|
||||
const Breadcrumb({super.key, required this.items});
|
||||
|
||||
final List<BreadcrumbItem> items;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
for (var i = 0; i < items.length; i++) ...[
|
||||
if (i > 0) const Icon(LucideIcons.chevron_right),
|
||||
Button.ghost(
|
||||
onPressed: i == items.length - 1 ? null : items[i].onPressed,
|
||||
child: Text(items[i].label),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user