HapticFeedback Service
Allows access to the haptic feedback interface on the device.
Inherits from flet.Service.
Methods
heavy_impact()** (async): Provides haptic feedback for a heavy collision impact.light_impact()** (async): Provides haptic feedback for a light collision impact.medium_impact()** (async): Provides haptic feedback for a medium collision impact.selection_click()** (async): Provides haptic feedback for a selection click (TBD).vibrate()** (async): Provides short duration vibration haptic feedback.Example
import flet as ftdef main(page: ft.Page):
hf = ft.HapticFeedback()
async def heavy_impact():
await hf.heavy_impact()
async def medium_impact():
await hf.medium_impact()
async def light_impact():
await hf.light_impact()
async def vibrate():
await hf.vibrate()
page.add(
ft.Button("Heavy impact", on_click=heavy_impact),
ft.Button("Medium impact", on_click=medium_impact),
ft.Button("Light impact", on_click=light_impact),
ft.Button("Vibrate", on_click=vibrate),
)
ft.run(main)
Previous
arrow_back
Gyroscope