إصلاح توافق فلاتر مع Theme الجديد
This commit is contained in:
@@ -7,19 +7,6 @@ import 'package:siro_admin/views/widgets/snackbar.dart';
|
||||
|
||||
import '../../print.dart';
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// DESIGN TOKENS (same as AdminHomePage)
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
const Color _bg = Color(0xFF0D1117);
|
||||
const Color _surface = Color(0xFF161B22);
|
||||
const Color _surfaceElevated = Color(0xFF1C2333);
|
||||
const Color _accent = Color(0xFF00D4AA);
|
||||
const Color _warning = Color(0xFFFFCB6B);
|
||||
const Color _info = Color(0xFF82AAFF);
|
||||
const Color _textPrimary = Color(0xFFE6EDF3);
|
||||
const Color _textSecondary = Color(0xFF7D8590);
|
||||
const Color _divider = Color(0xFF21262D);
|
||||
|
||||
class PackageUpdateScreen extends StatelessWidget {
|
||||
PackageUpdateScreen({super.key});
|
||||
|
||||
@@ -27,19 +14,20 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
return Scaffold(
|
||||
backgroundColor: _bg,
|
||||
appBar: _buildAppBar(),
|
||||
backgroundColor: cs.surface,
|
||||
appBar: _buildAppBar(cs),
|
||||
body: GetBuilder<PackageController>(
|
||||
builder: (controller) {
|
||||
if (controller.isLoading.value) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(color: _accent, strokeWidth: 2),
|
||||
return Center(
|
||||
child: CircularProgressIndicator(color: cs.primary, strokeWidth: 2),
|
||||
);
|
||||
}
|
||||
|
||||
if (controller.packages.isEmpty) {
|
||||
return _buildEmptyState();
|
||||
return _buildEmptyState(cs);
|
||||
}
|
||||
|
||||
return ListView.separated(
|
||||
@@ -48,7 +36,7 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||
itemBuilder: (context, index) {
|
||||
final package = controller.packages[index];
|
||||
return _buildPackageCard(context, package, controller);
|
||||
return _buildPackageCard(context, package, controller, cs);
|
||||
},
|
||||
);
|
||||
},
|
||||
@@ -56,10 +44,9 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────── APP BAR ───────────────────────────
|
||||
PreferredSizeWidget _buildAppBar() {
|
||||
PreferredSizeWidget _buildAppBar(ColorScheme cs) {
|
||||
return AppBar(
|
||||
backgroundColor: _bg,
|
||||
backgroundColor: cs.surface,
|
||||
elevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
leading: GestureDetector(
|
||||
@@ -67,12 +54,12 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: _surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: const Icon(Icons.arrow_back_ios_new_rounded,
|
||||
color: _textSecondary, size: 16),
|
||||
child: Icon(Icons.arrow_back_ios_new_rounded,
|
||||
color: cs.onSurfaceVariant, size: 16),
|
||||
),
|
||||
),
|
||||
title: Row(
|
||||
@@ -80,18 +67,18 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(7),
|
||||
decoration: BoxDecoration(
|
||||
color: _accent.withOpacity(0.12),
|
||||
color: cs.primary.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(9),
|
||||
border: Border.all(color: _accent.withOpacity(0.25)),
|
||||
border: Border.all(color: cs.primary.withValues(alpha: 0.25)),
|
||||
),
|
||||
child: const Icon(Icons.system_update_rounded,
|
||||
color: _accent, size: 16),
|
||||
child: Icon(Icons.system_update_rounded,
|
||||
color: cs.primary, size: 16),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
const Text(
|
||||
Text(
|
||||
'تحديث التطبيق',
|
||||
style: TextStyle(
|
||||
color: _textPrimary,
|
||||
color: cs.onSurface,
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -105,25 +92,24 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(right: 16),
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: _surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: const Icon(Icons.refresh_rounded,
|
||||
color: _textSecondary, size: 18),
|
||||
child: Icon(Icons.refresh_rounded,
|
||||
color: cs.onSurfaceVariant, size: 18),
|
||||
),
|
||||
),
|
||||
],
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(1),
|
||||
child: Container(height: 1, color: _divider),
|
||||
child: Container(height: 1, color: cs.outline),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────── PACKAGE CARD ───────────────────────────
|
||||
Widget _buildPackageCard(
|
||||
BuildContext context, dynamic package, PackageController controller) {
|
||||
BuildContext context, dynamic package, PackageController controller, ColorScheme cs) {
|
||||
final platform = package['platform']?.toString() ?? '';
|
||||
final isAndroid = platform.toLowerCase().contains('android');
|
||||
final isIOS = platform.toLowerCase().contains('ios');
|
||||
@@ -131,8 +117,8 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
final Color platformColor = isAndroid
|
||||
? const Color(0xFF4CAF50)
|
||||
: isIOS
|
||||
? _info
|
||||
: _warning;
|
||||
? cs.tertiary
|
||||
: cs.tertiary;
|
||||
final IconData platformIcon = isAndroid
|
||||
? Icons.android_rounded
|
||||
: isIOS
|
||||
@@ -142,20 +128,19 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
onTap: () => _showUpdateDialog(context, package, controller),
|
||||
onTap: () => _showUpdateDialog(context, package, controller, cs),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
splashColor: _accent.withOpacity(0.06),
|
||||
splashColor: cs.primary.withValues(alpha: 0.06),
|
||||
highlightColor: Colors.transparent,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: _surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Platform Icon
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
@@ -164,27 +149,24 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [
|
||||
platformColor.withOpacity(0.20),
|
||||
platformColor.withOpacity(0.06),
|
||||
platformColor.withValues(alpha: 0.20),
|
||||
platformColor.withValues(alpha: 0.06),
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(13),
|
||||
border: Border.all(color: platformColor.withOpacity(0.25)),
|
||||
border: Border.all(color: platformColor.withValues(alpha: 0.25)),
|
||||
),
|
||||
child: Icon(platformIcon, color: platformColor, size: 22),
|
||||
),
|
||||
|
||||
const SizedBox(width: 14),
|
||||
|
||||
// Info
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
package['appName']?.toString() ?? '—',
|
||||
style: const TextStyle(
|
||||
color: _textPrimary,
|
||||
style: TextStyle(
|
||||
color: cs.onSurface,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -195,31 +177,29 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
_buildTag(platform, platformColor),
|
||||
const SizedBox(width: 6),
|
||||
_buildVersionBadge(
|
||||
package['version']?.toString() ?? '?'),
|
||||
package['version']?.toString() ?? '?', cs),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Update button
|
||||
Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 12, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: _accent.withOpacity(0.10),
|
||||
color: cs.primary.withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: _accent.withOpacity(0.25)),
|
||||
border: Border.all(color: cs.primary.withValues(alpha: 0.25)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: const [
|
||||
Icon(Icons.edit_rounded, color: _accent, size: 13),
|
||||
SizedBox(width: 5),
|
||||
children: [
|
||||
Icon(Icons.edit_rounded, color: cs.primary, size: 13),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'تعديل',
|
||||
style: TextStyle(
|
||||
color: _accent,
|
||||
color: cs.primary,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -238,7 +218,7 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.10),
|
||||
color: color.withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
@@ -252,17 +232,17 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildVersionBadge(String version) {
|
||||
Widget _buildVersionBadge(String version, ColorScheme cs) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
|
||||
decoration: BoxDecoration(
|
||||
color: _divider,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
'v$version',
|
||||
style: const TextStyle(
|
||||
color: _textSecondary,
|
||||
style: TextStyle(
|
||||
color: cs.onSurfaceVariant,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontFamily: 'monospace',
|
||||
@@ -271,8 +251,7 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────── EMPTY STATE ───────────────────────────
|
||||
Widget _buildEmptyState() {
|
||||
Widget _buildEmptyState(ColorScheme cs) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -280,30 +259,29 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: _surface,
|
||||
color: cs.surfaceContainerHighest,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: const Icon(Icons.inventory_2_outlined,
|
||||
color: _textSecondary, size: 32),
|
||||
child: Icon(Icons.inventory_2_outlined,
|
||||
color: cs.onSurfaceVariant, size: 32),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
const Text('لا توجد حزم متاحة',
|
||||
Text('لا توجد حزم متاحة',
|
||||
style: TextStyle(
|
||||
color: _textPrimary,
|
||||
color: cs.onSurface,
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 6),
|
||||
const Text('اسحب للأسفل لإعادة التحميل',
|
||||
style: TextStyle(color: _textSecondary, fontSize: 12)),
|
||||
Text('اسحب للأسفل لإعادة التحميل',
|
||||
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ─────────────────────────── UPDATE DIALOG ───────────────────────────
|
||||
void _showUpdateDialog(
|
||||
BuildContext context, dynamic package, PackageController controller) {
|
||||
BuildContext context, dynamic package, PackageController controller, ColorScheme cs) {
|
||||
controller.versionController.clear();
|
||||
|
||||
Get.dialog(
|
||||
@@ -311,9 +289,9 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _surfaceElevated,
|
||||
color: cs.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black54,
|
||||
@@ -327,107 +305,95 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Header
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: _accent.withOpacity(0.12),
|
||||
color: cs.primary.withValues(alpha: 0.12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: _accent.withOpacity(0.25)),
|
||||
border: Border.all(color: cs.primary.withValues(alpha: 0.25)),
|
||||
),
|
||||
child: const Icon(Icons.system_update_rounded,
|
||||
color: _accent, size: 20),
|
||||
child: Icon(Icons.system_update_rounded,
|
||||
color: cs.primary, size: 20),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'تحديث الإصدار',
|
||||
style: TextStyle(
|
||||
color: _textPrimary,
|
||||
color: cs.onSurface,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
package['appName']?.toString() ?? '',
|
||||
style: const TextStyle(
|
||||
color: _textSecondary, fontSize: 11),
|
||||
style: TextStyle(
|
||||
color: cs.onSurfaceVariant, fontSize: 11),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 20),
|
||||
Container(height: 1, color: _divider),
|
||||
Container(height: 1, color: cs.outline),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// Current info
|
||||
Row(
|
||||
children: [
|
||||
_buildInfoChip(Icons.devices_rounded,
|
||||
package['platform']?.toString() ?? '', _info),
|
||||
package['platform']?.toString() ?? '', cs.tertiary),
|
||||
const SizedBox(width: 8),
|
||||
_buildInfoChip(Icons.tag_rounded,
|
||||
'الحالي: ${package['version']}', _warning),
|
||||
'الحالي: ${package['version']}', cs.tertiary),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 18),
|
||||
|
||||
// Input label
|
||||
const Text(
|
||||
Text(
|
||||
'الإصدار الجديد',
|
||||
style: TextStyle(
|
||||
color: _textSecondary,
|
||||
color: cs.onSurfaceVariant,
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 0.8,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
|
||||
// Text input
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _bg,
|
||||
color: cs.surface,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(color: _divider),
|
||||
border: Border.all(color: cs.outline),
|
||||
),
|
||||
child: TextField(
|
||||
controller: controller.versionController,
|
||||
keyboardType:
|
||||
const TextInputType.numberWithOptions(decimal: true),
|
||||
style: const TextStyle(
|
||||
color: _textPrimary,
|
||||
style: TextStyle(
|
||||
color: cs.onSurface,
|
||||
fontSize: 15,
|
||||
fontFamily: 'monospace',
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: package['version'].toString(),
|
||||
hintStyle: const TextStyle(
|
||||
color: _textSecondary,
|
||||
hintStyle: TextStyle(
|
||||
color: cs.onSurfaceVariant,
|
||||
fontFamily: 'monospace',
|
||||
),
|
||||
prefixIcon:
|
||||
const Icon(Icons.tag_rounded, color: _accent, size: 18),
|
||||
Icon(Icons.tag_rounded, color: cs.primary, size: 18),
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 14, vertical: 14),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// Actions
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -437,12 +403,12 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: const BorderSide(color: _divider),
|
||||
side: BorderSide(color: cs.outline),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'إلغاء',
|
||||
style: TextStyle(color: _textSecondary, fontSize: 13),
|
||||
style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -450,11 +416,11 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Obx(() => ElevatedButton.icon(
|
||||
icon: controller.isLoading.value
|
||||
? const SizedBox(
|
||||
? SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
color: cs.onPrimary,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
@@ -464,8 +430,8 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
style: const TextStyle(fontSize: 13),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: _accent,
|
||||
foregroundColor: _bg,
|
||||
backgroundColor: cs.primary,
|
||||
foregroundColor: cs.surface,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -495,9 +461,9 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withOpacity(0.08),
|
||||
color: color.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: color.withOpacity(0.2)),
|
||||
border: Border.all(color: color.withValues(alpha: 0.2)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -518,9 +484,6 @@ class PackageUpdateScreen extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
// CONTROLLER
|
||||
// ══════════════════════════════════════════════════════════════
|
||||
class PackageController extends GetxController {
|
||||
List packages = [];
|
||||
var isLoading = false.obs;
|
||||
|
||||
Reference in New Issue
Block a user