hubbleSDKDetails function

List<Widget> hubbleSDKDetails(
  1. BuildContext context
)

Implementation

List<Widget> hubbleSDKDetails(BuildContext context) {
  final theme = hubbleThemeData(context);
  final response = context.getViewState().data.response;
  final transactionDetails = response.amountBreakup.discountDetails;
  final coinPerc = transactionDetails.coinDiscount.percentage;
  final coinAmount = transactionDetails.coinDiscount.amount;
  final hubbleDiscount =
      (transactionDetails.hubbleDiscount.percentage + coinPerc)
          .toPrecision(2)
          .toDisplayNumber();
  return [
    summaryItem(
      title: !buildConfig.isHubbleSDK
          ? 'Hubble discount ($hubbleDiscount%)'
          : 'Discount ($hubbleDiscount%)',
      subtitle:
          '-${(transactionDetails.hubbleDiscount.amount + coinAmount).toIndianRupee()}',
      style: theme.subHeadingStyle.copyWith(
        color: theme.colors.system.success.dark,
      ),
    ),
    if (transactionDetails.coinDiscount.amount.isGreaterThan(0)) ...[
      theme.height2,
      Row(
        children: [
          Container(
            width: 2,
            height: 14,
            color: theme.baseSecondaryLight,
          ),
          theme.width4,
          HubbleText.rich(
            [
              const TextSpan(text: 'Using '),
              const WidgetSpan(
                  child: CoinIcon(
                size: 16,
              )),
              TextSpan(
                  text: ' ${coinAmount.toDisplayNumber()}',
                  style: TextStyle(
                    color: theme.colors.textColorDark,
                    fontWeight: FontWeight.w600,
                  ))
            ],
            style: theme.typography.s13.copyWith(
                color: theme.colors.textColorNormal,
                fontWeight: FontWeight.w400),
          )
        ],
      ),
    ],
  ];
}