المجلدات وأسماء حزم 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>
40 lines
1.2 KiB
Dart
40 lines
1.2 KiB
Dart
import 'package:battery_plus/battery_plus.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class BatteryNotifier {
|
|
static final Battery _battery = Battery();
|
|
static int? _lastNotifiedLevel;
|
|
|
|
static Future<void> checkBatteryAndNotify() async {
|
|
try {
|
|
final int batteryLevel = await _battery.batteryLevel;
|
|
|
|
// ✅ لا تكرر الإشعار إذا الفرق قليل
|
|
if (_lastNotifiedLevel != null &&
|
|
(batteryLevel >= _lastNotifiedLevel! - 2)) return;
|
|
|
|
if (batteryLevel <= 30) {
|
|
Color backgroundColor = Colors.yellow;
|
|
if (batteryLevel <= 20) {
|
|
backgroundColor = Colors.red;
|
|
}
|
|
|
|
Get.snackbar(
|
|
"⚠️ تنبيه البطارية", // العنوان
|
|
"مستوى البطارية: $batteryLevel٪", // النص
|
|
snackPosition: SnackPosition.TOP,
|
|
backgroundColor: backgroundColor,
|
|
colorText: Colors.white,
|
|
duration: const Duration(seconds: 10), // مدة الظهور
|
|
margin: const EdgeInsets.all(10),
|
|
);
|
|
|
|
_lastNotifiedLevel = batteryLevel;
|
|
}
|
|
} catch (e) {
|
|
print('Battery check error: $e');
|
|
}
|
|
}
|
|
}
|