App Configuration and Structure

The App Configuration and Structure section provides detailed information about the setup and configuration of the SailPilot application, including the project structure and dependencies.

Project Overview

  • A high-level introduction to the structure and organization of the SailPilot application.

The main.dart file orchestrates the initial setup and configuration of the SailPilot application. It includes the initialization of Hive for local storage, the connectivity monitor, and the app’s authentication state.

Key Initialization Steps

  • Hive: Initializes the Hive database for local storage management.

  • Connectivity: Sets up the ConnectionStatusSingleton to monitor network connectivity.

  • Orientation: Locks the orientation to portrait mode for consistent UI across devices.

Lifecycle Observer

The AppLifecycleReactor class is an observer that listens to app lifecycle events. It ensures that data synchronization occurs whenever the app returns to the foreground. This is critical for an offline-first app to keep the local data in sync with the server.

App Structure

  • MyApp: The root widget that defines theme data, home screen logic, and navigation routes. It uses FutureBuilder to wait for the AuthState initialization to complete before displaying the appropriate screen based on the authentication status.

Note

The main entry point of the application is designed to handle initial configuration and manage state changes effectively, ensuring a smooth user experience and consistent data integrity.

Project Structure

  • Detailed documentation of the SailPilot project’s structure, explaining how the codebase is organized.

The SailPilot Flutter application follows a feature-based directory structure. The main components of the directory structure are outlined below.

Core Package

  • common: Contains shared components and utilities used across multiple features of the app.

  • helper: Provides helper functions that perform common tasks.

  • sync: Manages synchronization of data between the local database and the backend server.

  • utils: Includes utility functions and classes for various purposes throughout the app.

Features Package

Each feature of the app is contained within its own directory under the features package. This encapsulation makes it easy to manage and understand each part of the app. Key features include:

  • auth: Handles user authentication processes.

  • bookings: Manages booking-related functionalities.

  • calendar: Deals with event scheduling and calendar views.

  • … (and so on for other features) …

Other Directories

  • profile: Manages user profile information and related operations.

  • refer_friend: Implements the functionality to refer the app to friends.

  • support: Provides support and help-related features to the user.

Root Directory

  • main.dart: The entry point of the Flutter application. Sets up the app environment and runs the app.

  • theme_controller.dart: Manages the theme data for the application, including colors, fonts, and other UI properties.

Dependency Management

  • Overview and details of the pubspec.yaml file, including dependencies used in the Flutter project.

The pubspec.yaml file is a crucial component of the SailPilot Flutter project. It defines the app’s metadata, Flutter SDK requirements, dependencies, and resource configurations.

Flutter Environment

  • SDK Version: The Flutter SDK version required by SailPilot is >=3.0.0 <4.0.0. This ensures compatibility with specific Flutter features and packages used in the project.

Dependencies

SailPilot relies on a range of dependencies to implement its features:

  • flutter: The core Flutter framework.

  • animations: Provides a range of animation functionalities.

  • carousel_slider: Used for creating image carousel sliders.

  • change_app_package_name: Allows changing the app’s package name.

  • connectivity_plus: For checking internet connectivity within the app.

  • flutter_secure_storage: Secure storage options for Flutter.

  • … (other dependencies) …

Special mention:

  • hive: A lightweight and fast NoSQL database for Flutter. Used for local data storage in an offline-first approach.

  • maplibre_gl: Provides functionalities for using MapLibre, an open-source mapping library.

  • provider: A state management solution to efficiently manage app data.

Dev Dependencies

Development dependencies include:

  • flutter_test: Provides testing functionalities for Flutter apps.

  • flutter_lints: For enforcing coding standards and guidelines.

  • build_runner, hive_generator: Used for code generation tasks.

App-Specific Configurations

  • Flutter Native Splash: Configures the splash screen with logo_white.png and a specific color.

  • Flutter Launcher Icons: Defines custom launcher icons for both Android and iOS platforms.

Assets

Specifies the assets directory and subdirectories to be included in the project, such as images and icons.

Note

The pubspec.yaml file serves as the blueprint for the app’s configuration and dependencies, ensuring that the app builds correctly with the intended features and resources.

Indices and tables