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, 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, 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. 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), 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,