refactor: إعادة تسمية التطبيقات الأربعة siro_* → intaleq_*
المجلدات وأسماء حزم dart واستيراداتها: siro_rider → intaleq_rider siro_driver → intaleq_driver siro_admin → intaleq_admin siro_service → intaleq_service شمل ذلك `name:` في كل pubspec وكل `package:siro_*` في الاستيرادات (115 ملفاً في rider وحده)، وإشارات أسماء المجلدات في docs/ وتعليق في backend/Admin/notifications/broadcast.php. لم تبقَ إشارة واحدة (تحقّقت). + ضُمّت حزم get و get_storage داخل intaleq_driver/packages/ وحُوّلت مساراتها الثلاثة من `../../Intaleq/packages/*` إلى `./packages/*`. كانت تُحل عرضاً إلى مجلد App/Intaleq القديم المجاور — تبعية خارج المستودع تنكسر بأول نقل. لم يبقَ في أي تطبيق تبعية مسار خارج الشجرة. ⚠️ لم تُمسّ بعد: هويات المتاجر (applicationId · PRODUCT_BUNDLE_IDENTIFIER · shorebird app_id) ولا الألوان ولا النصوص المرئية ولا النطاقات — كل منها كوميت منفصل، والهويات تحتاج قرار المالك. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
92dc6b3641
commit
0aab85c732
@@ -0,0 +1,159 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:mobile_scanner/mobile_scanner.dart';
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/transit/transit_driver_controller.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
import 'manual_boarding_page.dart';
|
||||
|
||||
class QRScannerPage extends StatefulWidget {
|
||||
final int stopId;
|
||||
final String stopName;
|
||||
const QRScannerPage({super.key, required this.stopId, required this.stopName});
|
||||
|
||||
@override
|
||||
State<QRScannerPage> createState() => _QRScannerPageState();
|
||||
}
|
||||
|
||||
class _QRScannerPageState extends State<QRScannerPage> {
|
||||
final MobileScannerController _scannerController = MobileScannerController();
|
||||
final AudioPlayer _audioPlayer = AudioPlayer();
|
||||
|
||||
bool _isProcessing = false;
|
||||
String _successMessage = '';
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scannerController.dispose();
|
||||
_audioPlayer.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onDetect(BarcodeCapture capture) async {
|
||||
if (_isProcessing) return;
|
||||
|
||||
final List<Barcode> barcodes = capture.barcodes;
|
||||
if (barcodes.isEmpty) return;
|
||||
|
||||
final String? code = barcodes.first.rawValue;
|
||||
if (code == null || !code.startsWith('transit_board:')) return;
|
||||
|
||||
setState(() {
|
||||
_isProcessing = true;
|
||||
});
|
||||
|
||||
final passengerId = code.replaceAll('transit_board:', '');
|
||||
|
||||
// Play beep sound
|
||||
try {
|
||||
// Assuming you might add a beep sound asset later, or just visual feedback for now.
|
||||
// await _audioPlayer.play(AssetSource('sounds/beep.mp3'));
|
||||
} catch (_) {}
|
||||
|
||||
// Send API Request
|
||||
final c = Get.find<TransitDriverController>();
|
||||
final success = await c.boardPassenger(widget.stopId, passengerId);
|
||||
|
||||
if (success) {
|
||||
setState(() {
|
||||
_successMessage = 'تم صعود الراكب بنجاح ✅'.tr;
|
||||
});
|
||||
// Clear message after 1.5s
|
||||
Future.delayed(const Duration(milliseconds: 1500), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_successMessage = '';
|
||||
_isProcessing = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_successMessage = 'فشل التحقق ❌'.tr;
|
||||
});
|
||||
Future.delayed(const Duration(milliseconds: 2000), () {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_successMessage = '';
|
||||
_isProcessing = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
appBar: AppBar(
|
||||
title: Text('${'Scan Passengers'.tr} - ${widget.stopName}', style: AppStyle.headTitle2.copyWith(color: Colors.white)),
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
iconTheme: const IconThemeData(color: Colors.white),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
MobileScanner(
|
||||
controller: _scannerController,
|
||||
onDetect: _onDetect,
|
||||
),
|
||||
|
||||
// Overlay for scanner target
|
||||
Center(
|
||||
child: Container(
|
||||
width: 250,
|
||||
height: 250,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.accentColor, width: 3),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Processing Overlay
|
||||
if (_isProcessing && _successMessage.isEmpty)
|
||||
Container(
|
||||
color: Colors.black54,
|
||||
child: const Center(
|
||||
child: CircularProgressIndicator(color: AppColor.accentColor),
|
||||
),
|
||||
),
|
||||
|
||||
// Success / Error Message Overlay
|
||||
if (_successMessage.isNotEmpty)
|
||||
Container(
|
||||
color: _successMessage.contains('✅') ? Colors.green.withValues(alpha: 0.8) : Colors.red.withValues(alpha: 0.8),
|
||||
child: Center(
|
||||
child: Text(
|
||||
_successMessage,
|
||||
style: AppStyle.headTitle2.copyWith(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
// Fallback manual list button
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 20,
|
||||
right: 20,
|
||||
child: SizedBox(
|
||||
height: 55,
|
||||
child: MyElevatedButton(
|
||||
onPressed: () {
|
||||
Get.to(() => ManualBoardingPage(stopId: widget.stopId, stopName: widget.stopName));
|
||||
},
|
||||
kolor: AppColor.cardColor,
|
||||
title: 'Manual Passenger List'.tr,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user