showStudioCommandPalette function

Future<void> showStudioCommandPalette(
  1. BuildContext context, {
  2. required List<StudioCommand> commands,
  3. String hint = 'Type a command or search',
  4. StudioStyle? style,
})

Shows a StudioCommandPalette of commands over the page, under a dimmed barrier, and runs the command taken.

showStudioCommandPalette(context, commands: commands)

Implementation

Future<void> showStudioCommandPalette(
  BuildContext context, {
  required List<StudioCommand> commands,
  String hint = 'Type a command or search',
  StudioStyle? style,
}) {
  final scrim = StudioTheme.of(context).colors.scrim;
  return showDesignCommandPalette(
    context: context,
    barrierColor: scrim,
    palette: (run) => StudioCommandPalette(
      commands: commands,
      hint: hint,
      autofocus: true,
      style: style,
    )._body(run),
    surfaceBuilder: (context, palette) => Padding(
      padding: const EdgeInsets.all(StudioSpacing.regular),
      child: _panel(context, style, palette),
    ),
  ).then((_) {});
}