Update: 2026-05-07 22:19:17
This commit is contained in:
@@ -14,104 +14,143 @@ class SettingsView extends GetView<SettingsController> {
|
||||
children: [
|
||||
// Custom Top Bar
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top, left: 8, right: 8, bottom: 12),
|
||||
padding: EdgeInsets.only(
|
||||
top: MediaQuery.of(context).padding.top,
|
||||
left: 8,
|
||||
right: 8,
|
||||
bottom: 12),
|
||||
color: isDark ? const Color(0xFF1E1E2E) : const Color(0xFF0F4C81),
|
||||
child: Row(
|
||||
child: const Row(
|
||||
children: [
|
||||
const SizedBox(width: 48),
|
||||
SizedBox(width: 48),
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'الإعدادات',
|
||||
style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 48),
|
||||
SizedBox(width: 48),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
|
||||
Expanded(
|
||||
child: Obx(() => ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildProfileCard(isDark),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('المظهر', Icons.palette_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildSwitchTile(
|
||||
icon: Icons.dark_mode_rounded,
|
||||
title: 'الوضع الداكن',
|
||||
subtitle: 'تفعيل المظهر الداكن للتطبيق',
|
||||
value: controller.isDarkMode.value,
|
||||
onChanged: (v) => controller.toggleTheme(),
|
||||
isDark: isDark,
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('الإشعارات', Icons.notifications_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildSwitchTile(
|
||||
icon: Icons.notifications_active_rounded,
|
||||
title: 'إشعارات الدفع',
|
||||
subtitle: 'استلام إشعارات عند اكتمال المعالجة',
|
||||
value: controller.pushEnabled.value,
|
||||
onChanged: (v) => controller.togglePush(),
|
||||
isDark: isDark,
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle('حول التطبيق', Icons.info_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildInfoTile(
|
||||
icon: Icons.verified_rounded,
|
||||
title: 'الإصدار',
|
||||
trailing: '1.0.0',
|
||||
isDark: isDark,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.diamond_rounded,
|
||||
title: 'الاشتراكات والباقات',
|
||||
trailing: 'ترقية →',
|
||||
isDark: isDark,
|
||||
onTap: () => Get.toNamed(AppRoutes.SUBSCRIPTION),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.support_agent_rounded,
|
||||
title: 'الدعم الفني',
|
||||
trailing: 'support@musadaq.jo',
|
||||
isDark: isDark,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.description_rounded,
|
||||
title: 'سياسة الخصوصية',
|
||||
trailing: '→',
|
||||
isDark: isDark,
|
||||
onTap: () {},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 32),
|
||||
_buildLogoutButton(),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: TextButton(
|
||||
onPressed: () => _confirmDeleteAccount(context),
|
||||
child: const Text(
|
||||
'حذف الحساب',
|
||||
style: TextStyle(color: Colors.red, fontSize: 13, decoration: TextDecoration.underline),
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildProfileCard(isDark),
|
||||
const SizedBox(height: 24),
|
||||
_buildSectionTitle('المظهر', Icons.palette_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildSwitchTile(
|
||||
icon: Icons.dark_mode_rounded,
|
||||
title: 'الوضع الداكن',
|
||||
subtitle: 'تفعيل المظهر الداكن للتطبيق',
|
||||
value: controller.isDarkMode.value,
|
||||
onChanged: (v) => controller.toggleTheme(),
|
||||
isDark: isDark,
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionTitle(
|
||||
'الإشعارات', Icons.notifications_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildSwitchTile(
|
||||
icon: Icons.notifications_active_rounded,
|
||||
title: 'إشعارات الدفع',
|
||||
subtitle: 'استلام إشعارات عند اكتمال المعالجة',
|
||||
value: controller.pushEnabled.value,
|
||||
onChanged: (v) => controller.togglePush(),
|
||||
isDark: isDark,
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Admin Section
|
||||
Obx(() {
|
||||
if (controller.userRole.value == 'admin' ||
|
||||
controller.userRole.value == 'super_admin') {
|
||||
return Column(
|
||||
children: [
|
||||
_buildSectionTitle('إدارة المكتب',
|
||||
Icons.admin_panel_settings_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildInfoTile(
|
||||
icon: Icons.business_rounded,
|
||||
title: 'الشركات والموظفين',
|
||||
trailing: 'إدارة →',
|
||||
isDark: isDark,
|
||||
onTap: () {
|
||||
Get.toNamed(AppRoutes.COMPANIES_MANAGEMENT);
|
||||
},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}),
|
||||
|
||||
_buildSectionTitle('حول التطبيق', Icons.info_rounded, isDark),
|
||||
const SizedBox(height: 8),
|
||||
_buildSettingsCard(isDark, [
|
||||
_buildInfoTile(
|
||||
icon: Icons.verified_rounded,
|
||||
title: 'الإصدار',
|
||||
trailing: '1.0.0',
|
||||
isDark: isDark,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.diamond_rounded,
|
||||
title: 'الاشتراكات والباقات',
|
||||
trailing: 'ترقية →',
|
||||
isDark: isDark,
|
||||
onTap: () => Get.toNamed(AppRoutes.SUBSCRIPTION),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.support_agent_rounded,
|
||||
title: 'الدعم الفني',
|
||||
trailing: 'support@musadaq.jo',
|
||||
isDark: isDark,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_buildInfoTile(
|
||||
icon: Icons.description_rounded,
|
||||
title: 'سياسة الخصوصية',
|
||||
trailing: '→',
|
||||
isDark: isDark,
|
||||
onTap: () {},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 32),
|
||||
_buildLogoutButton(),
|
||||
const SizedBox(height: 16),
|
||||
Center(
|
||||
child: TextButton(
|
||||
onPressed: () => _confirmDeleteAccount(context),
|
||||
child: const Text(
|
||||
'حذف الحساب',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontSize: 13,
|
||||
decoration: TextDecoration.underline),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
)),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -129,52 +168,71 @@ class SettingsView extends GetView<SettingsController> {
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Obx(() => Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
(controller.userName.value.isNotEmpty ? controller.userName.value[0] : 'م').toUpperCase(),
|
||||
style: const TextStyle(color: Colors.white, fontSize: 24, fontWeight: FontWeight.bold),
|
||||
children: [
|
||||
Container(
|
||||
width: 56,
|
||||
height: 56,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
(controller.userName.value.isNotEmpty
|
||||
? controller.userName.value[0]
|
||||
: 'م')
|
||||
.toUpperCase(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
controller.userName.value.isNotEmpty ? controller.userName.value : 'مستخدم مُصادَق',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
controller.userName.value.isNotEmpty
|
||||
? controller.userName.value
|
||||
: 'مستخدم مُصادَق',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
controller.userPhone.value,
|
||||
style: TextStyle(
|
||||
color: Colors.white.withOpacity(0.7),
|
||||
fontSize: 13,
|
||||
fontFamily: 'monospace'),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
controller.userPhone.value,
|
||||
style: TextStyle(color: Colors.white.withOpacity(0.7), fontSize: 13, fontFamily: 'monospace'),
|
||||
),
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFD4AF37).withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFD4AF37).withOpacity(0.5)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFD4AF37).withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: const Color(0xFFD4AF37).withOpacity(0.5)),
|
||||
),
|
||||
child: Text(
|
||||
controller.roleName,
|
||||
style: const TextStyle(color: Color(0xFFF0D060), fontSize: 11, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
child: Text(
|
||||
controller.roleName,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFF0D060),
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -183,7 +241,11 @@ class SettingsView extends GetView<SettingsController> {
|
||||
children: [
|
||||
Icon(icon, size: 18, color: const Color(0xFF0F4C81)),
|
||||
const SizedBox(width: 8),
|
||||
Text(title, style: TextStyle(fontSize: 15, fontWeight: FontWeight.w700, color: isDark ? Colors.white70 : const Color(0xFF0F4C81))),
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: isDark ? Colors.white70 : const Color(0xFF0F4C81))),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -193,7 +255,8 @@ class SettingsView extends GetView<SettingsController> {
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? const Color(0xFF1E1E2E) : Colors.white,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: isDark ? Colors.white10 : Colors.grey.shade200),
|
||||
border:
|
||||
Border.all(color: isDark ? Colors.white10 : Colors.grey.shade200),
|
||||
),
|
||||
child: Column(children: children),
|
||||
);
|
||||
@@ -218,8 +281,13 @@ class SettingsView extends GetView<SettingsController> {
|
||||
),
|
||||
child: Icon(icon, color: const Color(0xFF0F4C81), size: 20),
|
||||
),
|
||||
title: Text(title, style: TextStyle(fontWeight: FontWeight.w600, color: isDark ? Colors.white : Colors.black87)),
|
||||
subtitle: Text(subtitle, style: TextStyle(fontSize: 12, color: isDark ? Colors.white38 : Colors.grey)),
|
||||
title: Text(title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isDark ? Colors.white : Colors.black87)),
|
||||
subtitle: Text(subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: isDark ? Colors.white38 : Colors.grey)),
|
||||
trailing: Switch.adaptive(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
@@ -247,8 +315,13 @@ class SettingsView extends GetView<SettingsController> {
|
||||
),
|
||||
child: Icon(icon, color: const Color(0xFF0F4C81), size: 20),
|
||||
),
|
||||
title: Text(title, style: TextStyle(fontWeight: FontWeight.w600, color: isDark ? Colors.white : Colors.black87)),
|
||||
trailing: Text(trailing, style: TextStyle(fontSize: 13, color: isDark ? Colors.white38 : Colors.grey)),
|
||||
title: Text(title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isDark ? Colors.white : Colors.black87)),
|
||||
trailing: Text(trailing,
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: isDark ? Colors.white38 : Colors.grey)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -262,10 +335,12 @@ class SettingsView extends GetView<SettingsController> {
|
||||
backgroundColor: const Color(0xFFFEE2E2),
|
||||
foregroundColor: const Color(0xFFDC2626),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
shape:
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
|
||||
),
|
||||
icon: const Icon(Icons.logout_rounded),
|
||||
label: const Text('تسجيل الخروج', style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16)),
|
||||
label: const Text('تسجيل الخروج',
|
||||
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16)),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -287,7 +362,8 @@ class SettingsView extends GetView<SettingsController> {
|
||||
void _confirmDeleteAccount(BuildContext context) {
|
||||
Get.defaultDialog(
|
||||
title: '⚠️ حذف الحساب',
|
||||
middleText: 'سيتم حذف جميع بياناتك نهائياً. هذا الإجراء لا يمكن التراجع عنه.',
|
||||
middleText:
|
||||
'سيتم حذف جميع بياناتك نهائياً. هذا الإجراء لا يمكن التراجع عنه.',
|
||||
textConfirm: 'حذف نهائي',
|
||||
textCancel: 'إلغاء',
|
||||
confirmTextColor: Colors.white,
|
||||
|
||||
Reference in New Issue
Block a user