Compare commits

..

3 Commits

Author SHA1 Message Date
Nathan Anderson 7ffeb2d199 dart analyzer 2023-12-07 16:24:17 -07:00
Nathan Anderson 3e140d6310 0.0.10 2023-12-07 16:23:11 -07:00
Nathan Anderson dcc5cf010f 0.0.10, remove that pesky Y 2023-12-07 16:03:02 -07:00
3 changed files with 16 additions and 13 deletions
+5
View File
@@ -1,3 +1,8 @@
## 0.0.10
- One little 'Y' I missed
- Fixed out of range error with `_adjustSelection`
## 0.0.9
- Drastically improved usability and performance with flutter web and canvaskit renderer, especially on mobile
+10 -12
View File
@@ -498,7 +498,7 @@ class CardTextFieldState extends State<CardTextField> {
if (_isMobile &&
_expirationController.text ==
'\u200b')
Text('MM/YYY', style: _hintTextSyle),
Text('MM/YY', style: _hintTextSyle),
TextFormField(
key: const Key('expiration_field'),
focusNode: expirationFocusNode,
@@ -914,9 +914,10 @@ class CardTextFieldState extends State<CardTextField> {
// Makes an http call to stripe API with provided card credentials and returns the result
Future<Map<String, dynamic>?> getStripeResponse() async {
if (widget.stripePublishableKey == null) {
if (kDebugMode)
if (kDebugMode) {
print(
'***ERROR tried calling `getStripeResponse()` but no stripe key provided');
}
return null;
}
@@ -1073,9 +1074,10 @@ class CardTextFieldState extends State<CardTextField> {
break;
}
/// Make the selection adjustment after first frame builds
if (kIsWeb)
// Make the selection adjustment only on web, other platforms dont select on focus change
if (kIsWeb) {
WidgetsBinding.instance.addPostFrameCallback((_) => _adjustSelection());
}
if (!isWideFormat) {
_scrollRow(step);
@@ -1095,27 +1097,23 @@ class CardTextFieldState extends State<CardTextField> {
switch (_currentStep) {
case CardEntryStep.number:
final len = _cardNumberController.text.length;
final offset = len == 0 ? 1 : len;
_cardNumberController.value = _cardNumberController.value.copyWith(
selection: TextSelection(baseOffset: offset, extentOffset: offset));
selection: TextSelection(baseOffset: len, extentOffset: len));
break;
case CardEntryStep.exp:
final len = _expirationController.text.length;
final offset = len == 0 ? 0 : len;
_expirationController.value = _expirationController.value.copyWith(
selection: TextSelection(baseOffset: offset, extentOffset: offset));
selection: TextSelection(baseOffset: len, extentOffset: len));
break;
case CardEntryStep.cvc:
final len = _securityCodeController.text.length;
final offset = len == 0 ? 0 : len;
_securityCodeController.value = _securityCodeController.value.copyWith(
selection: TextSelection(baseOffset: offset, extentOffset: offset));
selection: TextSelection(baseOffset: len, extentOffset: len));
break;
case CardEntryStep.postal:
final len = _postalCodeController.text.length;
final offset = len == 0 ? 0 : len;
_postalCodeController.value = _postalCodeController.value.copyWith(
selection: TextSelection(baseOffset: offset, extentOffset: offset));
selection: TextSelection(baseOffset: len, extentOffset: len));
break;
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
name: stripe_native_card_field
description: A native flutter implementation of the elegant Stripe Card Field.
version: 0.0.9
version: 0.0.10
repository: https://git.fosscat.com/n8r/stripe_native_card_field
environment: