chore: استيراد أولي من سيرو (ecfe7568) — بلا أي تعديل

نسخة كاملة من مستودع سيرو عند ecfe7568 لتكون أساس تطبيق «انطلق».
نُسخ المتعقَّب في git فقط (12,509 ملفاً / 302 م.ب) بـ git archive، لا
`cp -r` — فاستُثنيت تلقائياً مخلفات البناء (build · node_modules ·
.dart_tool · .gradle · Pods ≈ 10.7 غ.ب) وكل ما يستثنيه .gitignore.

هذا الكوميت **بلا أي تعديل عمداً** حتى يكون كل ما يليه فرقاً مقروءاً
مقابل سيرو الأصلي. سيرو نفسه لم يُمسّ.

⚠️ لا يبني بعد: `.env` و`lib/env/env.g.dart` غير متعقَّبين في سيرو (وهذا
صحيح — أسرار لكل مستأجر). كل تطبيق فلاتر هنا يحتاج .env خاصاً بانطلق ثم
توليد env.g.dart عبر build_runner. لا تُنسخ أسرار سيرو.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hamza-Ayed
2026-07-27 05:10:29 +03:00
co-authored by Claude Opus 5
commit 92dc6b3641
3654 changed files with 896478 additions and 0 deletions
@@ -0,0 +1,455 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:get/get.dart';
import '../../../controller/admin/kazan_controller.dart';
import '../../../views/widgets/snackbar.dart';
import '../../widgets/elevated_btn.dart';
class KazanEditorPage extends StatelessWidget {
KazanEditorPage({super.key});
final KazanController controller = Get.put(KazanController());
@override
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
return Scaffold(
backgroundColor: cs.surface,
body: Column(
children: [
Container(
padding: const EdgeInsets.fromLTRB(16, 50, 16, 16),
child: Row(
children: [
GestureDetector(
onTap: () => Get.back(),
child: Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(10),
border: Border.all(color: cs.outline),
),
child: Icon(Icons.arrow_back_ios_new_rounded,
color: cs.onSurfaceVariant, size: 16),
),
),
const SizedBox(width: 12),
Text('تعديل أسعار كازان'.tr,
style: TextStyle(
color: cs.onSurface,
fontSize: 17,
fontWeight: FontWeight.bold)),
],
),
),
Expanded(
child: Column(
children: [
_buildCountryDropdown(cs),
Expanded(
child: Obx(() => controller.isLoading.value && controller.kazanData.isEmpty
? Center(child: CircularProgressIndicator(color: cs.primary))
: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSectionHeader('⚙️ الإعدادات العامة', cs),
_buildGeneralSettings(cs),
const SizedBox(height: 24),
_buildSectionHeader('🚗 أسعار الكيلومتر لكل نوع سيارة', cs),
_buildKmPricesGrid(cs),
const SizedBox(height: 24),
_buildSectionHeader('⏱️ أسعار الدقيقة (حسب وقت اليوم)', cs),
_buildMinutePrices(cs),
const SizedBox(height: 32),
MyElevatedButton(
title: '💾 حفظ جميع التعديلات',
icon: Icons.save_rounded,
onPressed: () => _handleSave(),
),
const SizedBox(height: 100),
],
),
)),
),
],
),
),
],
),
);
}
Widget _buildCountryDropdown(ColorScheme cs) {
return Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(16, 12, 16, 4),
child: Obx(() => Container(
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(14),
border: Border.all(color: cs.outline),
),
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value: controller.selectedCountry.value,
isExpanded: true,
icon: const Icon(Icons.keyboard_arrow_down_rounded),
style: GoogleFonts.inter(fontWeight: FontWeight.w600, fontSize: 16, color: cs.onSurface),
items: controller.countries.map((c) {
return DropdownMenuItem<String>(
value: c['name'],
child: Row(
children: [
Text(c['flag']!, style: const TextStyle(fontSize: 22)),
const SizedBox(width: 12),
Text(c['name']!),
],
),
);
}).toList(),
onChanged: (val) {
if (val != null) controller.setCountry(val);
},
),
),
)),
);
}
Widget _buildGeneralSettings(ColorScheme cs) {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outline),
),
child: Column(
children: [
_buildSliderItem(
'نسبة كازان العامة (عمولة المنصة)',
'kazanPercent',
'النسبة المئوية التي تقتطعها المنصة من كل رحلة',
Icons.percent_rounded,
cs,
),
Divider(height: 32, color: cs.outline),
_buildPriceInputRow(
'سعر الوقود المرجعي',
'fuelPrice',
'السعر المستخدم في حسابات تعويض الوقود',
Icons.local_gas_station_rounded,
cs,
),
Divider(height: 32, color: cs.outline),
_buildPriceInputRow(
'رمز العملة',
'currency',
'مثال: SYP, EGP, JOD, IQD',
Icons.currency_exchange_rounded,
cs,
),
],
),
);
}
Widget _buildKmPricesGrid(ColorScheme cs) {
final Map<String, Map<String, dynamic>> priceFields = {
'speedPrice': {
'label': 'Speed ⚡',
'icon': Icons.flash_on_rounded,
'color': Colors.amber.shade700
},
'comfortPrice': {
'label': 'Comfort ❄️',
'icon': Icons.chair_rounded,
'color': Colors.blue.shade700
},
'ladyPrice': {
'label': 'Lady 👩',
'icon': Icons.female_rounded,
'color': Colors.pink.shade400
},
'electricPrice': {
'label': 'Electric 🔋',
'icon': Icons.electric_car_rounded,
'color': Colors.green.shade700
},
'vanPrice': {
'label': 'Van 🚐',
'icon': Icons.airport_shuttle_rounded,
'color': Colors.deepPurple.shade700
},
'deliveryPrice': {
'label': 'Delivery 📦',
'icon': Icons.delivery_dining_rounded,
'color': Colors.orange.shade700
},
'mishwarVipPrice': {
'label': 'Mishwar Vip ⭐',
'icon': Icons.star_rounded,
'color': Colors.amber.shade900
},
'fixedPrice': {
'label': 'Fixed Price 💰',
'icon': Icons.money_rounded,
'color': Colors.teal.shade700
},
'awfarPrice': {
'label': 'Awfar Car 🚗',
'icon': Icons.directions_car_rounded,
'color': Colors.brown.shade600
},
};
return Container(
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outline),
),
padding: const EdgeInsets.all(12),
child: GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 1.8,
crossAxisSpacing: 8,
mainAxisSpacing: 8,
),
itemCount: priceFields.length,
itemBuilder: (context, index) {
String key = priceFields.keys.elementAt(index);
var field = priceFields[key]!;
return _buildKmPriceCard(
key, field['label'], field['icon'], field['color'], cs);
},
),
);
}
Widget _buildKmPriceCard(
String key, String label, IconData icon, Color color, ColorScheme cs) {
final TextEditingController textController =
TextEditingController(text: _getValue(key));
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
decoration: BoxDecoration(
color: color.withAlpha(25),
borderRadius: BorderRadius.circular(8),
border: Border.all(color: color.withAlpha(80)),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Icon(icon, size: 14, color: color),
const SizedBox(width: 4),
Expanded(
child: Text(
label,
style: GoogleFonts.inter(fontSize: 10, fontWeight: FontWeight.bold, color: cs.onSurfaceVariant),
overflow: TextOverflow.ellipsis,
),
),
],
),
const SizedBox(height: 4),
Row(
children: [
Expanded(
child: TextField(
controller: textController,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
style: GoogleFonts.jetBrainsMono(fontSize: 13, fontWeight: FontWeight.bold, color: color),
decoration: const InputDecoration(
border: InputBorder.none,
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2),
),
onChanged: (val) => _setValue(key, val),
),
),
],
),
],
),
);
}
Widget _buildMinutePrices(ColorScheme cs) {
final Map<String, Map<String, dynamic>> minuteFields = {
'normalMinPrice': {
'label': 'Normal (سعر الدقيقة العادي)',
'desc': '9 ص - 2 م / 6 م - 9 م',
'icon': Icons.wb_sunny_rounded,
'color': Colors.orange
},
'peakMinPrice': {
'label': 'Peak (سعر الدقيقة ذروة)',
'desc': '2 م - 5 م',
'icon': Icons.whatshot_rounded,
'color': Colors.red
},
'lateMinPrice': {
'label': 'Late (سعر الدقيقة ليلي)',
'desc': '9 م - 1 ص',
'icon': Icons.nightlight_round,
'color': Colors.indigo
},
};
return Container(
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: cs.outline),
),
padding: const EdgeInsets.all(16),
child: Column(
children: minuteFields.entries.map((entry) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: _buildPriceInputRow(
entry.value['label'],
entry.key,
entry.value['desc'],
entry.value['icon'],
cs,
),
);
}).toList(),
),
);
}
Widget _buildSectionHeader(String title, ColorScheme cs) {
return Padding(
padding: const EdgeInsets.only(bottom: 12, left: 4),
child: Text(
title,
style: GoogleFonts.inter(fontWeight: FontWeight.w600, color: cs.primary),
),
);
}
String _getValue(String key) {
return controller.kazanData[key]?.toString() ?? '0';
}
void _setValue(String key, String val) {
controller.kazanData[key] = val;
}
Widget _buildPriceInputRow(
String title, String key, String desc, IconData icon, ColorScheme cs) {
final TextEditingController textController =
TextEditingController(text: _getValue(key));
return Row(
children: [
Icon(icon, size: 20, color: cs.primary),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title,
style: GoogleFonts.inter(fontSize: 14, color: cs.onSurface, fontWeight: FontWeight.bold)),
Text(desc, style: GoogleFonts.inter(fontSize: 10, color: cs.onSurfaceVariant)),
],
),
),
Container(
width: 100,
height: 40,
decoration: BoxDecoration(
color: cs.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: cs.outline),
),
child: TextField(
controller: textController,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
style: GoogleFonts.jetBrainsMono(fontSize: 16, fontWeight: FontWeight.bold, color: cs.primary),
decoration: const InputDecoration(
border: InputBorder.none,
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 10),
),
onChanged: (val) => _setValue(key, val),
),
),
],
);
}
Widget _buildSliderItem(
String title, String key, String desc, IconData icon, ColorScheme cs) {
double value = double.tryParse(_getValue(key)) ?? 0;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(icon, size: 18, color: cs.primary),
const SizedBox(width: 8),
Text(title, style: GoogleFonts.inter(fontWeight: FontWeight.w600, color: cs.onSurface)),
],
),
Text(
'${value.toInt()}%',
style: GoogleFonts.jetBrainsMono(fontSize: 18, fontWeight: FontWeight.bold, color: cs.onSurface),
),
],
),
const SizedBox(height: 4),
Text(desc, style: GoogleFonts.inter(color: cs.onSurfaceVariant, fontSize: 12)),
Slider(
value: value.clamp(0, 100),
min: 0,
max: 100,
activeColor: cs.primary,
inactiveColor: cs.outline,
onChanged: (val) {
_setValue(key, val.toInt().toString());
},
),
],
);
}
void _handleSave() async {
final data = Map<String, dynamic>.from(controller.kazanData);
data['adminId'] = 'admin1';
if (!data.containsKey('country') ||
data['country'] == null ||
data['country'].toString().isEmpty) {
data['country'] = controller.selectedCountryCode;
}
bool success = await controller.updateKazan(data);
if (success) {
mySnackbarSuccess('تم تحديث أسعار ${controller.selectedCountry.value} بنجاح');
} else {
mySnackbarError('فشل تحديث الأسعار');
}
}
}