Update: 2026-08-02 22:51:18

This commit is contained in:
Hamza-Ayed
2026-08-02 22:51:18 +03:00
parent c9af364cbc
commit 2c962bf80a
39 changed files with 627 additions and 191 deletions
+24
View File
@@ -478,6 +478,30 @@ extension ThemeExtensions on BuildContext {
bool get isDark => brightness == Brightness.dark;
}
// ─── Semantic Colors on ColorScheme (light/dark adaptive, no BuildContext) ────
//
// ColorScheme في ماتيريال لا يحتوي خانات لـ success / warning، فكانت الشاشات
// تكتب قيمها الست عشرية مباشرة (0xFF10B981 و 0xFFF59E0B ...). المشكلة أن تلك
// القيم هي نسخة الثيم الداكن وحدها، فتبقى كما هي في الوضع الفاتح ويظهر التصميم
// غير متناسق.
//
// هذا الامتداد يشتق اللون من brightness الخاص بالـ ColorScheme نفسه، فلا يحتاج
// BuildContext ويصلح للاستعمال داخل الدوال المساعدة التي تستقبل `cs` فقط.
// للأماكن التي يتوفر فيها context استخدم AppColors.* أدناه.
extension SemanticColorScheme on ColorScheme {
bool get _isDark => brightness == Brightness.dark;
Color get success => _isDark ? const Color(0xFF10B981) : const Color(0xFF059669);
Color get successSoft => _isDark ? const Color(0x2610B981) : const Color(0x1A059669);
Color get warning => _isDark ? const Color(0xFFF59E0B) : const Color(0xFFD97706);
Color get warningSoft => _isDark ? const Color(0x26F59E0B) : const Color(0x1AD97706);
Color get danger => _isDark ? const Color(0xFFEF4444) : const Color(0xFFDC2626);
Color get dangerSoft => _isDark ? const Color(0x26EF4444) : const Color(0x1ADC2626);
Color get info => _isDark ? const Color(0xFF3B82F6) : const Color(0xFF2563EB);
Color get infoSoft => _isDark ? const Color(0x263B82F6) : const Color(0x1A2563EB);
Color get textMuted => _isDark ? const Color(0xFF6B7280) : const Color(0xFF9CA3AF);
}
// ─── Semantic Color Getters (light/dark adaptive) ─────────────────────────────
// These replace direct AppColor.* usage in views. They automatically adapt
// based on the current theme brightness.