Flashlight
Examples#
Example 1#
import flet as ft
import flet_flashlight as ffl
def main(page: ft.Page):
flashlight = ffl.Flashlight()
page.services.append(flashlight)
page.add(ft.TextButton("toggle", on_click=lambda _: flashlight.toggle()))
ft.run(main)
Flashlight
#
Bases: Service
A control to use FlashLight. Works on iOS and Android.
Note
This control is a non-visual and should be added
to Page.services
list before it can be used.
on_error
#
on_error: ControlEventHandler[Flashlight] | None = None
Fires when an error occurs.
The data
property of the event handler argument
contains information on the error.
parent
#
parent: BaseControl | None
The direct ancestor(parent) of this control.
It defaults to None
and will only have a value when this control is mounted
(added to the page tree).
The Page
control (which is the root of the tree) is an exception - it always
has parent=None
.
before_update
#
This method is called every time when this control is being updated.
/// details | Note
Make sure not to call/request an update()
here.
///
build
#
Called once during control initialization to define its child controls. self.page is available in this method.