jaumard / sms_autofill

Flutter plugin to provide SMS code autofill support
MIT License
289 stars 183 forks source link

sms code not been correctly picked up #55

Closed bitgandtter closed 1 year ago

bitgandtter commented 4 years ago

Takin from the example at https://pub.dev/packages/sms_autofill/example if I use it as it is with a MaterialApp, it works

... @override Widget build(BuildContext context) { return MaterialApp( theme: ThemeData.light(), home: Scaffold( ...

but if I return any other that that, like the inner scaffold it does not pick the code and its calls the code change function 3 times

... @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( ...

any reason for it, or is in fact a bug?

jaumard commented 4 years ago

It doesn't really make sens to not have an MaterialApp widget at all as all widget used are material widgets, never test that use case

bitgandtter commented 4 years ago

If you are using it inside a custom widget on its own file to be reused then inside the MaterialAp. it is a common pattern. That said the issue itself does not seems to be this, I keep trying workarounds to the point to make it work. And now it believes that the issue it's somehow related to the await SmsAutoFill().listenForCode; it seems not really been waiting for that to respond in anyhow or blocking. So if any code its executed below or trigger setState it somehow affects the behavior and does not pick the code correctly. I cannot 100% confirm the issue but I had experienced it