Skip to content

Commit

Permalink
Release 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Tkko authored and Tkko committed Jul 24, 2023
1 parent e34e5f2 commit 8a0236e
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","native_build":true,"dependencies":[]}],"android":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","native_build":true,"dependencies":[]}],"macos":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","native_build":true,"dependencies":[]}],"linux":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","native_build":true,"dependencies":[]}],"windows":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","native_build":true,"dependencies":[]}],"web":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.0.8/","dependencies":[]}]},"dependencyGraph":[{"name":"smart_auth","dependencies":[]}],"date_created":"2023-05-12 11:53:42.026139","version":"3.10.0"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","native_build":true,"dependencies":[]}],"android":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","native_build":true,"dependencies":[]}],"linux":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"smart_auth","path":"/Users/dev/.pub-cache/hosted/pub.dev/smart_auth-1.1.1/","dependencies":[]}]},"dependencyGraph":[{"name":"smart_auth","dependencies":[]}],"date_created":"2023-07-24 19:06:27.432471","version":"3.10.5"}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
#### 2.3.0 · 24/07/2023

- Fixed AGP 4.2<= compatibility in smart_auth
- Updated SDK constraints
- Updated default SMS code matcher regex length to 8 digits


#### 2.2.31 · 22/02/2023

### Added:
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,36 @@ return Form(
);
```

## Properties
## FAQ

#### autofill isn't working on iOS?

- Make sure you are using real device, not simulator
- Temporary replace Pinput with TextField, and check if autofill works. If, not it's probably a
problem with SMS you are getting, autofill doesn't work with most of the languages
- If you are using non stable version of Flutter that might be cause because something might be
broken inside the Framework

#### are you using firebase_auth?

Set `androidSmsAutofillMethod` to `AndroidSmsAutofillMethod.none` and set `controller'`s value in `verificationCompleted` callback, here is an example code:
``` dart
Pinput(
androidSmsAutofillMethod: AndroidSmsAutofillMethod.none,
controller: pinController,
);
await FirebaseAuth.instance.verifyPhoneNumber(
verificationCompleted: (PhoneAuthCredential credential) {
pinController.setText(credential.smsCode);
},
verificationFailed: (FirebaseAuthException e) {},
codeSent: (String verificationId, int? resendToken) {},
codeAutoRetrievalTimeout: (String verificationId) {},
);
```

## Properties
```dart
class Pinput extends StatefulWidget {
const Pinput({
Expand Down
7 changes: 4 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pinput/pinput.dart';

void main() {
Expand All @@ -17,8 +16,10 @@ void main() {
color: Color.fromRGBO(30, 60, 87, 1),
),
),
body:
const FractionallySizedBox(widthFactor: 1, child: PinputExample()),
body: const FractionallySizedBox(
widthFactor: 1,
child: PinputExample(),
),
),
),
);
Expand Down
24 changes: 24 additions & 0 deletions example/lib/test_examples.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,27 @@ class _ExampleState extends State<Example> {
);
}
}

class ErrorStateExample extends StatefulWidget {
const ErrorStateExample({Key? key}) : super(key: key);

@override
State<ErrorStateExample> createState() => _ErrorStateExampleState();
}

class _ErrorStateExampleState extends State<ErrorStateExample> {
bool _hasError = false;

Future<void> _validate(String value) async {
await Future.delayed(const Duration(seconds: 2));
setState(() => _hasError = value == '1111');
}

@override
Widget build(BuildContext context) {
return Pinput(
forceErrorState: _hasError,
onCompleted: _validate,
);
}
}
37 changes: 37 additions & 0 deletions example/test/main_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pinput/pinput.dart';

void main() {
testWidgets('Can enter value', (WidgetTester tester) async {
String? fieldValue;
int called = 0;
final controller = TextEditingController();
final focusNode = FocusNode();

await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Pinput(
controller: controller,
onChanged: (value) {
fieldValue = value;
called++;
},
),
),
),
);

focusNode.requestFocus();
await tester.pump();

expect(fieldValue, isNull);
expect(called, 0);

await tester.enterText(find.byType(Pinput), '1111');
await tester.testTextInput.receiveAction(TextInputAction.done);
expect(fieldValue, equals('1111'));
expect(called, 1);
});
}
12 changes: 9 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: pinput
version: 2.2.31
version: 2.3.0
description: Pin code input (OTP) text field, iOS SMS autofill, Android SMS autofill One Time Code, Password, Passcode, Captcha, Security, Coupon, Wowcher, 2FA, Two step verification
homepage: https://github.com/Tkko/Flutter_PinPut
repository: https://github.com/Tkko/Flutter_PinPut
issue_tracker: https://github.com/Tkko/Flutter_Pinput/issues
topics:
- otp
- pin-input
- pin-code
- passcode
- sms-autofill
screenshots:
- description: 'Pin input example'
path: example/pinput_demo_1.webp
Expand All @@ -13,14 +19,14 @@ funding:
- https://ko-fi.com/flutterman

environment:
sdk: '>=2.15.0 <3.0.0'
sdk: '>=2.15.0 <4.0.0'
flutter: ">=3.7.0"


dependencies:
flutter:
sdk: flutter
smart_auth: ^1.0.8
smart_auth: ^1.1.1
universal_platform: ^1.0.0+1

dev_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ format_and_analyze
run_dart_doc
#host_docs
run_pana
publish
#publish

0 comments on commit 8a0236e

Please sign in to comment.