showProductPage static method

Future<void> showProductPage({
  1. required BuildContext context,
  2. required ProofType proofType,
  3. PriceMetaProduct? product,
})

Implementation

static Future<void> showProductPage({
  required BuildContext context,
  required ProofType proofType,
  PriceMetaProduct? product,
}) async {
  if (!await ProductRefresher().checkIfLoggedIn(
    context,
    isLoggedInMandatory: true,
  )) {
    return;
  }
  if (!context.mounted) {
    return;
  }

  final PriceAddHelper priceAddHelper = PriceAddHelper(context);

  final Currency currency = priceAddHelper.getCurrency();

  final PriceModel model = PriceModel(
    proofType: proofType,
    initialProduct: product,
    currency: currency,
    multipleProducts: product == null,
  );

  await Navigator.of(context, rootNavigator: true).push(
    MaterialPageRoute<void>(
      builder: (BuildContext context) => ProductPriceAddPage(model),
    ),
  );
}