Files
tripz-llc/apps/driver/lib/views/home/Captin/assurance_health_page.dart
T
Hamza-AyedandClaude Opus 5 4d8414c96b feat: استيراد كود سيرو إلى تريبز (سيرو @ecfe7568) — بلا تعديل
قرار المالك 2026-07-27: باك إند سيرو PHP هو المعتمد، وتطبيقاته المجرّبة
ميدانياً تحل محل إعادة البناء المؤرشفة. سيرو نفسه لم يُمسّ.

الخريطة:
  backend · payment_server · loction_server · ride_server ·
  passenger_server · docker · dashboard · stress_test  → الجذر
  siro_rider  → apps/rider          siro_driver  → apps/driver
  siro_admin  → dashboards/admin    siro_service → dashboards/service
  android_bot → apps/android_bot    socialBot    → apps/socialBot

نُسخ المتعقَّب في git سيرو فقط عبر `git archive` (3,198 ملفاً / ~169 م.ب)
لا `cp -r` — فاستُثنيت مخلفات البناء تلقائياً. بلا أي تعديل محتوى عمداً:
كل ما يلي يصير فرقاً مقروءاً مقابل المصدر.

لم يُستورد وسببه: siromove.com (الموقع التسويقي يبقى marketing/ في تريبز،
سيرو فيه 8 ملفات) · docs و planning (تريبز له docs/ الخاص) · deploy.sh
(ليس نشراً على سيرفر بل `git add . && git push origin --all` — فخّ في
مستودع آخر) · transit_dashboard (بانتظار قرار مصير backend-transit و
dashboards/transit-web).

⚠️ لا يبني بعد — ثلاثة نواقص متوقعة ومقصودة:
1. `.env` و `lib/env/env.g.dart` غير متعقَّبين في سيرو (أسرار لكل مستأجر):
   كل تطبيق فلاتر يحتاج .env خاصاً ثم توليد env.g.dart بـ build_runner.
2. إعدادات Firebase (9 ملفات google-services.json و GoogleService-Info.plist)
   يستبعدها .gitignore تريبز — ولكل مستأجر مشروع Firebase خاص أصلاً.
3. apps/driver في سيرو يشير إلى `../../Intaleq/packages/get` خارج المستودع →
   يجب ضمّ الحزم داخله أسوة بـ apps/rider.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 05:14:13 +03:00

192 lines
7.0 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../constant/colors.dart';
import '../../../controller/home/captin/help/assurance_controller.dart';
import 'package:flutter/cupertino.dart';
import '../../widgets/my_scafold.dart';
class AssuranceHealthPage extends StatelessWidget {
AssuranceHealthPage({super.key});
final AssuranceHealthController assuranceHealthController =
Get.put(AssuranceHealthController());
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return MyScafolld(
title: "Health Insurance".tr,
isleading: true,
body: [
GetBuilder<AssuranceHealthController>(
builder: (controller) {
return SingleChildScrollView(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
"When you complete 500 trips, you will be eligible for exclusive health insurance offers."
.tr,
textAlign: TextAlign.center,
style: theme.textTheme.titleMedium?.copyWith(
color:
theme.textTheme.bodyMedium?.color?.withOpacity(0.8),
height: 1.5,
),
),
const SizedBox(height: 24),
Card(
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16)),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () =>
controller.getTripCountByCaptain(),
style: ElevatedButton.styleFrom(
backgroundColor: AppColor.primaryColor,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
padding:
const EdgeInsets.symmetric(vertical: 12),
),
child: Text("Show My Trip Count".tr),
),
),
const SizedBox(width: 16),
_buildTripCountAvatar(
controller.tripCount['count'] == null
? '0'
: controller.tripCount['count'].toString(),
),
],
),
),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.all(18),
decoration: BoxDecoration(
color: theme.colorScheme.surfaceVariant.withOpacity(0.5),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: theme.dividerColor),
),
child: Text(
"We have partnered with health insurance providers to offer you special health coverage. Complete 500 trips and receive a 20% discount on health insurance premiums."
.tr,
style: theme.textTheme.bodyLarge
?.copyWith(fontWeight: FontWeight.w500),
textAlign: TextAlign.center,
),
),
const SizedBox(height: 32),
ElevatedButton(
onPressed: () => _showInsuranceDialog(context, controller),
style: ElevatedButton.styleFrom(
backgroundColor: AppColor.primaryColor,
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12)),
),
child: Text(
"Would you like to proceed with health insurance?".tr,
style: const TextStyle(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),
],
),
);
},
),
],
);
}
void _showInsuranceDialog(
BuildContext context, AssuranceHealthController controller) {
final TextEditingController providerController = TextEditingController();
Get.dialog(
AlertDialog(
title: Text("Confirmation".tr),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text("Would you like to proceed with health insurance?".tr),
const SizedBox(height: 16),
TextField(
controller: providerController,
decoration: InputDecoration(
hintText: "Do you have a disease for a long time?".tr,
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
),
],
),
actions: [
TextButton(
onPressed: () => Get.back(),
child: Text("No".tr, style: const TextStyle(color: Colors.red)),
),
ElevatedButton(
onPressed: () async {
if (providerController.text.isNotEmpty) {
await controller.addDriverHealthAssurance(
healthInsuranceProvider: providerController.text,
);
Get.back();
} else {
Get.snackbar("Error".tr,
"Please provide details about any long-term diseases.".tr);
}
},
child: Text("Yes".tr),
),
],
),
);
}
Widget _buildTripCountAvatar(String count) {
return Container(
width: 70,
height: 70,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: const LinearGradient(
colors: [Color(0xFF42A5F5), Color(0xFF1976D2)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: Center(
child: Text(
count,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
);
}
}