Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/stripe/lib/src/widgets/adress_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/stripe/lib/src/widgets/aubecs_debit_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 17 additions & 3 deletions packages/stripe/lib/src/widgets/card_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CardField extends StatefulWidget {
this.preferredNetworks,
this.onBehalfOf,
this.androidPlatformViewRenderType =
AndroidPlatformViewRenderType.expensiveAndroidView,
AndroidPlatformViewRenderType.surfaceAndroidView,
});

/// Decoration related to the input fields.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion packages/stripe/lib/src/widgets/card_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion packages/stripe/lib/src/widgets/google_pay_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class _GooglePayButtonState extends State<GooglePayButton> {
},
onCreatePlatformView: (params) {
onPlatformViewCreated(params.id);
return PlatformViewsService.initExpensiveAndroidView(
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: GooglePayButton._viewType,
layoutDirection: TextDirection.ltr,
Expand Down