r/FlutterDev • • 1d ago

Article Four Flutter paywall bugs: two I designed out, two that bit me

Built six paywall templates on a single ChangeNotifier controller, no third-party packages, and shipped them with 108 tests. Paywalls are weirdly good at hiding edge cases, so here are the four that mattered — two I designed out up front, two that bit me anyway.

Lesson 1: money must not live in a double. 29.99 / 12 prints 2.4991666, and every formatter rounds it its own way — one screen shows $2.49, the next shows $2.50, and the receipt agrees with neither. The kit stores integer minor units with the currency's decimal digits (2 for USD, 0 for JPY) and only divides with half-up integer arithmetic. One function turns money into a string, so no two screens can disagree.

Lesson 2: hard-coded "save 40%" badges go stale the moment you touch a price. The badge is now computed from the two prices at build time, and it returns null when the saving is zero, negative, or the plan is lifetime. Null means the chip isn't in the widget tree at all — no "-0%" staring back at users.

Lesson 3: this one I hit at the very end. At 2× text scale on a 320dp screen, the pinned bottom CTA needed more height than the screen had. Nothing overlapped; it just clipped, so a user with large text enabled couldn't buy. The fix is an explicit failure mode: above 1.45× text scale the whole page becomes one scroll view, footer included, and the CTA scrolls with the content instead of fighting it.

Lesson 4: InkWell needs a Material ancestor, and MaterialApp doesn't provide one. A full-screen paywall built from ColoredBox threw "No Material widget found" the first time I tapped restore. Fix: make the shell itself the Material surface. Obvious in hindsight, annoying at 1am.

None of these were exotic. They're the kind of thing that passes a quick manual test and then shows up in a support email. Each one got a regression test — the 2× text test now pumps every template at 320dp and fails on any overflow — which is most of why the suite is 108 tests, with flutter analyze clean on Flutter 3.50.

Curious what paywall bugs others have hit: currency rounding, restore flows, trial eligibility, layout at extreme text scales. I'd rather learn from your scars than find them myself.

If a visual reference helps, the six templates rendered from the real widgets are here: github.com/StephenColor/flutter-paywall-flow-kit

0 Upvotes

4 comments sorted by

1

u/MobileXapps 1d ago

One more for the list: show the price string the store gives you, not your own formatting. Apple and Google set the local price per country, and Apple rounds to its own price points, so the localized price from the store product is what the user will actually be charged. A "$2.49 a month" computed from your own stored price can disagree with the purchase sheet that opens right after.

Same for the savings badge: compute it from the raw prices the store returns for that user, in their currency, so it stays right in every country and after a price change. Until the products have loaded, hide the badge instead of showing a default.

1

u/Weak-Arrival-7811 9h ago

Two from the store side, since you asked about trial eligibility:

  1. Showing "Start free trial" to someone who already used their trial. On iOS, StoreKit 2 tells you with product.subscription?.isEligibleForIntroOffer. On Android, getSubscriptionOfferDetails() only returns the base plans and offers the user is eligible to buy, so if the trial offer isn't in the list, the trial copy shouldn't render. If the kit takes eligibility as an input and drops the trial line when it's false, that's one more state for your 320dp tests.
  2. On iOS the billed amount has to be the most prominent price on the screen. Apple's subscriptions page allows a breakdown like a per-month price, but in a subordinate position and size. So even with the rounding fixed, $2.50/month shown bigger than $29.99/year can get the paywall rejected.

0

u/virtualmnemonic 1d ago

You guys still write code??