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 showCustomPopup(
    context: context,
    builder: (popupContext) => Popup(
      title: localizations.translate(
        i18.scanner.scannerDialogTitle,
      ),
      onOutsideTap: () {
        Navigator.of(popupContext).pop();
      },
      description:contentLocalization,
      type: PopUpType.simple,
      actions: [
        DigitButton(
          label: localizations.translate(
            i18.scanner.scannerDialogPrimaryAction,
          ),
          onPressed: () {
            Navigator.of(
              popupContext,
              rootNavigator: true,
            ).pop(false);
          },
          type: DigitButtonType.primary,
          size: DigitButtonSize.large,
        ),
        DigitButton(
          label: localizations.translate(
            i18.scanner.scannerDialogSecondaryAction,
          ),
          onPressed: () {
            Navigator.of(
              context,
              rootNavigator: true,
            ).pop(true);

            Navigator.of(
              context,
            ).pop();
          },
          type: DigitButtonType.secondary,
          size: DigitButtonSize.large,
        ),
      ],
    ),
  );
}