buildDialog method

void buildDialog(
  1. BuildContext context,
  2. ScannerLocalization localizations,
  3. int quantity
)

Implementation

void buildDialog(
  BuildContext context,
  ScannerLocalization localizations,
  int quantity,
) async {
  var contentLocalization = localizations
      .translate(
        i18.scanner.scannerDialogContent,
      )
      .replaceAll('{quantity}', quantity.toString());
  await DigitDialog.show<bool>(
    context,
    options: DigitDialogOptions(
      titleText: localizations.translate(
        i18.scanner.scannerDialogTitle,
      ),
      contentText: contentLocalization,
      primaryAction: DigitDialogActions(
        label: localizations.translate(
          i18.scanner.scannerDialogPrimaryAction,
        ),
        action: (ctx) {
          Navigator.of(
            context,
            rootNavigator: true,
          ).pop(false);
        },
      ),
      secondaryAction: DigitDialogActions(
        label: localizations.translate(
          i18.scanner.scannerDialogSecondaryAction,
        ),
        action: (ctx) {
          Navigator.of(
            context,
            rootNavigator: true,
          ).pop(true);

          Navigator.of(
            context,
          ).pop();
        },
      ),
    ),
  );
}