Skip to main content

RelayoutWhenSystemFontsChangeMixin

Trait RelayoutWhenSystemFontsChangeMixin 

Source
pub trait RelayoutWhenSystemFontsChangeMixin: RenderObject {
    // Required methods
    fn relayout_when_system_fonts_change_data(
        self: RenderHandle<Self>,
        app: &App,
    ) -> &RelayoutWhenSystemFontsChangeData;
    fn relayout_when_system_fonts_change_data_mut(
        self: RenderHandle<Self>,
        app: &mut App,
    ) -> &mut RelayoutWhenSystemFontsChangeData;

    // Provided methods
    fn system_fonts_did_change(self: RenderHandle<Self>, app: &mut App) { ... }
    fn attach_system_fonts(self: RenderHandle<Self>, app: &mut App) { ... }
    fn detach_system_fonts(self: RenderHandle<Self>, app: &mut App) { ... }
    fn system_fonts_listener(self: RenderHandle<Self>) -> Listener { ... }
    fn schedule_system_fonts_update(self: RenderHandle<Self>, app: &mut App) { ... }
}
Expand description

Mixin for a RenderObject that relayouts when system fonts change.

System fonts can change when the OS installs or removes a font. Use this mixin if the render object uses TextPainter or Paragraph to correctly update the text when it happens.

Required Methods§

Provided Methods§

Source

fn system_fonts_did_change(self: RenderHandle<Self>, app: &mut App)

A callback that is called when system fonts have changed.

The framework defers the invocation of the callback to the SchedulerPhase::TransientCallbacks phase to ensure that the render object’s text layout is still valid when user interactions are in progress (which usually take place during the idle phase).

By default, markNeedsLayout is called on the render object implementing this mixin.

Subclass should override this method to clear any extra cache that depend on font-related metrics.

Source

fn attach_system_fonts(self: RenderHandle<Self>, app: &mut App)

Flutter’s attach override body after super.attach.

Source

fn detach_system_fonts(self: RenderHandle<Self>, app: &mut App)

Flutter’s detach override body before super.detach.

Source

fn system_fonts_listener(self: RenderHandle<Self>) -> Listener

Source

fn schedule_system_fonts_update(self: RenderHandle<Self>, app: &mut App)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§