Skip to main content

App Structure

Estimated reading: 1 minute

  1. Components: This directory contains all the reusable UI components used in the screens of the application. It allows for modular and organized development, where each screen can have multiple components.

  2. Locale: This directory holds the JSON file for multi-language support. It facilitates easy translation and localization of the application.

  3. Models: This directory includes a base class that serves as a data store and enables other classes to track changes to that data. It provides a structured approach to data management within the application.

  4. Network: This directory encompasses all the API configurations for the application. It centralizes the settings and endpoints required for network communication.

  5. PaymentGateways: This section is dedicated to handling payment gateway integrations. It provides a separate space to configure and manage various payment options within the application.

  6. Screens: This directory contains all the individual screens of the application. Each screen represents a distinct user interface with specific functionality.

  7. Utils: The Utils directory holds the app's configuration files, including color schemes, constants, and commonly used functions. It promotes code reuse and encapsulates common functionalities.

  8. App_theme.dart: This file allows customization of the application's theme, including colors, fonts, and styles. It provides a convenient way to define the visual appearance of the entire app.

  9. Configs.dart: This file enables configuration customization for the application, such as changing the app's name and other settings. It serves as a central hub for modifying various aspects of the application's behavior and appearance.

info

Screens

The Screens directory usually contains feature-wise subdirectories, each with a common structure. Below are the typical subdirectories found within a screen's directory:

  • components : This directory contains all the reusable UI components used in the feature's screens.

  • models : This directory typically holds data models or classes used within the feature.

  • services : This directory is used for making API calls and often contains service classes responsible for fetching data from APIs, handling responses, and other related tasks.

Additionally, the following files are commonly found within a screen's directory:

  • controller.dart : This file contains classes responsible for controlling the logic and state of the feature's screens.

  • screen.dart : This file is where the UI implementation for the feature resides.