Overview
TheAppLogic class is the top-level application controller responsible for initializing the Wonderous app, managing device orientation, and handling image precaching. It orchestrates the bootstrap process by loading settings, localizations, wonders data, timeline events, and collectibles.
Class Definition
Properties
Indicates whether the bootstrap process has completed. The router uses this to prevent redirects while bootstrapping. Defaults to
false.Indicates which orientations the app will allow by default. Affects Android/iOS devices only. Defaults to both landscape (
Axis.horizontal) and portrait (Axis.vertical).Allows a view to override the currently supported orientations. For example,
FullscreenVideoViewer always wants to enable both landscape and portrait. If a view sets this override, it is responsible for setting it back to null when finished.Returns the first platform display instance from
PlatformDispatcher.Methods
bootstrap()
Initializes the app and all main actors, loads settings, and sets up services.- Sets minimum window size for desktop apps (Windows/macOS)
- Enables semantics for web accessibility
- Initializes app bitmaps via
AppBitmaps.init() - Sets high refresh rate on Android devices
- Loads settings via
settingsLogic.load() - Loads localizations via
localeLogic.load() - Initializes wonders data via
wondersLogic.init() - Initializes timeline events via
timelineLogic.init() - Initializes and loads collectibles
- Sets
isBootstrapCompleteto true - Navigates to intro or home screen based on onboarding status
handleAppSizeChanged()
Called from the UI layer once a MediaQuery has been obtained. Updates supported orientations based on device size.appSize- The current size of the app window/screen
- Disables landscape layout on smaller form factors (shortest side < 600dp)
- Updates system orientation preferences accordingly
shouldUseNavRail()
Determines whether to use a navigation rail based on the current app dimensions.true if width > height and height > 250, otherwise false
showFullscreenDialogRoute()
Displays a fullscreen dialog route with optional transparency.context- The build contextchild- The widget to display in the dialogtransparent- Whether the dialog background should be transparent (default:false)
T when the dialog is dismissed
precacheIcons()
Precaches navigation bar icons (active and idle states) for better performance.- Editorial tab (active/idle)
- Photos tab (active/idle)
- Artifacts tab (active/idle)
- Timeline tab (active/idle)
precacheWonderImages()
Precaches wonder-specific images including foreground elements, backgrounds, and photos.- Main wonder image
- Foreground elements (left/right or front/back)
- Sun/moon images
- Flattened background
- Wonder button
- 4 photo thumbnails
precacheUrl()
Precaches a single image URL.url- The image URL to precachecontext- The build context
Usage Example
Registration
TheAppLogic instance is registered as a singleton using GetIt:
Related Classes
WondersLogic- Manages wonder data initializationTimelineLogic- Manages timeline eventsCollectiblesLogic- Manages collectible artifactsSettingsLogic- Manages app settingsLocaleLogic- Manages localizations