Skip to main content

LocalizationsResolver

Struct LocalizationsResolver 

Source
pub struct LocalizationsResolver { /* private fields */ }
Expand description

Resolves the locale for an app based on the locale it is being run in, the locale the app has been configured with, and the locales the app supports.

Registers itself as a binding observer (Dart’s WidgetsBindingObserver mixin) so that did_change_locales re-resolves.

Implementations§

Source§

impl LocalizationsResolver

Source

pub fn new( app: &mut App, locale: Option<Locale>, locale_list_resolution_callback: Option<LocaleListResolutionCallback>, locale_resolution_callback: Option<LocaleResolutionCallback>, localizations_delegates: Option<Vec<LocalizationsDelegateRef>>, supported_locales: Vec<Locale>, ) -> Ref<LocalizationsResolver>

Creates a resolver (Dart’s constructor: supportedLocales is required; the rest are its optional named arguments, in the order update takes them).

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Unregisters from the binding and disposes the notifier.

Source

pub fn update( self: Handle<Self>, app: &mut App, locale: Option<Locale>, locale_list_resolution_callback: Option<LocaleListResolutionCallback>, locale_resolution_callback: Option<LocaleResolutionCallback>, localizations_delegates: Option<Vec<LocalizationsDelegateRef>>, supported_locales: Vec<Locale>, )

Updates the resolver with the given configuration, re-resolving the locale when supported_locales changed.

Source

pub fn locale(self: Handle<Self>, app: &mut App) -> Locale

The currently resolved locale.

Source

pub fn localizations_delegates( self: Handle<Self>, app: &App, ) -> Vec<LocalizationsDelegateRef>

The delegates for the app’s localizations, with DefaultWidgetsLocalizations::delegate appended.

Source

pub fn locale_list_resolution_callback( self: Handle<Self>, app: &App, ) -> Option<LocaleListResolutionCallback>

The callback that resolves from the full list of preferred locales.

Source

pub fn locale_resolution_callback( self: Handle<Self>, app: &App, ) -> Option<LocaleResolutionCallback>

The callback that resolves from the single default locale.

Source

pub fn supported_locales(self: Handle<Self>, app: &App) -> &[Locale]

The locales the app supports.

Trait Implementations§

Source§

impl ChangeNotifier for LocalizationsResolver

Source§

fn change_notifier_data(&self) -> &ChangeNotifierData

Source§

fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData

Source§

fn will_add_listener(self: Handle<Self>, app: &mut App)

Runs before the listener is stored. Dart overrides of addListener that work before super.addListener go here.
Source§

fn did_remove_listener(self: Handle<Self>, app: &mut App)

Runs after the listener is removed. Dart overrides of removeListener that work after super.removeListener go here.
Source§

impl Debug for LocalizationsResolver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl WidgetsBindingObserverObject for LocalizationsResolver

Source§

fn did_change_locales( self: Handle<Self>, app: &mut App, locales: Option<&[Locale]>, )

Source§

fn did_change_metrics(self: Handle<Self>, app: &mut App)

Source§

fn did_change_view_focus( self: Handle<Self>, app: &mut App, event: ViewFocusEvent, )

Source§

fn did_change_drag(self: Handle<Self>, app: &mut App, report: &DragReport)

Source§

fn did_change_text_scale_factor(self: Handle<Self>, app: &mut App)

Source§

fn did_change_platform_brightness(self: Handle<Self>, app: &mut App)

Source§

fn did_change_caption_style(self: Handle<Self>, app: &mut App)

Source§

fn did_change_app_lifecycle_state( self: Handle<Self>, app: &mut App, state: AppLifecycleState, )

Source§

fn did_request_app_exit( self: Handle<Self>, app: &mut App, ) -> Task<AppExitResponse> ⓘ

Source§

fn did_change_accessibility_features(self: Handle<Self>, app: &mut App)

Source§

fn did_pop_route(self: Handle<Self>, app: &mut App, view: ViewId) -> bool

Source§

fn handle_start_back_gesture( self: Handle<Self>, app: &mut App, back_event: PredictiveBackEvent, ) -> bool

Source§

fn handle_update_back_gesture_progress( self: Handle<Self>, app: &mut App, back_event: PredictiveBackEvent, )

Source§

fn handle_commit_back_gesture(self: Handle<Self>, app: &mut App)

Source§

fn handle_cancel_back_gesture(self: Handle<Self>, app: &mut App)

Source§

fn did_add_view(self: Handle<Self>, app: &mut App, view: &ViewRef)

Source§

fn did_remove_view(self: Handle<Self>, app: &mut App, view: ViewId)

Source§

fn did_fail_view_request( self: Handle<Self>, app: &mut App, request: RequestId, error: &ViewError, )

Source§

fn did_request_view_close( self: Handle<Self>, app: &mut App, view: ViewId, ) -> bool

Auto Trait Implementations§

§

impl !RefUnwindSafe for LocalizationsResolver

§

impl !Send for LocalizationsResolver

§

impl !Sync for LocalizationsResolver

§

impl !UnwindSafe for LocalizationsResolver

§

impl Forget for LocalizationsResolver

§

impl Freeze for LocalizationsResolver

§

impl Move for LocalizationsResolver

§

impl Unpin for LocalizationsResolver

§

impl UnsafeUnpin for LocalizationsResolver

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ListenableObject for T
where T: ChangeNotifier,

Source§

fn add_listener(self: Handle<T>, app: &mut App, listener: Listener)

Register a closure to be called when the object notifies its listeners.
Source§

fn remove_listener(self: Handle<T>, app: &mut App, listener: &Listener)

Remove a previously registered closure from the list of closures that the object notifies.
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>