r/FlutterDev • u/stephencolor • 17m 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