showCommandDialog<T> function
Future<T?>
showCommandDialog<T>({
- required BuildContext context,
- required CommandBuilder builder,
- BoxConstraints? constraints,
- bool autofocus = true,
- Duration debounceDuration = const Duration(milliseconds: 500),
- WidgetBuilder? emptyBuilder,
- ErrorWidgetBuilder? errorBuilder,
- WidgetBuilder? loadingBuilder,
- double? surfaceOpacity,
- double? surfaceBlur,
Implementation
Future<T?> showCommandDialog<T>({
required BuildContext context,
required CommandBuilder builder,
BoxConstraints? constraints,
bool autofocus = true,
Duration debounceDuration = const Duration(milliseconds: 500),
WidgetBuilder? emptyBuilder,
ErrorWidgetBuilder? errorBuilder,
WidgetBuilder? loadingBuilder,
double? surfaceOpacity,
double? surfaceBlur,
}) {
return showDialog<T>(
context: context,
builder: (context) {
final theme = Theme.of(context);
final scaling = theme.scaling;
surfaceOpacity ??= theme.surfaceOpacity;
surfaceBlur ??= theme.surfaceBlur;
return ConstrainedBox(
constraints: constraints ??
const BoxConstraints.tightFor(width: 510, height: 349) * scaling,
child: ModalContainer(
borderRadius: subtractByBorder(theme.borderRadiusXxl, 1 * scaling),
surfaceClip: ModalContainer.shouldClipSurface(surfaceOpacity),
child: Command(
autofocus: autofocus,
builder: builder,
debounceDuration: debounceDuration,
emptyBuilder: emptyBuilder,
errorBuilder: errorBuilder,
loadingBuilder: loadingBuilder,
surfaceOpacity: surfaceOpacity,
surfaceBlur: surfaceBlur,
),
),
);
},
);
}