openCommandPalette function

void openCommandPalette(
  1. List<({String? group, String label, VoidCallback onSelect})> items, {
  2. String placeholder = 'Type a command or search...',
  3. VoidCallback? onClose,
})

Opens the global command palette overlay.

Implementation

void openCommandPalette(
  List<({String label, String? group, VoidCallback onSelect})> items, {
  String placeholder = 'Type a command or search...',
  VoidCallback? onClose,
}) {
  activeCommandPalette.value = CommandPaletteConfig(
    items: items
        .map((item) => CommandItemConfig(
              label: item.label,
              group: item.group,
              onSelect: item.onSelect,
            ))
        .toList(),
    placeholder: placeholder,
    onClose: onClose,
  );
}