How roshan9419/sortlizer works
Project Type and Purpose
• Its primary purpose is to provide interactive visualizations for various sorting techniques, along with algorithm information, customizations, and performance history during a session.
Main Components to Identify
• Flutter UI Layer:
• Views: The various UI screens (home_view, onboarding_view, settings_view, visualizer_view, sorting_detailed_view, etc.) present in lib/ui/views.
• Widgets: Custom widgets such as bars_loader, custom_rect_btn, code_viewer, sorting_history, etc., located in lib/ui/widgets.
• UI Themes & Dialogs: Theme setups and dialog elements (custom_input_dialog, confirmation_dialog, etc.) from lib/ui.
• MVVM Architecture Components:
• ViewModels: Each view has a corresponding viewmodel (e.g., home_viewmodel, settings_viewmodel, sorting_detailed_viewmodel, and visualizer_viewmodel).
• Views: Directly associated with viewmodels.
• Services and Business Logic:
• Services: Handling shared preferences, third-party integrations, etc., in lib/services.
• Utility Classes: Such as sorting_color_schemes and other utility functions found in lib/utils.
• Data Models:
• Sorting-Specific Models: The datamodels for various sorting attributes (algo_history_track, algorithmType, barType, etc.) found in lib/datamodels.
• Dependency Injection & Routing:
• Dependency Injection: The locator (lib/app/locator.dart) and its configuration (locator.config.dart) that wire up dependencies using get_it/injectable.
• Routing: Defining the navigation structure using auto_route and stacked_services (files like router.dart and router.router.dart in lib/app).
Relationships and Interactions
• UI Layer (Views) communicates with their corresponding ViewModels for user actions and display updates.
• ViewModels interact with Services (e.g., shared preference service, third-party services) to retrieve and update data.
• The data models are used both in the UI layer (for visualization) and within services to store the state (like sorting history).
• Dependency injection ensures that all of these components (services, models, viewmodels) are provided consistently and are decoupled.
• Routing is used to transition between views and is central to the navigation flow.
Architectural Patterns and Design Principles
• Dependency Injection (IoC) using a locator pattern: Make note of how get_it/injectable is used to manage dependencies.
• Use of auto_route: Emphasize the navigation component.
• Flutter’s Widget Tree: Illustrate how the UI components (views, widgets) build upon one another.
• Multi-platform Layers: While the core logic is in Flutter (lib directory), the project also contains native, platform-specific folders (android, ios, linux, macos, windows) that bootstrap the Flutter engine and integrate platform-specific assets and configurations.
• Components should be clearly labeled. For instance:
• "Views" with subcomponents like HomeView, SettingsView, etc.
• "ViewModels" corresponding to each view.
• "Services" such as ThirdPartyServices and SharedPreferenceService.
• "Models" representing sorting algorithms and history.
• "DI Container" for dependency injection and "Router" for navigation.
• From user interaction in the view -> ViewModel processes -> Calls Services -> Updates Models -> Reflects changes back to the views.
• Between DI container providing dependencies to viewmodels and services.
• Navigation flows mediated by Router.
• Rectangles for high-level layers (UI, Business Logic, Data Models).
• Ovals for utility components like dependency injection or configuration.