Design Principles
The Wonderous app is built on several key architectural principles:Separation of Concerns
The codebase maintains a clear separation between logic and UI layers:- Logic Layer (
lib/logic/): Contains all business logic, state management, data models, and services - UI Layer (
lib/ui/): Contains widgets, screens, and visual components
- Business logic is reusable and testable
- UI components remain focused on presentation
- State management is centralized and predictable
Single Responsibility
Each logic controller has a specific, well-defined purpose:AppLogic: Application lifecycle and bootstrappingWondersLogic: Wonder data managementSettingsLogic: User preferences and configurationCollectiblesLogic: Collectible items and discoveryTimelineLogic: Historical timeline dataArtifactAPILogic: Artifact search and retrieval
Reactive State Management
The app uses a reactive architecture where:- State changes propagate automatically to UI components
- UI widgets rebuild when watched values change
- Logic classes expose
ValueNotifierproperties for reactive updates
Key Technologies
Core Stack
Flutter SDK
Version 3.32.0+ with Dart 3.8.0+
GetIt
Dependency injection and service locator
Provider
State management through GetItMixin
GoRouter
Declarative routing and navigation
Key Dependencies
- get_it: Service locator for dependency injection
- get_it_mixin: Reactive widget bindings to GetIt services
- provider: State management infrastructure
- go_router: Type-safe routing with deep linking support
- flutter_animate: Declarative animations
Application Layers
Presentation Layer
The UI layer follows Flutter’s widget composition model:WondersAppScaffold: Root scaffold providing app-wide theme and styling- Screen widgets: Feature-specific screens (home, wonder details, timeline, etc.)
- Common controls: Reusable UI components (buttons, images, modals)
Business Logic Layer
Logic classes are registered as singletons and accessed throughout the app:Data Layer
Data is organized into structured models:- Wonder Data (
lib/logic/data/wonders_data/): Static wonder information - Collectible Data: Collectible items for each wonder
- Timeline Data: Historical events and timeline information
- Artifact Data: Museum artifact metadata
Service Layer
Services handle external integrations and platform-specific functionality:ArtifactAPIService: Metropolitan Museum of Art API integrationUnsplashLogic: Photo discovery and displayNativeWidgetService: Home screen widget integrationLocaleLogic: Internationalization and localization
Application Bootstrap
The app follows a structured initialization sequence inmain.dart:16-31:
- Initialization: Initialize Flutter bindings and platform services
- Singleton Registration: Register all logic controllers and services
- App Launch: Create and run
WondersAppwidget - Bootstrap: Load settings, locale, data, and collectibles
- Navigation: Route to intro or home screen based on onboarding status
Platform Support
Wonderous is a truly multi-platform application supporting:- Mobile: iOS and Android with native integrations
- Desktop: Windows and macOS with adaptive layouts
- Web: WASM-optimized web builds at wonderous.app/web
Platform-Specific Optimizations
- iOS: Uses Impeller rendering engine by default
- Android: High refresh rate display support
- Desktop: Minimum window size constraints
- Web: Automatic accessibility features and image precaching
Performance Considerations
Image Caching
The app implements aggressive image caching to ensure smooth performance:- Custom
ImageCachewith 250MB maximum size - Strategic image precaching on web platform
- Lazy loading for wonder images and icons
Responsive Design
The app adapts to different screen sizes and orientations:- Dynamic layout switching (portrait/landscape)
- Device size-based UI decisions (navigation rail vs. bottom nav)
- Adaptive orientation locking on smaller devices
Animation Control
Animations respect system preferences:- Honors system “reduce motion” settings
- Configurable animation timing through
$styles.times - Fade transitions for smooth screen changes
Next Steps
Project Structure
Explore the file organization and folder structure
State Management
Learn how GetIt and Provider manage application state