showCommandPalette<T> function
Future<T?>
showCommandPalette<T>(
- BuildContext context, {
- required List<
CommandItem> items, - String placeholder = 'Type a command or search…',
- bool barrierDismissible = true,
Shows a modern command palette (Spotlight / Ctrl+K search dialog).
Implementation
Future<T?> showCommandPalette<T>(
BuildContext context, {
required List<CommandItem> items,
String placeholder = 'Type a command or search…',
bool barrierDismissible = true,
}) =>
showGeneralDialog<T>(
context: context,
barrierDismissible: barrierDismissible,
barrierLabel: 'Dismiss Command Palette',
barrierColor: Colors.black.withValues(alpha: 0.5),
transitionDuration: AppDuration.fast,
pageBuilder: (BuildContext context, Animation<double> anim1,
Animation<double> anim2) =>
CommandPalette(items: items, placeholder: placeholder),
transitionBuilder: (BuildContext context, Animation<double> anim,
Animation<double> secondaryAnim, Widget child) {
final CurvedAnimation curved =
CurvedAnimation(parent: anim, curve: Curves.easeOutCubic);
return FadeTransition(
opacity: curved,
child: ScaleTransition(
scale: Tween<double>(begin: 0.95, end: 1.0).animate(curved),
child: child,
),
);
},
);