استكمال قرار 2026-07-27 (كوميت fff76c9 أرشف الباك إند):
apps/rider → apps/rider-archive-cubit
apps/driver → apps/driver-archive-cubit
dashboards/admin-web → dashboards/admin-web-archive
dashboards/service-web → dashboards/service-web-archive
إعادة تسمية بلا تعديل محتوى. rider/driver كانا إعادة بناء Cubit مبنية على
عقد NestJS المؤرشف. admin-web و service-web نموذجان بملف HTML واحد (164 و
128 سطراً) — يحلّ محلهما siro_admin و siro_service المكتملان.
يُحمل من المؤرشف ولا يُعاد اكتشافه: عقد map-saas المثبَّت بالتجربة في
apps/rider-archive-cubit/lib/core/api/ (x-api-key ترويسة، reverse مصفوفة،
route في points) ودرس مسار FCM.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
99 lines
2.4 KiB
Dart
99 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:trip_overlay_plugin/trip_overlay_plugin.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
TripOverlayPlugin.initialize();
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatefulWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
State<MyApp> createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
bool _isOverlayActive = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
// Listen to overlay events
|
|
TripOverlayPlugin.onTripAccepted.listen((result) {
|
|
debugPrint('Trip accepted: ${result.tripId}');
|
|
});
|
|
TripOverlayPlugin.onTripRejected.listen((tripId) {
|
|
debugPrint('Trip rejected/expired: $tripId');
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
TripOverlayPlugin.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
Future<void> _showOverlay() async {
|
|
final granted = await TripOverlayPlugin.isPermissionGranted();
|
|
if (!granted) {
|
|
await TripOverlayPlugin.requestPermission();
|
|
return;
|
|
}
|
|
|
|
final tripData = TripData(
|
|
tripId: 'TRIP_12345',
|
|
passengerName: 'Hamza A.',
|
|
pickupAddress: 'Amman, Jordan',
|
|
dropoffAddress: 'Irbid, Jordan',
|
|
distanceKm: 85.0,
|
|
estimatedFare: 25.0,
|
|
estimatedMinutes: 90,
|
|
pickupLat: 31.9539,
|
|
pickupLng: 35.9106,
|
|
);
|
|
|
|
final result = await TripOverlayPlugin.showOverlay(tripData);
|
|
setState(() {
|
|
_isOverlayActive = result;
|
|
});
|
|
}
|
|
|
|
Future<void> _hideOverlay() async {
|
|
await TripOverlayPlugin.hideOverlay();
|
|
setState(() {
|
|
_isOverlayActive = false;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
home: Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Trip Overlay Example'),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text('Overlay Active: $_isOverlayActive'),
|
|
const SizedBox(height: 20),
|
|
ElevatedButton(
|
|
onPressed: _showOverlay,
|
|
child: const Text('Show Overlay'),
|
|
),
|
|
const SizedBox(height: 10),
|
|
ElevatedButton(
|
|
onPressed: _hideOverlay,
|
|
child: const Text('Hide Overlay'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|