bharathraj-e / g_recaptcha_v3

Create Google reCAPTCHA v3 token for Flutter web.
https://pub.dev/packages/g_recaptcha_v3
MIT License
11 stars 8 forks source link

Always showing badge #3

Closed hmbenhaim closed 2 years ago

hmbenhaim commented 2 years ago

Hi, first thanks for your plugin! I have an issue that at first if I added GRecaptchaV3.hideBadge() It will no show the badge but after I refresh the app is showing the page again, thank you1

bharathraj-e commented 2 years ago
<style>
.grecaptcha-badge { visibility: hidden; }
</style>

Add this style in web/index.html - head tag

this will hide the badge initially when recaptcha js loads.

Also follow this recaptcha faq

However GRecaptchaV3.hideBadge() & GRecaptchaV3.showBadge() will work after the flutter ui got rendered

hmbenhaim commented 2 years ago
<style>
.grecaptcha-badge { visibility: hidden; }
</style>

Add this style in web/index.html - head tag

this will hide the badge initially when recaptcha js loads.

Also follow this recaptcha faq

However GRecaptchaV3.hideBadge() & GRecaptchaV3.showBadge() will work after the flutter ui got rendered

Thank you 🙏, I'll try that.

hmbenhaim commented 2 years ago

It worked! Than you!

richardloxley commented 7 months ago

In case any one else is struggling with this: I couldn't hide the badge at all even following the instructions above, but found the solution.

Eventually I discovered that I needed to move the call to GRecaptchaV3.hideBadge() to just before I instantiated my MaterialApp - within the build method of the widget called by runApp(). Previously I'd tried calling it just after the call to await GRecaptchaV3.ready() in main().

I assume the Flutter environment hadn't yet been initialised fully at that point?

Anyway, hopefully that will help anyone else struggling!