refactor(tactical-app): modernize state management with GetX controllers, bindings, and clean MVP architecture
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intaleq_maps/intaleq_maps.dart';
|
||||
import '../models/military_operations_models.dart';
|
||||
|
||||
/// ============================================================================
|
||||
/// [OverlaysController] - وحدة التحكم بمنظومة الشفافات العسكرية التكتيكية (IPB)
|
||||
/// ============================================================================
|
||||
/// English:
|
||||
/// GetX Controller managing Intelligence Preparation of Battlefield (IPB)
|
||||
/// transparent overlays, FEBA lines, mobility corridors, and No-Fire Areas.
|
||||
///
|
||||
/// العربية:
|
||||
/// متحكم GetX لإدارة منظومة الشفافات العسكرية التكتيكية (IPB)،
|
||||
/// والخطوط الأمامية لمنطقة القتال (FEBA)، وممرات الحركة، ومناطق حظر الرماية.
|
||||
/// ============================================================================
|
||||
class OverlaysController extends GetxController {
|
||||
// ── Observables / الحالات التفاعلية ──────────────────────────────────────
|
||||
final RxList<TacticalOverlayLayer> overlayLayers = <TacticalOverlayLayer>[
|
||||
TacticalOverlayLayer(
|
||||
id: 'layer_feba',
|
||||
nameAr: 'الخط الأمامي لمنطقة القتال (FEBA / FLOT)',
|
||||
color: const Color(0xFF0071E3),
|
||||
isVisible: true,
|
||||
lines: [
|
||||
[
|
||||
const LatLng(32.1000, 35.7500),
|
||||
const LatLng(32.0200, 35.8500),
|
||||
const LatLng(31.9500, 35.9000),
|
||||
const LatLng(31.8500, 35.9800),
|
||||
]
|
||||
],
|
||||
),
|
||||
TacticalOverlayLayer(
|
||||
id: 'layer_mobility',
|
||||
nameAr: 'ممرات الحركة ومحاور التقدم (Mobility Corridors)',
|
||||
color: const Color(0xFF10B981),
|
||||
isVisible: true,
|
||||
lines: [
|
||||
[
|
||||
const LatLng(31.9539, 35.9106),
|
||||
const LatLng(32.0000, 35.9500),
|
||||
const LatLng(32.0500, 36.0200),
|
||||
]
|
||||
],
|
||||
),
|
||||
TacticalOverlayLayer(
|
||||
id: 'layer_no_fire',
|
||||
nameAr: 'مناطق الحظر وعدم الرماية (No-Fire Areas - NFA)',
|
||||
color: const Color(0xFFEF4444),
|
||||
isVisible: false,
|
||||
polygons: [
|
||||
[
|
||||
const LatLng(31.9800, 35.9300),
|
||||
const LatLng(32.0000, 35.9300),
|
||||
const LatLng(32.0000, 35.9600),
|
||||
const LatLng(31.9800, 35.9600),
|
||||
const LatLng(31.9800, 35.9300),
|
||||
]
|
||||
],
|
||||
),
|
||||
].obs;
|
||||
|
||||
/// Toggle Overlay Layer Visibility / تبديل إظهار أو إخفاء طبقة معينة
|
||||
void toggleLayer(String layerId, bool isVisible) {
|
||||
final idx = overlayLayers.indexWhere((l) => l.id == layerId);
|
||||
if (idx != -1) {
|
||||
overlayLayers[idx] = overlayLayers[idx].copyWith(isVisible: isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
/// Show All Overlay Layers / إظهار كافة الشفافات
|
||||
void showAll() {
|
||||
for (int i = 0; i < overlayLayers.length; i++) {
|
||||
overlayLayers[i] = overlayLayers[i].copyWith(isVisible: true);
|
||||
}
|
||||
}
|
||||
|
||||
/// Hide All Overlay Layers / إخفاء كافة الشفافات
|
||||
void hideAll() {
|
||||
for (int i = 0; i < overlayLayers.length; i++) {
|
||||
overlayLayers[i] = overlayLayers[i].copyWith(isVisible: false);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user