From 86fb6dd1d70f672c1ee8c5ed3af33e95d19bc46f Mon Sep 17 00:00:00 2001 From: Leland Reardon Date: Tue, 11 Nov 2025 12:59:00 -0800 Subject: [PATCH 1/5] Change to initSurfaceAndroidView for platform view --- packages/stripe/lib/src/widgets/card_form_field.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stripe/lib/src/widgets/card_form_field.dart b/packages/stripe/lib/src/widgets/card_form_field.dart index f543add8..a8deb436 100644 --- a/packages/stripe/lib/src/widgets/card_form_field.dart +++ b/packages/stripe/lib/src/widgets/card_form_field.dart @@ -548,7 +548,7 @@ class _AndroidCardFormField extends StatelessWidget { ), onCreatePlatformView: (params) { onPlatformViewCreated(params.id); - return PlatformViewsService.initExpensiveAndroidView( + return PlatformViewsService.initSurfaceAndroidView( id: params.id, viewType: viewType, layoutDirection: Directionality.of(context), From bf32cab3ac7440538f75fef44c95f987d21813af Mon Sep 17 00:00:00 2001 From: Leland Reardon Date: Tue, 11 Nov 2025 13:00:32 -0800 Subject: [PATCH 2/5] Change to initSurfaceAndroidView for Google Pay button --- packages/stripe/lib/src/widgets/google_pay_button.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stripe/lib/src/widgets/google_pay_button.dart b/packages/stripe/lib/src/widgets/google_pay_button.dart index 89390845..80396e04 100644 --- a/packages/stripe/lib/src/widgets/google_pay_button.dart +++ b/packages/stripe/lib/src/widgets/google_pay_button.dart @@ -66,7 +66,7 @@ class _GooglePayButtonState extends State { }, onCreatePlatformView: (params) { onPlatformViewCreated(params.id); - return PlatformViewsService.initExpensiveAndroidView( + return PlatformViewsService.initSurfaceAndroidView( id: params.id, viewType: GooglePayButton._viewType, layoutDirection: TextDirection.ltr, From c1ad6c5ee0ae493422d4587f62d4adb66f155672 Mon Sep 17 00:00:00 2001 From: Leland Reardon Date: Tue, 11 Nov 2025 13:16:23 -0800 Subject: [PATCH 3/5] Change to initSurfaceAndroidView for platform view --- packages/stripe/lib/src/widgets/adress_sheet.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stripe/lib/src/widgets/adress_sheet.dart b/packages/stripe/lib/src/widgets/adress_sheet.dart index a30fff58..35da1253 100644 --- a/packages/stripe/lib/src/widgets/adress_sheet.dart +++ b/packages/stripe/lib/src/widgets/adress_sheet.dart @@ -105,7 +105,7 @@ class _AddressSheetState extends State<_AddressSheet> { }, onCreatePlatformView: (params) { onPlatformViewCreated(params.id); - return PlatformViewsService.initExpensiveAndroidView( + return PlatformViewsService.initSurfaceAndroidView( id: params.id, viewType: _viewType, layoutDirection: TextDirection.ltr, From 246a70c777a5a042dc39dc0107555b97bc78e1a0 Mon Sep 17 00:00:00 2001 From: Leland Reardon Date: Tue, 11 Nov 2025 13:19:44 -0800 Subject: [PATCH 4/5] Change to use initSurfaceAndroidView for platform view --- packages/stripe/lib/src/widgets/aubecs_debit_form.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/stripe/lib/src/widgets/aubecs_debit_form.dart b/packages/stripe/lib/src/widgets/aubecs_debit_form.dart index 7ce2dce0..1eeb9b69 100644 --- a/packages/stripe/lib/src/widgets/aubecs_debit_form.dart +++ b/packages/stripe/lib/src/widgets/aubecs_debit_form.dart @@ -139,7 +139,7 @@ class _AubecsFormFieldState extends State<_AubecsFormField> { }, onCreatePlatformView: (params) { onPlatformViewCreated(params.id); - return PlatformViewsService.initExpensiveAndroidView( + return PlatformViewsService.initSurfaceAndroidView( id: params.id, viewType: _viewType, layoutDirection: TextDirection.ltr, From 1ae94461e1734b3a30f96284e09b48997bf8be0f Mon Sep 17 00:00:00 2001 From: Leland Reardon Date: Tue, 11 Nov 2025 13:28:05 -0800 Subject: [PATCH 5/5] Change default Android platform view render type to surfaceAndroidView --- .../stripe/lib/src/widgets/card_field.dart | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/stripe/lib/src/widgets/card_field.dart b/packages/stripe/lib/src/widgets/card_field.dart index 05826ceb..49966002 100644 --- a/packages/stripe/lib/src/widgets/card_field.dart +++ b/packages/stripe/lib/src/widgets/card_field.dart @@ -33,7 +33,7 @@ class CardField extends StatefulWidget { this.preferredNetworks, this.onBehalfOf, this.androidPlatformViewRenderType = - AndroidPlatformViewRenderType.expensiveAndroidView, + AndroidPlatformViewRenderType.surfaceAndroidView, }); /// Decoration related to the input fields. @@ -116,7 +116,7 @@ class CardField extends StatefulWidget { /// Type of platformview used for rendering on Android. /// /// This is an advanced option and changing this should be tested on multiple android devices. - /// Defaults to [AndroidPlatformViewRenderType.expensiveAndroidView] + /// Defaults to [AndroidPlatformViewRenderType.surfaceAndroidView] final AndroidPlatformViewRenderType androidPlatformViewRenderType; @override @@ -668,6 +668,19 @@ class _AndroidCardField extends StatelessWidget { ) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) ..create(); + case AndroidPlatformViewRenderType.surfaceAndroidView: + return PlatformViewsService.initSurfaceAndroidView( + id: params.id, + viewType: viewType, + layoutDirection: Directionality.of(context), + creationParams: creationParams, + creationParamsCodec: const StandardMessageCodec(), + onFocus: () { + params.onFocusChanged(true); + }, + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); case AndroidPlatformViewRenderType.androidView: return PlatformViewsService.initAndroidView( id: params.id, @@ -718,7 +731,8 @@ const kCardFieldDefaultFontFamily = 'Roboto'; enum AndroidPlatformViewRenderType { /// Controls an Android view that is composed using the Android view hierarchy expensiveAndroidView, - + /// Like expensiveAndroidView, but Uses Texture Layer Hybrid Composition (TLHC) when possible, falling back to Hybrid Composition only when necessary. + surfaceAndroidView, /// Use an Android view composed using a GL texture. /// /// This is more efficient but has more issues on older Android devices.