5.3 KiB
5.3 KiB
Fleet Driver App - Setup Guide
Overview
This is a mobile application for drivers to manage their delivery routes, handle pickups/dropoffs, and navigate to destinations using Google Maps integration.
Prerequisites
- Flutter SDK 3.7.2 or higher
- Dart SDK
- Android Studio / Xcode
- Google Maps API Key
Getting Started
1. Install Dependencies
flutter pub get
2. Configure Google Maps API Key
Get Your API Key
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the following APIs:
- Maps SDK for Android
- Maps SDK for iOS
- Directions API (for navigation)
- Places API (optional, for address autocomplete)
- Create credentials (API Key)
- Copy your API key
Android Configuration
- Open
android/app/src/main/AndroidManifest.xml - Replace
YOUR_GOOGLE_MAPS_API_KEY_HEREwith your actual API key:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_ACTUAL_API_KEY"/>
iOS Configuration
- Open
ios/Runner/AppDelegate.swift - Replace
YOUR_GOOGLE_MAPS_API_KEY_HEREwith your actual API key:
GMSServices.provideAPIKey("YOUR_ACTUAL_API_KEY")
3. Configure Backend API (Optional)
If you have a backend API, update the API configuration in:
lib/core/constants/app_constants.dart
static const String baseApiUrl = 'https://your-api-url.com/api';
4. Run the App
Android
flutter run
iOS
cd ios
pod install
cd ..
flutter run
Project Structure
lib/
├── core/
│ ├── constants/ # App-wide constants
│ ├── theme/ # App theme and colors
│ ├── utils/ # Utility functions
│ └── widgets/ # Reusable widgets
│
├── features/
│ ├── routes/
│ │ ├── data/
│ │ │ ├── models/ # Data models
│ │ │ └── repositories/
│ │ ├── domain/
│ │ │ ├── entities/
│ │ │ └── repositories/
│ │ └── presentation/
│ │ ├── pages/ # UI screens
│ │ ├── widgets/ # Feature-specific widgets
│ │ └── providers/ # State management
│ │
│ └── navigation/
│
├── services/
│ ├── location/ # Location services
│ ├── maps/ # Navigation services
│ └── api/ # API services
│
└── main.dart # App entry point
Features
Current Features
-
Route Management
- View assigned routes
- Track route progress
- Start/complete routes
-
Stop Management
- View pickup and dropoff locations
- Navigate to stops
- Mark stops as completed
- View stop details (customer info, items, etc.)
-
Map Integration
- View all stops on a map
- Real-time location tracking
- Navigate to destinations using Google Maps
-
Status Tracking
- Route status (not started, in progress, completed)
- Stop status (pending, in progress, completed, failed)
- Progress indicators
Upcoming Features
- Photo capture for proof of delivery
- Signature collection
- Offline mode
- Push notifications
- Route optimization
- Driver performance metrics
API Integration
The app is designed to work with a backend API. The main API endpoints expected are:
GET /routes/:driverId- Get driver routesGET /routes/detail/:routeId- Get route detailsPUT /routes/:routeId/status- Update route statusPUT /stops/:stopId/status- Update stop statusPOST /stops/:stopId/issue- Report an issue
Mock Data for Development
If you don't have a backend yet, you can modify the RouteApiService to return mock data:
// In lib/services/api/route_api_service.dart
Future<List<RouteModel>> getDriverRoutes(String driverId) async {
// Return mock data instead of API call
return [
// Your mock route data here
];
}
Permissions
Android
The following permissions are configured in AndroidManifest.xml:
INTERNET- For API callsACCESS_FINE_LOCATION- For precise locationACCESS_COARSE_LOCATION- For approximate locationFOREGROUND_SERVICE- For background location tracking
iOS
The following permissions are configured in Info.plist:
- Location When In Use
- Location Always (for background tracking)
Troubleshooting
Google Maps Not Showing
- Verify your API key is correct
- Make sure you've enabled the required APIs in Google Cloud Console
- Check if you've restricted your API key (it should allow your app's package name)
Location Not Working
- Check device location settings are enabled
- Grant location permissions when prompted
- Test on a real device (emulators may have location issues)
Build Errors
# Clean and rebuild
flutter clean
flutter pub get
flutter run
Testing
# Run tests
flutter test
# Run with coverage
flutter test --coverage
Building for Production
Android
flutter build apk --release
# or
flutter build appbundle --release
iOS
flutter build ios --release
Support
For issues or questions, please contact your development team or refer to the Flutter documentation at https://flutter.dev/docs