Skip to content

BaseAd

Inherits: Control

Base class for all ad controls in Flet Ads package.

Raises:

  • FletUnsupportedPlatformException

    When using this control on a web and/or non-mobile platform.

Properties

Events

Properties#

request class-attribute instance-attribute #

request: AdRequest = field(
    default_factory=lambda: AdRequest()
)

Targeting information used to fetch an Ad.

unit_id instance-attribute #

unit_id: str

Ad unit ID for this ad.

Events#

on_click class-attribute instance-attribute #

on_click: ControlEventHandler[BaseAd] | None = None

Called when this ad is clicked.

on_close class-attribute instance-attribute #

on_close: ControlEventHandler[BaseAd] | None = None

Called when the full screen view has been closed. You should restart anything paused while handling on_open.

on_error class-attribute instance-attribute #

on_error: ControlEventHandler[BaseAd] | None = None

Called when an ad request failed.

Event handler argument data property contains information about the error.

on_impression class-attribute instance-attribute #

on_impression: ControlEventHandler[BaseAd] | None = None

Called when an impression occurs on this ad.

on_load class-attribute instance-attribute #

on_load: ControlEventHandler[BaseAd] | None = None

Called when this ad is loaded successfully.

on_open class-attribute instance-attribute #

on_open: ControlEventHandler[BaseAd] | None = None

Called when this ad opens up.

A full screen view/overlay is presented in response to the user clicking on an ad. You may want to pause animations and time sensitive interactions.