1

Some services vary between Android and iPhone, for example floating widget, widget on the home screen, can I make them using flutter

Can I view a dialog on the home screen like this example?

enter image description here

update thank everyone answer, but I need how to get it in Flutter

Samet ÖZTOPRAK
  • 2,428
  • 3
  • 23
  • 26
  • Try using a transparent activity : https://stackoverflow.com/questions/2176922/how-do-i-create-a-transparent-activity-on-android – Vikas Oct 08 '19 at 12:07
  • Sorry but you can't do it in Flutter because doing in Flutter means doing for both platform and since iOS doesn't support that, you simply can't use Flutter alone for it, you'll have to do it using method channel natively. – CopsOnRoad Oct 09 '19 at 03:47
  • I want this to be only for Android, i use Platform.isAndroid – user2402497 Oct 10 '19 at 13:45
  • Some services vary between Android and iPhone, for example floating widget, widget on home screen, can i make them using flutter – user2402497 Oct 10 '19 at 13:50

2 Answers2

1

Yes you can show that

 new AlertDialog.Builder(YourActivity.this)
                                .setTitle("Alert")
                                .setMessage("Alert Message")
                                .setCancelable(false)
                                .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        //Here you can do whatever you want to do on click 
                                    }
                                }).show();
0

Sorry you can't do it in iOS, however in Android, you can, all you need to do is write platform specific code.

You could create an Activity with the Theme.Dialog theme. In your AndroidManifest.xml file add the theme to the activity, like this:

<activity android:name=".DialogActivity" android:theme="@android:style/Theme.Dialog"></activity>

From your service simply start this Activity. You will have to start the activity with the Intent.FLAG_ACTIVITY_NEW_TASK flag. See How to start an Activity from a Service

Source

CopsOnRoad
  • 109,635
  • 30
  • 367
  • 257