Fix Google Pay button not rendering (register view factory + race fix) [2.0.1]#10
Open
flitt-sdk-developers wants to merge 3 commits into
Open
Conversation
The native Google Pay AndroidView was gated on the fast native support check only, so when it resolved before the slower payment-config fetch, the platform view was created with allowedPaymentMethods == null. The subsequent config load then reset _viewKey to a new UniqueKey(), destroying and recreating the legacy Virtual-Display AndroidView and leaving the button blank. Gate the view on `supportsGPay && config != null` and drop the _viewKey reset in _initializeCloudipsp(), so the platform view is created exactly once with valid config, independent of async completion order. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The platform view factory for "google_pay_button_view" was registered only inside GooglePayButtonPlugin, which is never added to the Flutter engine: pubspec declares FlittMobilePlugin as the sole pluginClass, so GeneratedPluginRegistrant only loads FlittMobilePlugin. As a result the view type was never registered and any GooglePayButton widget failed to create its native view — without this the race fix alone still cannot render the button. Register the factory from FlittMobilePlugin.onAttachedToEngine (the plugin that is actually loaded) and expose GooglePayButtonFactory for it. Also move the example MainActivity to the directory matching its declared package (com.flitt.mobile_example). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
flitt-sdk-developers
force-pushed
the
fix/gpay-button-race-2.0.1
branch
from
July 9, 2026 16:20
3da6ca8 to
e50ee15
Compare
- Google Pay button: the native side now converts the Dart logical-pixel (dp) width/height to physical pixels before applying LayoutParams, so the button renders at its full brand-guide height instead of a ~16dp strip. It fills the host width, is centered, and the Dart widget clamps the height to a 48dp minimum. - Release: merge the 2.0.2 and 2.0.3 notes into a single 2.0.1 CHANGELOG entry and keep pubspec at 2.0.1. - Example: migrate the Android build scripts to the Kotlin DSL, modernize the toolchain, apply the Flitt rebrand (entitlement, currency), and refresh the example app (standalone Google Pay screen). - Tests: refresh expired test-card expiry dates (2025 -> 2035) and align the merchantId construction test with the deferred (payment-time) validation behavior. Full suite is green (107 passing). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the
GooglePayButtonwidget render. Two independent, confirmed root causes:Platform view was never registered. The
google_pay_button_viewPlatformViewFactorywas registered only insideGooglePayButtonPlugin, which is never added to the engine (pubspec declaresFlittMobilePluginas the solepluginClass, soGeneratedPluginRegistrantloads only that). The view type was therefore unregistered and the widget could never create its native view. Fixed by registering the factory fromFlittMobilePlugin.onAttachedToEngine.Race condition on config load.
build()gated the native view on the fast native support check only, so when it won the race against the slower payment-config fetch, the view was created withallowedPaymentMethods == null; the subsequent_viewKey = UniqueKey()reset then destroyed/recreated the legacy Virtual-DisplayAndroidView, leaving the button blank. Fixed by gating onsupportsGPay && config != nulland dropping the_viewKeyreset — the view is created once with valid config.Changes
android/.../FlittMobilePlugin.java: registergoogle_pay_button_view;GooglePayButtonFactorymade public.lib/src/google_pay_button.dart: gate view creation onsupportsGPay && config != null; remove the_viewKeyreset.example/.../MainActivity.java: moved to the directory matching its declared package.CHANGELOG.md/pubspec.yaml:2.0.1.Backward compatibility
No public API change. Drop-in
flutter pub get.Verification
flutter analyze/flutter pub getclean.googlePayToken→ 3DS →onSuccess.com.google.android.gms:play-services-wallet:19.4.0+ and thecom.google.android.gms.wallet.api.enabled=truemanifest flag.🤖 Generated with Claude Code