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:
FluentPageRoute, which plays WinUI’s page entrance.ThemeScope, which the app puts its pages in.WidgetsApp, which defines the app’s routing, shortcuts and title.
Fields§
§key: Option<KeyRef>§home: Option<WidgetRef>See WidgetsApp::home.
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>See WidgetsApp::routes.
initial_route: Option<String>§on_generate_route: Option<RouteFactory>§on_generate_initial_routes: Option<InitialRouteListFactory>§on_unknown_route: Option<RouteFactory>§builder: Option<TransitionBuilder>See WidgetsApp::builder.
title: Option<String>See WidgetsApp::title.
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>See WidgetsApp::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§shortcuts: Option<ShortcutMap>§actions: Option<HashMap<TypeId, ActionRef>>See WidgetsApp::actions.
restoration_scope_id: Option<String>§use_inherited_media_query: boolDart’s deprecated useInheritedMediaQuery. This setting is ignored.
Implementations§
Source§impl FluentApp
impl FluentApp
Dart WidgetsApp(navigatorKey:).
Sourcepub fn home<K>(self, home: impl IntoWidget<K>) -> FluentApp
pub fn home<K>(self, home: impl IntoWidget<K>) -> FluentApp
Dart WidgetsApp(home:).
Sourcepub fn theme(self, theme: FluentTheme) -> FluentApp
pub fn theme(self, theme: FluentTheme) -> FluentApp
The theme the app shows, and the one an unset theme_mode falls
back to.
Sourcepub fn dark_theme(self, theme: FluentTheme) -> FluentApp
pub fn dark_theme(self, theme: FluentTheme) -> FluentApp
The theme shown in dark mode.
Sourcepub fn theme_mode(self, mode: FluentThemeMode) -> FluentApp
pub fn theme_mode(self, mode: FluentThemeMode) -> FluentApp
Which theme the app shows.
Sourcepub fn routes(
self,
routes: impl IntoIterator<Item = (String, WidgetBuilder)>,
) -> FluentApp
pub fn routes( self, routes: impl IntoIterator<Item = (String, WidgetBuilder)>, ) -> FluentApp
Dart WidgetsApp(routes:).
Sourcepub fn initial_route(self, initial_route: impl Into<String>) -> FluentApp
pub fn initial_route(self, initial_route: impl Into<String>) -> FluentApp
Dart WidgetsApp(initialRoute:).
Sourcepub fn on_generate_route(
self,
on_generate_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static,
) -> FluentApp
pub fn on_generate_route( self, on_generate_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static, ) -> FluentApp
Dart WidgetsApp(onGenerateRoute:).
Sourcepub fn on_generate_initial_routes(
self,
on_generate_initial_routes: impl Fn(&mut App, &str) -> Vec<RouteRef> + 'static,
) -> FluentApp
pub fn on_generate_initial_routes( self, on_generate_initial_routes: impl Fn(&mut App, &str) -> Vec<RouteRef> + 'static, ) -> FluentApp
Dart WidgetsApp(onGenerateInitialRoutes:).
Sourcepub fn on_unknown_route(
self,
on_unknown_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static,
) -> FluentApp
pub fn on_unknown_route( self, on_unknown_route: impl Fn(&mut App, &RouteSettings) -> Option<RouteRef> + 'static, ) -> FluentApp
Dart WidgetsApp(onUnknownRoute:).
Dart WidgetsApp(onNavigationNotification:).
Dart WidgetsApp(navigatorObservers:).
Sourcepub fn builder(
self,
builder: impl Fn(&mut App, BuildContext, Option<&WidgetRef>) -> WidgetRef + 'static,
) -> FluentApp
pub fn builder( self, builder: impl Fn(&mut App, BuildContext, Option<&WidgetRef>) -> WidgetRef + 'static, ) -> FluentApp
Dart WidgetsApp(builder:).
Sourcepub fn on_generate_title(
self,
on_generate_title: impl Fn(&mut App, BuildContext) -> String + 'static,
) -> FluentApp
pub fn on_generate_title( self, on_generate_title: impl Fn(&mut App, BuildContext) -> String + 'static, ) -> FluentApp
Dart WidgetsApp(onGenerateTitle:).
Sourcepub fn localizations_delegates(
self,
delegates: impl IntoIterator<Item = LocalizationsDelegateRef>,
) -> FluentApp
pub fn localizations_delegates( self, delegates: impl IntoIterator<Item = LocalizationsDelegateRef>, ) -> FluentApp
Dart WidgetsApp(localizationsDelegates:).
Sourcepub fn locale_list_resolution_callback(
self,
callback: impl Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale> + 'static,
) -> FluentApp
pub fn locale_list_resolution_callback( self, callback: impl Fn(Option<&[Locale]>, &[Locale]) -> Option<Locale> + 'static, ) -> FluentApp
Dart WidgetsApp(localeListResolutionCallback:).
Sourcepub fn locale_resolution_callback(
self,
callback: impl Fn(Option<&Locale>, &[Locale]) -> Option<Locale> + 'static,
) -> FluentApp
pub fn locale_resolution_callback( self, callback: impl Fn(Option<&Locale>, &[Locale]) -> Option<Locale> + 'static, ) -> FluentApp
Dart WidgetsApp(localeResolutionCallback:).
Sourcepub fn supported_locales(
self,
locales: impl IntoIterator<Item = Locale>,
) -> FluentApp
pub fn supported_locales( self, locales: impl IntoIterator<Item = Locale>, ) -> FluentApp
Dart WidgetsApp(supportedLocales:).
Sourcepub fn show_performance_overlay(self, show: bool) -> FluentApp
pub fn show_performance_overlay(self, show: bool) -> FluentApp
Dart WidgetsApp(showPerformanceOverlay:).
Sourcepub fn show_semantics_debugger(self, show: bool) -> FluentApp
pub fn show_semantics_debugger(self, show: bool) -> FluentApp
Dart WidgetsApp(showSemanticsDebugger:).
Dart WidgetsApp(debugShowCheckedModeBanner:).
Sourcepub fn shortcuts(self, shortcuts: ShortcutMap) -> FluentApp
pub fn shortcuts(self, shortcuts: ShortcutMap) -> FluentApp
Dart WidgetsApp(shortcuts:).
Sourcepub fn actions(self, actions: HashMap<TypeId, ActionRef>) -> FluentApp
pub fn actions(self, actions: HashMap<TypeId, ActionRef>) -> FluentApp
Dart WidgetsApp(actions:).
Sourcepub fn restoration_scope_id(self, id: impl Into<String>) -> FluentApp
pub fn restoration_scope_id(self, id: impl Into<String>) -> FluentApp
Dart WidgetsApp(restorationScopeId:).
Trait Implementations§
Source§impl StatefulWidget for FluentApp
impl StatefulWidget for FluentApp
Source§type State = FluentAppState
type State = FluentAppState
Source§fn create_state(&self) -> FluentAppState
fn create_state(&self) -> FluentAppState
Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
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 as_preferred_size_widget(
&self,
) -> Option<&(dyn PreferredSizeWidget + 'static)>
fn as_preferred_size_widget( &self, ) -> Option<&(dyn PreferredSizeWidget + 'static)>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
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 FluentAppwhere
*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 FluentAppwhere
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 FluentAppwhere
*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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.