Skip to main content

PermissionHandler control for Flet

Project description

PermissionHandler control for Flet

PermissionHandler control for Flet.

Usage

Add flet-permission-handler as dependency (pyproject.toml or requirements.txt) to your Flet project.

Example

import flet as ft

import flet_permission_handler as fph


def main(page: ft.Page):
    page.scroll = ft.ScrollMode.ADAPTIVE
    page.appbar = ft.AppBar(title=ft.Text("PermissionHandler Tests"))
    ph = fph.PermissionHandler()
    page.overlay.append(ph)

    def check_permission(e):
        o = ph.check_permission(e.control.data)
        page.add(ft.Text(f"Checked {e.control.data.name}: {o}"))

    def request_permission(e):
        o = ph.request_permission(e.control.data)
        page.add(ft.Text(f"Requested {e.control.data.name}: {o}"))

    def open_app_settings(e):
        o = ph.open_app_settings()
        page.add(ft.Text(f"App Settings: {o}"))

    page.add(
        ft.OutlinedButton(
            "Check Microphone Permission",
            data=fph.PermissionType.MICROPHONE,
            on_click=check_permission,
        ),
        ft.OutlinedButton(
            "Request Microphone Permission",
            data=fph.PermissionType.MICROPHONE,
            on_click=request_permission,
        ),
        ft.OutlinedButton(
            "Open App Settings",
            on_click=open_app_settings,
        ),
    )


ft.app(main)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flet_permission_handler-0.1.0.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flet_permission_handler-0.1.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file flet_permission_handler-0.1.0.tar.gz.

File metadata

File hashes

Hashes for flet_permission_handler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6813b1e9c333036dcf69f5d27def2bc117a5b917611b6894a126920e1daecca2
MD5 5b2a59bd2bde6025bd6e684613094e73
BLAKE2b-256 e119aa61f64402a80af3ffc9d3a87045b6be3d5698a3af7712c1d45916b44280

See more details on using hashes here.

File details

Details for the file flet_permission_handler-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for flet_permission_handler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bbbbf37221e151c5d551f3bee4ac3ad87ffe405cfc6844cd4d37dd4075f9e4ab
MD5 78c366dc0f6fc564cea72d2ba3902bd5
BLAKE2b-256 be9ffbbd42905404401e81d6e919732181acf35989e1257d34b7a5f77d1d86cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page