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
impl LocalizationsResolver
Sourcepub 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>
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).
Sourcepub fn dispose(self: Handle<Self>, app: &mut App)
pub fn dispose(self: Handle<Self>, app: &mut App)
Unregisters from the binding and disposes the notifier.
Sourcepub 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>,
)
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.
Sourcepub fn localizations_delegates(
self: Handle<Self>,
app: &App,
) -> Vec<LocalizationsDelegateRef>
pub fn localizations_delegates( self: Handle<Self>, app: &App, ) -> Vec<LocalizationsDelegateRef>
The delegates for the app’s localizations, with
DefaultWidgetsLocalizations::delegate appended.
Sourcepub fn locale_list_resolution_callback(
self: Handle<Self>,
app: &App,
) -> Option<LocaleListResolutionCallback>
pub fn locale_list_resolution_callback( self: Handle<Self>, app: &App, ) -> Option<LocaleListResolutionCallback>
The callback that resolves from the full list of preferred locales.
Sourcepub fn locale_resolution_callback(
self: Handle<Self>,
app: &App,
) -> Option<LocaleResolutionCallback>
pub fn locale_resolution_callback( self: Handle<Self>, app: &App, ) -> Option<LocaleResolutionCallback>
The callback that resolves from the single default locale.
Sourcepub fn supported_locales(self: Handle<Self>, app: &App) -> &[Locale]
pub fn supported_locales(self: Handle<Self>, app: &App) -> &[Locale]
The locales the app supports.
Trait Implementations§
Source§impl ChangeNotifier for LocalizationsResolver
impl ChangeNotifier for LocalizationsResolver
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.