My Flutter project has a large form with about 20 fields to be filled in by the user. Some of them like name, email etc. are self-explanatory. But a few fields may need additional context to help the user understand their purpose.
I will have a small round button with a question mark icon next to these edit boxes. When the user clicks the icon, I want a rectangular overlay widget to pop up at or near that place. This will have a semi-transparent body, without a header. It will contain one or two lines of context-dependent help text. The user can dispose the widget by simply touching anywhere on the screen. In other words, it will be like a floating SnackBar with two differences: (1) it can be overlaid anywhere on the screen (2) it will not automatically vanish after a time delay.
Can you please name it if such a widget exists, or how the SnackBar can be customized.
2
Answers
Isn’t Overlay the widget you are looking for:
https://api.flutter.dev/flutter/widgets/Overlay-class.html
I mean the overlay in the example doesn’t look like a Snackbar, but this should be customizable.
Perhaps the
Overlay
widget can help you.Some examples can be found here:
https://api.flutter.dev/flutter/widgets/Overlay-class.html
https://medium.com/@aakashpp/flutters-overlay-widget-and-overlayentry-a-comprehensive-guide-9f82b019ba29
https://www.geeksforgeeks.org/flutter-implementing-overlay
https://blog.logrocket.com/complete-guide-implementing-overlays-flutter/