Skip to main content

FluentApp

Struct FluentApp 

Source
pub struct FluentApp {
Show 29 fields pub key: Option<KeyRef>, pub navigator_key: Option<GlobalKey>, pub home: Option<WidgetRef>, pub theme: Option<FluentTheme>, pub dark_theme: Option<FluentTheme>, pub theme_mode: Option<FluentThemeMode>, pub routes: HashMap<String, WidgetBuilder>, pub initial_route: Option<String>, pub on_generate_route: Option<RouteFactory>, pub on_generate_initial_routes: Option<InitialRouteListFactory>, pub on_unknown_route: Option<RouteFactory>, pub on_navigation_notification: Option<NotificationListenerCallback<NavigationNotification>>, pub navigator_observers: Vec<NavigatorObserverRef>, pub builder: Option<TransitionBuilder>, pub title: Option<String>, pub on_generate_title: Option<GenerateAppTitle>, pub color: Option<Color>, pub locale: Option<Locale>, pub localizations_delegates: Option<Vec<LocalizationsDelegateRef>>, pub locale_list_resolution_callback: Option<LocaleListResolutionCallback>, pub locale_resolution_callback: Option<LocaleResolutionCallback>, pub supported_locales: Vec<Locale>, pub show_performance_overlay: bool, pub show_semantics_debugger: bool, pub debug_show_checked_mode_banner: bool, pub shortcuts: Option<ShortcutMap>, pub actions: Option<HashMap<TypeId, ActionRef>>, pub restoration_scope_id: Option<String>, pub use_inherited_media_query: bool,
}
Expand description

An application using Fluent design, WinUI’s controls and their theme resources.

The FluentApp configures the top-level Navigator to search for routes as WidgetsApp does, and builds each page with FluentPageRoute, so a page enters with WinUI’s Frame entrance. It installs the Fluent icon font itself, so a widget of this library finds its glyphs without an installation step.

FluentApp::new()
    .title("Notes")
    .home(NotesPage::new())

See also:

Fields§

§key: Option<KeyRef>§navigator_key: Option<GlobalKey>§home: Option<WidgetRef>§theme: Option<FluentTheme>

The light theme, and the one the app shows unless the mode and the platform ask for the dark one. FluentTheme::light when not set.

§dark_theme: Option<FluentTheme>

The theme shown when the mode is FluentThemeMode::Dark, or when the platform is dark and the mode is FluentThemeMode::System. theme when not set, and FluentTheme::dark when neither is, as a WinUI app follows the system’s theme.

§theme_mode: Option<FluentThemeMode>

Which theme is shown. FluentThemeMode::System when not set.

§routes: HashMap<String, WidgetBuilder>§initial_route: Option<String>§on_generate_route: Option<RouteFactory>§on_generate_initial_routes: Option<InitialRouteListFactory>§on_unknown_route: Option<RouteFactory>§on_navigation_notification: Option<NotificationListenerCallback<NavigationNotification>>§navigator_observers: Vec<NavigatorObserverRef>§builder: Option<TransitionBuilder>§title: Option<String>§on_generate_title: Option<GenerateAppTitle>§color: Option<Color>

The colour old Android versions show the app in, in the app switcher; the accent’s base when not set, as a Material app takes its theme’s primary colour.

§locale: Option<Locale>§localizations_delegates: Option<Vec<LocalizationsDelegateRef>>§locale_list_resolution_callback: Option<LocaleListResolutionCallback>§locale_resolution_callback: Option<LocaleResolutionCallback>§supported_locales: Vec<Locale>§show_performance_overlay: bool§show_semantics_debugger: bool§debug_show_checked_mode_banner: bool§shortcuts: Option<ShortcutMap>§actions: Option<HashMap<TypeId, ActionRef>>§restoration_scope_id: Option<String>§use_inherited_media_query: bool

Dart’s deprecated useInheritedMediaQuery. This setting is ignored.

Implementations§

Source§

impl FluentApp

Source

pub fn new() -> FluentApp

Creates a Fluent app with WinUI’s light theme.

Source

pub fn key(self, key: KeyRef) -> FluentApp

Dart MaterialApp(key:).

Source

pub fn navigator_key(self, navigator_key: GlobalKey) -> FluentApp

Dart WidgetsApp(navigatorKey:).

Source

pub fn home<K>(self, home: impl IntoWidget<K>) -> FluentApp

Dart WidgetsApp(home:).

Source

pub fn theme(self, theme: FluentTheme) -> FluentApp

The theme the app shows, and the one an unset theme_mode falls back to.

Source

pub fn dark_theme(self, theme: FluentTheme) -> FluentApp

The theme shown in dark mode.

Source

pub fn theme_mode(self, mode: FluentThemeMode) -> FluentApp

Which theme the app shows.

Source

pub fn routes( self, routes: impl IntoIterator<Item = (String, WidgetBuilder)>, ) -> FluentApp

Dart WidgetsApp(routes:).

Source

pub fn initial_route(self, initial_route: impl Into<String>) -> FluentApp

Dart WidgetsApp(initialRoute:).

Source

pub fn on_generate_route( self, on_generate_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static, ) -> FluentApp

Dart WidgetsApp(onGenerateRoute:).

Source

pub fn on_generate_initial_routes( self, on_generate_initial_routes: impl Fn(&mut App, &str) -> Vec<RouteRef> + 'static, ) -> FluentApp

Dart WidgetsApp(onGenerateInitialRoutes:).

Source

pub fn on_unknown_route( self, on_unknown_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static, ) -> FluentApp

Dart WidgetsApp(onUnknownRoute:).

Source

pub fn on_navigation_notification( self, on_navigation_notification: impl Fn(&mut App, &NavigationNotification) -> bool + 'static, ) -> FluentApp

Dart WidgetsApp(onNavigationNotification:).

Source

pub fn navigator_observers( self, navigator_observers: impl IntoIterator<Item = NavigatorObserverRef>, ) -> FluentApp

Dart WidgetsApp(navigatorObservers:).

Source

pub fn builder( self, builder: impl Fn(&mut App, BuildContext, Option<&WidgetRef>) -> WidgetRef + 'static, ) -> FluentApp

Dart WidgetsApp(builder:).

Source

pub fn title(self, title: impl Into<String>) -> FluentApp

Dart WidgetsApp(title:).

Source

pub fn on_generate_title( self, on_generate_title: impl Fn(&mut App, BuildContext) -> String + 'static, ) -> FluentApp

Dart WidgetsApp(onGenerateTitle:).

Source

pub fn color(self, color: Color) -> FluentApp

The colour the old Android app switcher shows.

Source

pub fn locale(self, locale: Locale) -> FluentApp

Dart WidgetsApp(locale:).

Source

pub fn localizations_delegates( self, delegates: impl IntoIterator<Item = LocalizationsDelegateRef>, ) -> FluentApp

Dart WidgetsApp(localizationsDelegates:).

Source

pub fn locale_list_resolution_callback( self, callback: impl Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale> + 'static, ) -> FluentApp

Dart WidgetsApp(localeListResolutionCallback:).

Source

pub fn locale_resolution_callback( self, callback: impl Fn(Option<&Locale>, &[Locale]) -> Option<Locale> + 'static, ) -> FluentApp

Dart WidgetsApp(localeResolutionCallback:).

Source

pub fn supported_locales( self, locales: impl IntoIterator<Item = Locale>, ) -> FluentApp

Dart WidgetsApp(supportedLocales:).

Source

pub fn show_performance_overlay(self, show: bool) -> FluentApp

Dart WidgetsApp(showPerformanceOverlay:).

Source

pub fn show_semantics_debugger(self, show: bool) -> FluentApp

Dart WidgetsApp(showSemanticsDebugger:).

Source

pub fn debug_show_checked_mode_banner(self, show: bool) -> FluentApp

Dart WidgetsApp(debugShowCheckedModeBanner:).

Source

pub fn shortcuts(self, shortcuts: ShortcutMap) -> FluentApp

Dart WidgetsApp(shortcuts:).

Source

pub fn actions(self, actions: HashMap<TypeId, ActionRef>) -> FluentApp

Dart WidgetsApp(actions:).

Source

pub fn restoration_scope_id(self, id: impl Into<String>) -> FluentApp

Dart WidgetsApp(restorationScopeId:).

Trait Implementations§

Source§

impl Debug for FluentApp

Source§

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

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

impl Default for FluentApp

Source§

fn default() -> FluentApp

Returns the “default value” for a type. Read more
Source§

impl StatefulWidget for FluentApp

Source§

type State = FluentAppState

The state this widget creates.
Source§

fn key(&self) -> Option<&KeyRef>

Source§

fn create_state(&self) -> FluentAppState

Creates the mutable state for this widget at a given location in the tree. Read more
Source§

fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )

Dart’s debugFillProperties: the properties a dump shows for this widget, in Dart’s order. Dart’s Widget base only sets the dense tree style, which the framework does.
Source§

fn debug_check_constructor(&self)

Source§

fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>

Source§

fn type_name(&self) -> &'static str

See Widget::type_name. A stateful form another widget kind becomes (an animated or status transition widget) names the widget it wraps.

Auto Trait Implementations§

§

impl !RefUnwindSafe for FluentApp

§

impl !Send for FluentApp

§

impl !Sync for FluentApp

§

impl !UnwindSafe for FluentApp

§

impl Forget for FluentApp

§

impl Freeze for FluentApp
where *const RcInner<dyn Key> is !null: Freeze, PhantomData<RcInner<dyn Key>>: Freeze, *const RcInner<dyn Widget> is !null: Freeze, PhantomData<RcInner<dyn Widget>>: Freeze, *const u8 is !null: Freeze, PhantomData<(String, Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>)>: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App, &RouteSettings) -> Option<Retained<AnyRoute>>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &RouteSettings) -> Option<Retained<AnyRoute>>>>: Freeze, *const RcInner<dyn Fn(&mut App, &str) -> Vec<Retained<AnyRoute>>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &str) -> Vec<Retained<AnyRoute>>>>: Freeze, *const RcInner<dyn Fn(&mut App, &NavigationNotification) -> bool> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &NavigationNotification) -> bool>>: Freeze, PhantomData<Retained<AnyNavigatorObserver>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement, Option<&Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Option<&Rc<dyn Widget>>) -> Rc<dyn Widget>>>: Freeze, *const RcInner<dyn Fn(&mut App, AnyElement) -> String> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> String>>: Freeze, PhantomData<LocalizationsDelegateRef>: Freeze, *const RcInner<dyn Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale>> is !null: Freeze, PhantomData<RcInner<dyn Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale>>>: Freeze, *const RcInner<dyn Fn(Option<&Locale>, &[Locale]) -> Option<Locale>> is !null: Freeze, PhantomData<RcInner<dyn Fn(Option<&Locale>, &[Locale]) -> Option<Locale>>>: Freeze, PhantomData<Locale>: Freeze, PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: Freeze, PhantomData<(TypeId, Retained<AnyAction>)>: Freeze,

§

impl Move for FluentApp

§

impl Unpin for FluentApp
where Rc<dyn Key>: Unpin, Rc<dyn Widget>: Unpin, *const u8 is !null: Unpin, Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>: Unpin, Rc<dyn Fn(&mut App, &RouteSettings) -> Option<Retained<AnyRoute>>>: Unpin, Rc<dyn Fn(&mut App, &str) -> Vec<Retained<AnyRoute>>>: Unpin, Rc<dyn Fn(&mut App, &NavigationNotification) -> bool>: Unpin, NonZero<u32>: Unpin, &'static NavigatorObserverVTable: Unpin, Rc<Keep>: Unpin, Rc<dyn Fn(&mut App, AnyElement, Option<&Rc<dyn Widget>>) -> Rc<dyn Widget>>: Unpin, Rc<dyn Fn(&mut App, AnyElement) -> String>: Unpin, Rc<dyn AnyLocalizationsDelegate>: Unpin, Rc<dyn Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale>>: Unpin, Rc<dyn Fn(Option<&Locale>, &[Locale]) -> Option<Locale>>: Unpin, Rc<dyn ShortcutActivator>: Unpin, Rc<dyn Intent>: Unpin, *const (): Unpin, &'static ActionVTable: Unpin,

§

impl UnsafeUnpin for FluentApp
where *const RcInner<dyn Key> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Key>>: UnsafeUnpin, *const RcInner<dyn Widget> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Widget>>: UnsafeUnpin, *const u8 is !null: UnsafeUnpin, PhantomData<(String, Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>)>: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &RouteSettings) -> Option<Retained<AnyRoute>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &RouteSettings) -> Option<Retained<AnyRoute>>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &str) -> Vec<Retained<AnyRoute>>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &str) -> Vec<Retained<AnyRoute>>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &NavigationNotification) -> bool> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &NavigationNotification) -> bool>>: UnsafeUnpin, PhantomData<Retained<AnyNavigatorObserver>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement, Option<&Rc<dyn Widget>>) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Option<&Rc<dyn Widget>>) -> Rc<dyn Widget>>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, AnyElement) -> String> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> String>>: UnsafeUnpin, PhantomData<LocalizationsDelegateRef>: UnsafeUnpin, *const RcInner<dyn Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale>>>: UnsafeUnpin, *const RcInner<dyn Fn(Option<&Locale>, &[Locale]) -> Option<Locale>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(Option<&Locale>, &[Locale]) -> Option<Locale>>>: UnsafeUnpin, PhantomData<Locale>: UnsafeUnpin, PhantomData<(Rc<dyn ShortcutActivator>, Rc<dyn Intent>)>: UnsafeUnpin, PhantomData<(TypeId, Retained<AnyAction>)>: UnsafeUnpin,

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<W> IntoWidget<StatefulKind> for W
where W: StatefulWidget,

Source§

fn into_widget(self) -> Rc<dyn Widget>

The widget as a tree node, made where this is called: its creation_location.
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>