Update Saqel Platform: 2026-08-31 01:52:23
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
/// Enterprise Logging Utility for Saqel Admin & Schools Management
|
||||
/// Active in Debug mode (kDebugMode), completely silent in Production
|
||||
class AppLogger {
|
||||
AppLogger._();
|
||||
|
||||
static void log(String message, {String tag = 'ADMIN_APP'}) {
|
||||
if (kDebugMode) {
|
||||
debugPrint('[$tag] $message');
|
||||
}
|
||||
}
|
||||
|
||||
static void request({
|
||||
required String method,
|
||||
required Uri uri,
|
||||
Map<String, String>? headers,
|
||||
dynamic body,
|
||||
}) {
|
||||
if (!kDebugMode) return;
|
||||
|
||||
final buffer = StringBuffer();
|
||||
buffer.writeln('\n🌐 ─── [HTTP REQUEST (ADMIN)] ───────────────────────────────────');
|
||||
buffer.writeln('➡️ Method: $method');
|
||||
buffer.writeln('🔗 URL: $uri');
|
||||
if (headers != null && headers.isNotEmpty) {
|
||||
final safeHeaders = Map<String, String>.from(headers);
|
||||
if (safeHeaders.containsKey('Authorization')) {
|
||||
final auth = safeHeaders['Authorization']!;
|
||||
safeHeaders['Authorization'] = auth.length > 20 ? '${auth.substring(0, 15)}...' : 'Bearer [REDACTED]';
|
||||
}
|
||||
buffer.writeln('📋 Headers: ${jsonEncode(safeHeaders)}');
|
||||
}
|
||||
if (body != null) {
|
||||
buffer.writeln('📦 Body: ${body is String ? body : jsonEncode(body)}');
|
||||
}
|
||||
buffer.writeln('───────────────────────────────────────────────────────────────');
|
||||
debugPrint(buffer.toString());
|
||||
}
|
||||
|
||||
static void response({
|
||||
required String method,
|
||||
required Uri uri,
|
||||
required int statusCode,
|
||||
dynamic responseBody,
|
||||
Duration? duration,
|
||||
}) {
|
||||
if (!kDebugMode) return;
|
||||
|
||||
final isSuccess = statusCode >= 200 && statusCode < 300;
|
||||
final emoji = isSuccess ? '✅' : '⚠️';
|
||||
final buffer = StringBuffer();
|
||||
|
||||
buffer.writeln('\n$emoji ─── [HTTP RESPONSE $statusCode (ADMIN)] ───────────────────────');
|
||||
buffer.writeln('⬅️ Method: $method');
|
||||
buffer.writeln('🔗 URL: $uri');
|
||||
if (duration != null) {
|
||||
buffer.writeln('⏱️ Time: ${duration.inMilliseconds}ms');
|
||||
}
|
||||
if (responseBody != null) {
|
||||
buffer.writeln('📦 Data: ${responseBody is String ? responseBody : jsonEncode(responseBody)}');
|
||||
}
|
||||
buffer.writeln('───────────────────────────────────────────────────────────────');
|
||||
debugPrint(buffer.toString());
|
||||
}
|
||||
|
||||
static void error(String message, {dynamic error, StackTrace? stackTrace, String tag = 'ADMIN_ERROR'}) {
|
||||
if (!kDebugMode) return;
|
||||
|
||||
final buffer = StringBuffer();
|
||||
buffer.writeln('\n🚨 ─── [ERROR: $tag] ──────────────────────────────────────────');
|
||||
buffer.writeln('❌ Message: $message');
|
||||
if (error != null) {
|
||||
buffer.writeln('⚠️ Error: $error');
|
||||
}
|
||||
if (stackTrace != null) {
|
||||
buffer.writeln('📍 Trace: \n$stackTrace');
|
||||
}
|
||||
buffer.writeln('───────────────────────────────────────────────────────────────');
|
||||
debugPrint(buffer.toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Ultra-Luxury Apple-Grade SnackBar / Toast Notification System for Saqel Apps
|
||||
class SaqelToast {
|
||||
SaqelToast._();
|
||||
|
||||
static const Color _teacherEmerald = Color(0xFF10B981);
|
||||
static const Color _errorRed = Color(0xFFEF4444);
|
||||
static const Color _appleBlue = Color(0xFF0071E3);
|
||||
static const Color _whatsappGreen = Color(0xFF25D366);
|
||||
|
||||
/// Show Success Toast (Emerald / Green)
|
||||
static void showSuccess(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
String? title,
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
}) {
|
||||
_show(
|
||||
context: context,
|
||||
message: message,
|
||||
title: title,
|
||||
icon: CupertinoIcons.checkmark_circle_fill,
|
||||
iconColor: _teacherEmerald,
|
||||
borderColor: _teacherEmerald.withAlpha(90),
|
||||
backgroundColor: const Color(0xE60D1A14),
|
||||
duration: duration,
|
||||
);
|
||||
}
|
||||
|
||||
/// Show Error Toast (Crimson / Red)
|
||||
static void showError(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
String? title,
|
||||
Duration duration = const Duration(seconds: 4),
|
||||
}) {
|
||||
_show(
|
||||
context: context,
|
||||
message: message,
|
||||
title: title,
|
||||
icon: CupertinoIcons.exclamationmark_circle_fill,
|
||||
iconColor: _errorRed,
|
||||
borderColor: _errorRed.withAlpha(90),
|
||||
backgroundColor: const Color(0xE61A0D0D),
|
||||
duration: duration,
|
||||
);
|
||||
}
|
||||
|
||||
/// Show Info Toast (Apple Blue / Cyan)
|
||||
static void showInfo(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
String? title,
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
}) {
|
||||
_show(
|
||||
context: context,
|
||||
message: message,
|
||||
title: title,
|
||||
icon: CupertinoIcons.info_circle_fill,
|
||||
iconColor: _appleBlue,
|
||||
borderColor: _appleBlue.withAlpha(90),
|
||||
backgroundColor: const Color(0xE60D1424),
|
||||
duration: duration,
|
||||
);
|
||||
}
|
||||
|
||||
/// Show WhatsApp Toast (WhatsApp Green)
|
||||
static void showWhatsApp(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
String? title,
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
}) {
|
||||
_show(
|
||||
context: context,
|
||||
message: message,
|
||||
title: title,
|
||||
icon: CupertinoIcons.chat_bubble_fill,
|
||||
iconColor: _whatsappGreen,
|
||||
borderColor: _whatsappGreen.withAlpha(100),
|
||||
backgroundColor: const Color(0xE6091A12),
|
||||
duration: duration,
|
||||
);
|
||||
}
|
||||
|
||||
static void _show({
|
||||
required BuildContext context,
|
||||
required String message,
|
||||
String? title,
|
||||
required IconData icon,
|
||||
required Color iconColor,
|
||||
required Color borderColor,
|
||||
required Color backgroundColor,
|
||||
required Duration duration,
|
||||
}) {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
messenger.hideCurrentSnackBar();
|
||||
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
duration: duration,
|
||||
elevation: 0,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
margin: const EdgeInsets.only(bottom: 24, left: 16, right: 16),
|
||||
padding: EdgeInsets.zero,
|
||||
backgroundColor: Colors.transparent,
|
||||
content: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
border: Border.all(color: borderColor, width: 1.2),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x99000000),
|
||||
blurRadius: 25,
|
||||
offset: Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: iconColor.withAlpha(35),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, color: iconColor, size: 20),
|
||||
),
|
||||
const SizedBox(width: 14),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (title != null && title.isNotEmpty) ...[
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
],
|
||||
Text(
|
||||
message,
|
||||
style: const TextStyle(
|
||||
fontSize: 12.5,
|
||||
color: Color(0xFFE2E8F0),
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const SaqelAdminApp());
|
||||
}
|
||||
|
||||
class SaqelAdminApp extends StatelessWidget {
|
||||
const SaqelAdminApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'صَقِل - الإدارة والمدارس',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
scaffoldBackgroundColor: const Color(0xFF0A0E17),
|
||||
fontFamily: '-apple-system',
|
||||
fontFamilyFallback: const [
|
||||
'SF Pro Display',
|
||||
'SF Pro Text',
|
||||
'SF Arabic',
|
||||
'Geeza Pro',
|
||||
'Cairo',
|
||||
'system-ui',
|
||||
],
|
||||
colorScheme: ColorScheme.fromSeed(
|
||||
seedColor: const Color(0xFF8B5CF6),
|
||||
brightness: Brightness.dark,
|
||||
surface: const Color(0xFF111827),
|
||||
primary: const Color(0xFF8B5CF6),
|
||||
),
|
||||
),
|
||||
home: const AdminHomeScreen(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AdminHomeScreen extends StatelessWidget {
|
||||
const AdminHomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: Alignment(0.0, -0.6),
|
||||
radius: 1.2,
|
||||
colors: [
|
||||
Color(0xFF25134A),
|
||||
Color(0xFF0A0E17),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 580),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFF8B5CF6), Color(0xFFA78BFA)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x4D8B5CF6),
|
||||
blurRadius: 25,
|
||||
offset: Offset(0, 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'إ',
|
||||
style: TextStyle(
|
||||
fontSize: 42,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const Text(
|
||||
'إدارة منصة صَقِل وشبكة المدارس',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 28,
|
||||
fontWeight: FontWeight.w800,
|
||||
letterSpacing: -0.5,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
'لوحة تحكم B2B: إدارة كشوفات المدارس، تراخيص الثقافة العسكرية، والرقابة المركزية',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF94A3B8),
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 36),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(24),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xCC161F30),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(
|
||||
color: const Color(0x14FFFFFF),
|
||||
),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x66000000),
|
||||
blurRadius: 30,
|
||||
offset: Offset(0, 15),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 10,
|
||||
height: 10,
|
||||
decoration: const BoxDecoration(
|
||||
color: Color(0xFFA78BFA),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
const Expanded(
|
||||
child: Text(
|
||||
'التحكم المركزي والأمان (Enterprise Governance)',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Color(0xFFA78BFA),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildFeatureRow('🏫 كشوفات المدارس (Rosters)', 'الربط التلقائي بالرقم الوطني واستيراد CSV'),
|
||||
_buildFeatureRow('💼 التراخيص وحصص المعلمين', 'متابعة المبيعات، العقود، والأرباح'),
|
||||
_buildFeatureRow('🛡️ الرقابة والامتثال', 'حظر القرصنة، مراقبة استهلاك الخوادم وبوابة نبيه'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color(0xFF8B5CF6),
|
||||
foregroundColor: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
child: const Text(
|
||||
'دخول لوحة الإدارة المركزية 🏢',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
static Widget _buildFeatureRow(String title, String subtitle) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
fontSize: 13.5,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
subtitle,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF64748B),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user