App permission in flutter - "Allow Display over other apps"

47 views Asked by At

My expectation:

I want to open app settings to allow permission for "allow display over other apps". So, when I click on the button in my app, then directly "allow display over other apps" setting screen should get open. Below I've attached a sample screen which i'm expecting to get open:

Allow_display_screen:

Problem:

But that screen (allow_display) is not opening directly, the complete app settings get open. Below is the attached screenshot for refrence:

App_settings_screen:

Mycode:

import 'package:flutter/material.dart';
import 'package:app_settings/app_settings.dart';

class CheckApp extends StatefulWidget {
  const CheckApp({Key? key}) : super(key: key);

  @override
  State<CheckApp> createState() => _CheckAppState();
}

class _CheckAppState extends State<CheckApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('App Settings'),
        ),
        body: ListView(
          children: [
            ListTile(
              title: const Text("App Settings"),
              onTap: () => AppSettings.openAppSettings(
                  type: AppSettingsType.settings, asAnotherTask: true),
            ),
          ],
        ),
      ),
    );
  }

}

What I did:

I've used app_settings_plugin but it doesn't provide such funcionality to directly open that screen (allow_display).

Query: Is there any different plugin to do so ? or, by making some changes in code this can be done ?

1

There are 1 answers

1
boze-noob On

You have display inside the AppSettingsType. So please try this for onTap:

onTap: () => AppSettings.openAppSettings(type: AppSettingsType.display, asAnotherTask: true),