Breadcrumbs
Breadcrumbs show where a page sits within a hierarchy. Each ancestor leads back to a broader view and the last crumb names the current location.
Go up to a parent folder
#From Drafts, choose Files to return to its parent folder. Open Drafts again to restore the trail.
components/breadcrumbs/appliance/visit_parent.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class VisitParent extends StatefulWidget {
const VisitParent({super.key});
@override
State<VisitParent> createState() => _VisitParentState();
}
class _VisitParentState extends State<VisitParent> {
bool inDrafts = true;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 460),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceBreadcrumb(
crumbs: [
ApplianceCrumb(
'Files',
onPressed: inDrafts
? () => setState(() => inDrafts = false)
: null,
),
if (inDrafts) const ApplianceCrumb('Drafts'),
],
),
const SizedBox(height: 12),
if (inDrafts)
const Text('Drafts folder')
else
ApplianceButton(
'Open Drafts',
onPressed: () => setState(() => inDrafts = true),
),
],
),
);
}
Parameters
ApplianceBreadcrumb API ↗crumbs- Path from the outermost folder to the current location.
Shared behaviour
- Keyboard and focus. Tab to an ancestor and activate it. Once at Files, use Open Drafts to return.
- Screen readers. Read the path in order, then inspect which crumbs are links and which identify the current location.
- Direction and type. Compare the order and separators in RTL. At 200% text, try both the full trail and its shorter parent view.