Menu bar
A menu bar groups commands by purpose on a desktop screen. Give each menu a short name and each command a verb.
Run an editing command
#Open Edit and choose Mark reviewed. Reopen Edit and choose Clear review to restore the draft.
components/menu-bar/appliance/edit_note.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class EditNote extends StatefulWidget {
const EditNote({super.key});
@override
State<EditNote> createState() => _EditNoteState();
}
class _EditNoteState extends State<EditNote> {
bool reviewed = false;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 460),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceMenuBar(
menus: [
DesignMenuEntry(
label: 'Edit',
children: [
DesignMenuEntry(
label: 'Mark reviewed',
onPressed: () => setState(() => reviewed = true),
),
DesignMenuEntry(
label: 'Clear review',
onPressed: () => setState(() => reviewed = false),
),
],
),
],
),
const SizedBox(height: 12),
Text(reviewed ? 'Reviewed' : 'Draft'),
],
),
);
}
Parameters
ApplianceMenuBar API ↗menus- Top-level menus and their ordered commands.
Shared behaviour
- Keyboard and focus. Tab to Edit and open its menu. Move to a command, press Enter to run it or Escape to dismiss the menu.
- Screen readers. Read the menu name, then the commands available while it is open. The note’s status records the result.
- Direction and type. In RTL, inspect where the menu opens relative to Edit. Try both commands with larger text in the phone frame.