I just recently started learning dart + flutter. I am looking for a way to create a widget that is superimposed on top of all windows, so that it is located somewhere in the corner and when you click on it, some function is called. Something like this (blue circle with an icon, always on the screen): It is not necessary to attach the code, you can just link to the documentation with a similar widget.

unfortunately flutter does not provide such features. You will have to implement this in native ways, moreover, only on android (ios does not have widgets at all, yet ...).

MiT2021-12-18 20:55:24

@MiT, can you please explain what "native ways" mean and can you use them together with flutter? I'm new to android development, so it's better to take a closer look.

Tilex2021-12-18 20:55:24

"natively" means using Kotlin /Java on Android or Swift /Obj-C on iOS as a standalone application. You have already been answered how this can be done on Android. But as for me this is extra rubbish, I would immediately delete such an application ...

MiT2021-12-18 20:55:24

@MiT application will be used only by me (well, maybe one or two more people). Ie on flutter such a thing will not work?

Tilex2021-12-18 20:55:24

no, it won't work.

MiT2021-12-18 20:55:24
  • Answer # 1

    You need to create your window manager with the parameterWindowManager.LayoutParams.TYPE_SYSTEM_ALERTby adding the desired view to it, java example:

    WindowManager.LayoutParams params= new WindowManager.LayoutParams (
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                        | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
        WindowManager wm= (WindowManager) getSystemService (WINDOW_SERVICE);
        LayoutInflater inflater= (LayoutInflater) getSystemService (LAYOUT_INFLATER_SERVICE);
        View myView= inflater.inflate (R.layout.my_view, null);
        myView.setOnTouchListener (new OnTouchListener () {
           public boolean onTouch (View v, MotionEvent event) {
               return true;
        wm.addView (myView, params);

    This requires permission, which, starting from 23 api, must be obtained dynamically

    < uses-permission android: name= "android.permission.SYSTEM_ALERT_WINDOW" />

    Or you can use Bubble Apibut this functionality is available only after turning on the setting in the developer options, that is, it is not for production code, and it is also worth considering that in Android 11 it is planned to be made available to everyone and it is possible to change something in the api itself.