[2.1.0] Migrate Google Pay button to the pay package (RawGooglePayButton)#11
Draft
flitt-sdk-developers wants to merge 3 commits into
Draft
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-pay-migration-2.2.0
branch
from
July 9, 2026 16:20
9300d9e to
8eb59ef
Compare
Replace the custom `google_pay_button_view` PlatformView with the official `pay` package's `RawGooglePayButton` (native, Hybrid Composition, policy-compliant), eliminating the custom-platform-view issues (unregistered factory, create-before-config race, Virtual-Display glitches, empty dispose). - lib/src/google_pay_button.dart: render RawGooglePayButton; build its PaymentConfiguration from the internal Google Pay config (config['data']) via PaymentConfiguration.fromJsonString. Map ButtonType/ButtonThemes to pay's enums; borderRadius -> cornerRadius; width/height via SizedBox. Add a cloudipspBuilder test seam. Public API unchanged. - Keep the Flitt tokenization + 3DS flow: _onPress still calls cloudipsp.googlePayToken/googlePay; FlittMobilePlugin's native loadPaymentData/supportsGooglePay/setCookie are unchanged, so the imperative Cloudipsp API stays backward compatible. - Delete GooglePayButtonPlugin and its registration in FlittMobilePlugin. - pubspec: add pay ^3; raise Dart SDK floor to 3.1; version 2.1.0. - android/build.gradle: minSdkVersion 23 (required by pay); wallet/base as implementation for the native loadPaymentData path. - README/CHANGELOG: document minSdk 23, pay-provided wallet, unchanged API. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
flitt-sdk-developers
force-pushed
the
fix/gpay-button-pay-migration-2.2.0
branch
from
July 9, 2026 16:30
8eb59ef to
7b19b04
Compare
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
Replaces our own native Google Pay button with the official
paypackage'sRawGooglePayButton(native, Hybrid Composition, Google-brand-compliant). This removes the entire custom-platform-view bug class — the unregistered view factory, the create-before-config race, Virtual-Display glitches, and the emptydispose()— instead of hardening our own implementation.Why keep our own
GooglePayButtonwidget at all? It stays as a thin wrapper so the public API and the Flitt tokenization + 3DS flow are preserved; only the button rendering is delegated topay.Changes
lib/src/google_pay_button.dart: renderRawGooglePayButton; build itsPaymentConfigurationfrom the internal Google Pay config (config['data'], already returned by the SDK) viaPaymentConfiguration.fromJsonString. MapButtonType/ButtonThemestopay's enums;borderRadius→cornerRadius;width/heightviaSizedBox. Adds acloudipspBuildertest seam.GooglePayButtonPluginand its registration inFlittMobilePlugin.pubspec.yaml: addpay: ^3; raise Dart SDK floor to 3.1;version: 2.1.0.android/build.gradle:minSdkVersion 23(required bypay);play-services-wallet/baseasimplementationfor the nativeloadPaymentDatapath.Backward compatibility
GooglePayButtonconstructor, enums, callbacks. Drop-in for merchants.Cloudipsp.googlePay/googlePayTokenunchanged — nativeloadPaymentDatakept.paydependency,minSdkVersion 23, Dart 3.1+.Follow-up (not in this PR)
Optionally delegate tokenization to
pay'sPay.showPaymentSelectorand drop the nativeloadPaymentDataentirely.Verification (todo on a machine with Flutter)
flutter pub get+flutter analyzeclean; on real Android devices (API 23/29/34) the button renders and completes token-based payment through 3DS toonSuccess; confirm the imperative API path still works. Update the example app to use the widget for coverage.🤖 Generated with Claude Code