sod_taxi 1.0.1
sod_taxi: ^1.0.1 copied to clipboard
Core SDK package for SOD Taxi application
sod_taxi #
The Taxi SDK package for the SOD application platform, built on top of sod_core. It provides Parse server setup, delegates for custom interaction widgets (such as chat and call buttons), and pre-built navigation routes for trip tracking and location selection.
Features #
- Parse Server Integration: Automatic setup and configuration for Parse Server.
- Custom Widget Delegates: Easily integrate custom chat and call interaction widgets into your application.
- Navigation Routes: Pre-configured navigation routes for common taxi flows like trip tracking and location selection.
- Core SDK Features: Built upon
sod_core, inheriting its features for host/tenant configuration and localization.
Installation #
Add sod_taxi as a dependency in your pubspec.yaml:
dependencies:
sod_taxi:
path: path/to/sdk/sod_taxi
Then run:
flutter pub get
Getting Started & Usage #
1. Initialize with Core Configuration #
Start by configuring the host and tenant using sod_core, then initialize the taxi SDK.
import 'package:sod_core/sod_core.dart';
import 'package:sod_taxi/sod_taxi.dart';
void main() async {
// 1. Configure the host environment using sod_core
final config = CoreConfig(
tenantId: 'sod_user',
appIdentifier: 'sod_user_app',
baseUrl: 'https://api.sod.vn',
serverUrl: 'https://web.sod.vn',
appName: 'SOD',
appTitle: 'Super App SOD',
appId: 'your_app_id',
masterKey: 'your_master_key',
clientKey: 'your_client_key',
chatKey: 'your_chat_key',
appIconFolder: 'sod_user',
);
CoreSDK.setupHost(config);
// 2. Initialize the application with an external user
final user = ExternalUser(
id: 'user_12345',
name: 'John Doe',
email: 'john.doe@example.com',
phone: '+84900000000',
token: 'jwt_auth_token_here',
);
await CoreSDK.init(
externalUser: user,
enableChat: true, // Enable chat features
enableMap: true, // Enable map features
enableAnalytics: true,
);
// 3. Use the TaxiDelegate for custom interactions
final delegate = TaxiDelegate();
// Example: Use the delegate to build a chat button
final chatWidget = delegate.buildChatButton(
chatKey: 'taxi_chat',
showBadge: true,
onTap: () {
// Handle chat button tap
},
);
}
2. Integrate Navigation Routes #
Use the provided navigation routes for common taxi workflows.
import 'package:sod_taxi/sod_taxi.dart';
// Navigate to the trip tracking screen
onTapTrackTrip: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => TripTrackingPage(tripId: 'your_trip_id'),
),
);
}
// Navigate to the location selection screen
onTapSelectLocation: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => const LocationSelectionPage(),
),
);
}
API Reference #
CoreSDK #
| Method / Property | Description |
|---|