Comments (1)
Hey @alegos27, you are entering the 123456
and it's length is the same as Pinput's length, what happens is that when you call await tester.testTextInput.receiveAction(TextInputAction.done);
the keyboard is already closed by Pinput so the onSumbitted callback is never called.
This test case works fine.
testWidgets(
'Pinput should call the onSubmitted callback when pin input is submitted',
(WidgetTester tester) async {
final pinController = TextEditingController();
String? submittedValue;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Pinput(
controller: pinController,
onSubmitted: (value) {
submittedValue = value;
},
length: 6,
),
),
),
);
const pinValue = '12345';
await tester.enterText(find.byType(Pinput), pinValue);
await tester.testTextInput.receiveAction(TextInputAction.done);
await tester.pumpAndSettle();
expect(pinController.text, equals(pinValue));
expect(submittedValue, equals(pinValue));
},
);
Note that if you need a callback which is fired when pin is fully entered you should use onCompleted
property
from flutter_pinput.
Related Issues (20)
- keyboard iOS HOT 1
- How to custom paste button HOT 1
- this error is showing after update 2.2.31 version update
- flutter web apple safari on the keyboard HOT 3
- Firebase storage image files download lag HOT 1
- edit single box HOT 13
- Cursor is not shown on Pinput tap after completion. HOT 1
- postFilledWidget parameter feature
- Problem With Focus Node HOT 2
- External state management HOT 8
- Increase Character's length
- Permissions are not remembered in pinput every time system fetch otp it asks user to allow promt for auto fill how can we tackle that ? is there any solution HOT 1
- AutoFill not appearing second time on requesting resend OTP HOT 1
- Not Working with Cupertino APP HOT 1
- Could not determine the dependencies of task ':smart_auth:compileDebugAidl'.
- A text error is not shown the first time when write the wrong sms code
- On Android API 34 (Android 14) sms retriever not working - Update smart_auth dependency HOT 4
- useNativeKeyboard = false is not triggering validation
- Unresolved reference: AppSignatureHelper HOT 4
- How to show bottom cursor even after pin filled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_pinput.