Open vv2006-mc opened 1 week ago
Good idea! I want this PR to be merged
Also Flash
should be renamed to Flashlight
, I think it'll be better
@bleudev Done! Anything else?
@bleudev Done! Anything else?
Can you rename on()
and off()
methods to turn_on()
and turn_off()
? Also can you open PR in flet/website
repository for Flashlight
control?
Updated Example:
import flet as ft
def main(page: ft.Page):
flashlight = ft.Flashlight()
flashText = ft.Text()
page.overlay.append(flashlight)
def flash_toggle(e):
fl = flashlight.toggle()
if fl:
flashText.value = "Flashlight on"
else:
flashText.value = "Flashlight off"
flashText.update()
def flash_on(e):
fl = flashlight.turn_on()
if fl:
flashText.value = "Flashlight on"
else:
flashText.value = "There was an Error while turning on the Flashlight"
flashText.update()
def flash_off(e):
fl = flashlight.turn_off()
if fl:
flashText.value = "There was an Error while turning on the Flashlight"
else:
flashText.value = "Flashlight on"
flashText.update()
page.add(
ft.TextButton("Toggle Flashlight", on_click=flash_toggle),
ft.TextButton("On Flashlight", on_click=flash_on),
ft.TextButton("Off Flashlight", on_click=flash_off),
flashText,
)
ft.app(target=main)
Fixing the issue: #3188
Added a new control called
Flashlight
used to turn on and off the flashlight of mobileSample Code: