Overview
Trackmart follows a standard Flutter project structure with organized directories for source code, assets, and platform-specific configurations. The application is built around a three-tab interface for chats, order requests, and order history.Directory Structure
Source Code Structure (lib/)
The application source code is organized into modular Dart files, each responsible for specific features:
Core Files
main.dart - Application Entry Point
main.dart - Application Entry Point
Location:
lib/main.dartThe entry point of the application that initializes the Flutter app with Material Design theming.Key Components:MyAppwidget: Root widget that sets up the app theme- Custom color scheme: Teal primary color (
#004d40) and blue accent (#005B9A) - Routes to
RootPagefor authentication handling
lib/main.dart:6root_page.dart - Authentication & Navigation Root
root_page.dart - Authentication & Navigation Root
login_page.dart - User Authentication
login_page.dart - User Authentication
Location:
lib/login_page.dartHandles user authentication flow including phone number and email verification.Features:- Phone number authentication with OTP
- Email/password authentication
- Country code picker integration
- User profile creation
- SharedPreferences for local data storage
lib/login_page.darthome_page.dart - Main Application Interface
home_page.dart - Main Application Interface
Location:
lib/home_page.dartThe main interface after login featuring a three-tab layout.Three Main Tabs:- Chats Tab: List of drivers for messaging
- Request Tab: Order creation interface with quantity, unit, and payment selection
- Orders Tab: Order history categorized as Requested, In Transit, and Delivered
- Real-time location tracking using Geolocator
- Firebase Realtime Database and Firestore integration
- Driver search and selection
- Dynamic pricing with currency conversion
- Order management (create, track, rate)
- Local database (SQLite) for offline support
lib/home_page.dart:48-56Feature Files
map.dart
Interactive map view using flutter_map
- Display driver locations
- User location marker
- Route visualization
- Driver selection from map
chat.dart
Real-time messaging with drivers
- Firestore-based chat
- Image sharing support
- Message notifications
- Typing indicators
settings.dart
User profile management
- Profile photo upload
- Display name editing
- Account settings
- Firebase Storage integration
support.dart
Help and support page
- FAQs
- Contact information
- App guidance
contact.dart
Contact information page
- Company details
- Phone and email links
- URL launcher integration
about.dart
About the application
- App information
- Version details
- Credits
credit_card_page.dart
Payment interface (card payments)
- Card input fields
- Payment processing
- BLoC pattern implementation
credit_card_bloc.dart
Business logic for card payments
- Stream-based state management
- Card validation
- Payment processing logic
Utility Files
uidata.dart - UI Constants
uidata.dart - UI Constants
Location:
lib/uidata.dartContains UI-related constants and data.Includes:- Color schemes
- String constants
- Static UI data
- Asset paths
const.dart - Application Constants
const.dart - Application Constants
Location:
lib/const.dartGlobal constants used throughout the application.Typical Contents:- API endpoints
- Configuration values
- Default settings
profile_tile.dart - Reusable UI Component
profile_tile.dart - Reusable UI Component
Location:
lib/profile_tile.dartA reusable widget for displaying user profile information in a list tile format.Platform-Specific Directories
Android Configuration
Directory:
android/Contains Android-specific configuration files:app/build.gradle: App-level Gradle configurationbuild.gradle: Project-level Gradle configurationapp/src/main/AndroidManifest.xml: App permissions and metadataapp/google-services.json: Firebase configuration (not in version control)
- Location access (fine and coarse)
- Internet access
- Camera (for profile photos)
- Storage (for image caching)
iOS Configuration
Directory:
ios/Contains iOS-specific configuration files:Runner.xcworkspace: Xcode workspaceRunner/Info.plist: App configuration and permissionsRunner/GoogleService-Info.plist: Firebase configuration (not in version control)Podfile: CocoaPods dependencies
- Location (when in use and always)
- Camera access
- Photo library access
- Notifications
Assets Directory
Assets are declared in
pubspec.yaml and must be registered before use:Application Flow
Authentication Check
RootPage checks Firebase auth state:- If not signed in → Show
LoginPage - If signed in → Show
HomePage - While checking → Show loading screen
Main Interface
HomePage displays three tabs:- Chats with drivers
- Order request form
- Order history and tracking
State Management
The application uses multiple state management approaches:StatefulWidget
Most screens use Flutter’s built-in StatefulWidget for local state management
BLoC Pattern
Credit card functionality uses BLoC (Business Logic Component) pattern for separation of concerns
Firebase Realtime
Real-time data updates from Firebase Database and Firestore using StreamBuilder
SharedPreferences
Local persistent storage for user preferences and cached data
Data Storage
- Firebase Realtime Database
- Cloud Firestore
- SQLite (sqflite)
Structure:Used for: Order requests, real-time location updates, driver-buyer relationships
Testing Structure
Unit Tests
Location:
test/Test individual functions and classes in isolationIntegration Tests
Location:
test_driver/Test complete user flows using flutter_gherkin for BDD-style testingNext Steps
Installation Guide
Set up your development environment
Dependencies
Explore the packages and libraries used