Skip to main content

Dialogs

FD Components includes small confirmation and message dialog helpers that use FDC translations and button styling.

They are intended for common data-entry workflows such as delete confirmation, validation messages, and operation feedback.

Confirmation dialog​

final confirmed = await showFdcConfirmationDialog(
context,
title: 'Delete customer?',
message: 'This action cannot be undone.',
);

if (confirmed) {
dataSet.delete();
}

The helper returns true only when the affirmative action is chosen.

The dialog is modal and not barrier-dismissible.

Default button​

The negative action receives initial keyboard focus by default:

defaultButton: FdcConfirmationDefaultButton.no

Choose the affirmative action explicitly when that is appropriate for the workflow:

final confirmed = await showFdcConfirmationDialog(
context,
title: 'Apply changes?',
message: 'Save all pending changes now?',
defaultButton: FdcConfirmationDefaultButton.yes,
);

For destructive operations, keeping no as the default is usually safer.

Custom labels​

final discard = await showFdcConfirmationDialog(
context,
title: 'Discard changes?',
message: 'All unapplied changes will be reverted.',
yesText: 'Discard',
noText: 'Keep editing',
);

When custom labels are omitted, the dialog uses the active FDC translation bundle.

Message dialog​

await showFdcMessageDialog(
context,
title: 'Validation error',
message: 'Customer code is required.',
);

The message dialog has one localized dismiss action.

Override its label when needed:

await showFdcMessageDialog(
context,
title: 'Import complete',
message: '1,248 rows were imported successfully.',
okText: 'Close',
);

Widget forms​

The helpers use the public widgets:

  • FdcConfirmationDialog,
  • FdcMessageDialog.

Use the widgets directly when the application needs to compose them through a custom showDialog flow.

For ordinary application code, the showFdc...Dialog helpers are more concise and also clear the current primary focus before opening the modal.

Localization​

Confirmation labels default to the active FDC translations for:

  • Yes,
  • No.

The message dialog uses the localized OK label.

See Localization and Translations.