Skip to content
Merged
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
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ version: 1.0.0
publish_to: "none"

environment:
sdk: ">=3.3.0 <4.0.0"
sdk: ">=3.8.1 <4.0.0"
flutter: ">=3.0.0"

dependencies:
flutter:
sdk: flutter
flutter_stripe: ^10.2.0
flutter_stripe_web: ^5.1.0
pay: ^2.0.0
pay: ^3.2.1
http: ^1.1.0
font_awesome_flutter: ^10.6.0
platform: ^3.0.0
Expand Down
111 changes: 60 additions & 51 deletions packages/stripe/lib/src/widgets/card_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@
}

class _CardFieldState extends State<CardField> {
final FocusNode _node =
FocusNode(debugLabel: 'CardField', descendantsAreFocusable: false);
final FocusNode _node = FocusNode(
debugLabel: 'CardField',
descendantsAreFocusable: false,
);

CardEditController? _fallbackContoller;
CardEditController get controller {
Expand Down Expand Up @@ -219,10 +221,7 @@
baseStyle: widget.style,
child: KeepVisibleOnFocus(
focusNode: _node,
child: SizedBox(
height: cardHeight,
child: platform,
),
child: SizedBox(height: cardHeight, child: platform),
),
);
}
Expand All @@ -234,7 +233,8 @@
}

CardStyle effectiveCardStyle(InputDecoration decoration) {
final fontSize = widget.style?.fontSize?.toInt() ??
final fontSize =
widget.style?.fontSize?.toInt() ??
Theme.of(context).textTheme.titleMedium?.fontSize?.toInt() ??
kCardFieldDefaultFontSize;

Expand Down Expand Up @@ -302,11 +302,11 @@
this.dangerouslyUpdateFullCardDetails = false,
this.onBehalfOf,
this.autofocus = false,
}) : assert(constraints == null || constraints.debugAssertIsValid()),
constraints = (width != null || height != null)
? constraints?.tighten(width: width, height: height) ??
BoxConstraints.tightFor(width: width, height: height)
: constraints;
}) : assert(constraints == null || constraints.debugAssertIsValid()),
constraints = (width != null || height != null)
? constraints?.tighten(width: width, height: height) ??
BoxConstraints.tightFor(width: width, height: height)
: constraints;

final BoxConstraints? constraints;
final CardFocusCallback? onFocus;
Expand Down Expand Up @@ -352,12 +352,14 @@
borderColor: Colors.transparent,
borderRadius: 0,
cursorColor: theme.textSelectionTheme.cursorColor ?? theme.primaryColor,
textColor: style?.textColor ??
textColor:
style?.textColor ??
baseTextStyle?.color ??
kCardFieldDefaultTextColor,
fontSize: baseTextStyle?.fontSize?.toInt() ?? kCardFieldDefaultFontSize,
// fontFamily: baseTextStyle?.fontFamily ?? kCardFieldDefaultFontFamily,
textErrorColor: theme.inputDecorationTheme.errorStyle?.color ??
textErrorColor:
theme.inputDecorationTheme.errorStyle?.color ??
theme.colorScheme.error,
placeholderColor:
theme.inputDecorationTheme.hintStyle?.color ?? theme.hintColor,
Expand All @@ -381,8 +383,10 @@
if (!widget.dangerouslyUpdateFullCardDetails) {
if (kDebugMode &&
controller.details != const CardFieldInputDetails(complete: false)) {
dev.log('WARNING! Initial card data value has been ignored. \n'
'$kDebugPCIMessage');
dev.log(
'WARNING! Initial card data value has been ignored. \n'
'$kDebugPCIMessage',
);
}
ambiguate(WidgetsBinding.instance)?.addPostFrameCallback((timeStamp) {
updateCardDetails(
Expand Down Expand Up @@ -414,8 +418,9 @@
'countryCode': widget.countryCode,
if (widget.onBehalfOf != null) 'onBehalfOf': widget.onBehalfOf,
if (widget.preferredNetworks != null)
'preferredNetworks':
widget.preferredNetworks?.map((e) => e.brandValue).toList(),
'preferredNetworks': widget.preferredNetworks
?.map((e) => e.brandValue)
.toList(),
'dangerouslyGetFullCardDetails': widget.dangerouslyGetFullCardDetails,
if (widget.dangerouslyUpdateFullCardDetails &&
controller.initalDetails != null)
Expand Down Expand Up @@ -456,13 +461,11 @@
} else {
throw UnsupportedError('Unsupported platform view');
}
final constraints = widget.constraints ??
final constraints =
widget.constraints ??
const BoxConstraints.expand(height: kCardFieldDefaultHeight);

return ConstrainedBox(
constraints: constraints,
child: platform,
);
return ConstrainedBox(constraints: constraints, child: platform);
}

@override
Expand All @@ -481,8 +484,10 @@
@override
void didUpdateWidget(covariant _MethodChannelCardField oldWidget) {
if (widget.controller != oldWidget.controller) {
assert(!controller.hasCardField,
'CardEditController is already attached to a CardView');
assert(
!controller.hasCardField,
'CardEditController is already attached to a CardView',
);
detachController(oldWidget.controller);
attachController(oldWidget.controller);
}
Expand Down Expand Up @@ -533,23 +538,25 @@
});
}

void _handleCardChanged(arguments) {
void _handleCardChanged(dynamic arguments) {
try {
final map = Map<String, dynamic>.from(arguments);
final update = CardFieldInputDetails.fromJson(
Map<String, dynamic>.from(map['card']));
Map<String, dynamic>.from(map['card']),
);
updateCardDetails(update, controller);
widget.onCardChanged?.call(update);
// ignore: avoid_catches_without_on_clauses
} catch (e) {
dev.log(
'An error ocurred while while parsing card arguments, this should not happen, please consider creating an issue at https://github.com/flutter-stripe/flutter_stripe/issues/new');
'An error ocurred while while parsing card arguments, this should not happen, please consider creating an issue at https://github.com/flutter-stripe/flutter_stripe/issues/new',

Check warning on line 552 in packages/stripe/lib/src/widgets/card_field.dart

View workflow job for this annotation

GitHub Actions / Typo CI

ocurred

"ocurred" is a typo. Did you mean "occurred"?
);
rethrow;
}
}

/// Handler called when a field from the platform card field has been focused
void _handlePlatformFocusChanged(arguments) {
void _handlePlatformFocusChanged(dynamic arguments) {
try {
final map = Map<String, dynamic>.from(arguments);
final field = CardFieldFocusName.fromJson(map);
Expand All @@ -564,7 +571,8 @@
// ignore: avoid_catches_without_on_clauses
} catch (e) {
dev.log(
'An error ocurred while while parsing card arguments, this should not happen, please consider creating an issue at https://github.com/flutter-stripe/flutter_stripe/issues/new');
'An error ocurred while while parsing card arguments, this should not happen, please consider creating an issue at https://github.com/flutter-stripe/flutter_stripe/issues/new',

Check warning on line 574 in packages/stripe/lib/src/widgets/card_field.dart

View workflow job for this annotation

GitHub Actions / Typo CI

ocurred

"ocurred" is a typo. Did you mean "occurred"?
);
rethrow;
}
}
Expand Down Expand Up @@ -637,9 +645,10 @@
return PlatformViewLink(
viewType: viewType,
surfaceFactory: (context, controller) => AndroidViewSurface(
controller: controller
// ignore: avoid_as
as AndroidViewController,
controller:
controller
// ignore: avoid_as
as AndroidViewController,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
),
Expand All @@ -648,28 +657,28 @@
switch (androidPlatformViewRenderType) {
case AndroidPlatformViewRenderType.expensiveAndroidView:
return PlatformViewsService.initExpensiveAndroidView(
id: params.id,
viewType: viewType,
layoutDirection: Directionality.of(context),
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
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,
viewType: viewType,
layoutDirection: Directionality.of(context),
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
id: params.id,
viewType: viewType,
layoutDirection: Directionality.of(context),
creationParams: creationParams,
creationParamsCodec: const StandardMessageCodec(),
onFocus: () {
params.onFocusChanged(true);
},
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
}
Expand Down
4 changes: 2 additions & 2 deletions packages/stripe/lib/src/widgets/card_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ class _MethodChannelCardFormFieldState
});
}

void _handleCardChanged(arguments) {
void _handleCardChanged(dynamic arguments) {
try {
final map = Map<String, dynamic>.from(arguments);
if (map.isEmpty) {
Expand All @@ -458,7 +458,7 @@ class _MethodChannelCardFormFieldState
}

/// Handler called when a field from the platform card field has been focused
void _handlePlatformFocusChanged(arguments) {
void _handlePlatformFocusChanged(dynamic arguments) {
try {
final map = Map<String, dynamic>.from(arguments);
final field = CardFieldFocusName.fromJson(map);
Expand Down
4 changes: 2 additions & 2 deletions packages/stripe/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage: https://github.com/flutter-stripe/flutter_stripe
repository: https://github.com/flutter-stripe/flutter_stripe

environment:
sdk: ">=3.0.0 <4.0.0"
sdk: ">=3.8.1 <4.0.0"
flutter: ">=3.0.0"

flutter:
Expand All @@ -28,4 +28,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^6.0.0
4 changes: 2 additions & 2 deletions packages/stripe_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/flutter-stripe/flutter_stripe
homepage: https://pub.dev/packages/flutter_stripe

environment:
sdk: ">=3.0.0 <4.0.0"
sdk: ">=3.8.1 <4.0.0"
flutter: ">=3.0.0"

dependencies:
Expand All @@ -15,7 +15,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^6.0.0

flutter:
plugin:
Expand Down
4 changes: 2 additions & 2 deletions packages/stripe_ios/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repository: https://github.com/flutter-stripe/flutter_stripe
homepage: https://pub.dev/packages/flutter_stripe

environment:
sdk: ">=3.0.0 <4.0.0"
sdk: ">=3.8.1 <4.0.0"
flutter: ">=3.0.0"

dependencies:
Expand All @@ -15,7 +15,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^4.0.0
flutter_lints: ^6.0.0

flutter:
plugin:
Expand Down
4 changes: 2 additions & 2 deletions packages/stripe_js/lib/src/api/core/billing_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ part 'billing_details.g.dart';

/// Billing information associated with the payment method.
@freezed
class BillingDetails with _$BillingDetails {
abstract class BillingDetails with _$BillingDetails {
const factory BillingDetails({
/// Email address.
String? email,
Expand All @@ -25,7 +25,7 @@ class BillingDetails with _$BillingDetails {
}

@freezed
class BillingAddress with _$BillingAddress {
abstract class BillingAddress with _$BillingAddress {
const factory BillingAddress({
/// Address line 1 (e.g., street, PO Box, or company name).
String? line1,
Expand Down
Loading
Loading