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:
+111
@@ -0,0 +1,111 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:siro_driver/constant/box_name.dart';
|
||||
import 'package:siro_driver/constant/links.dart';
|
||||
import 'package:siro_driver/controller/functions/crud.dart';
|
||||
import 'package:siro_driver/main.dart';
|
||||
import 'package:siro_driver/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
|
||||
class ProfileController extends GetxController {
|
||||
bool isloading = false;
|
||||
Map prfoileData = {};
|
||||
TextEditingController txtController = TextEditingController();
|
||||
List genders = ['Male', 'Female', 'Non-binary'];
|
||||
|
||||
String gender = 'Male';
|
||||
|
||||
void setGender(String value) {
|
||||
gender = value;
|
||||
}
|
||||
|
||||
String? selectedDegree;
|
||||
|
||||
void setDegree(String? degree) {
|
||||
selectedDegree = degree;
|
||||
update();
|
||||
}
|
||||
|
||||
String? selectedCountry;
|
||||
|
||||
void setCountry(String? country) {
|
||||
selectedCountry = country;
|
||||
// box.write(BoxName.countryCode, country);
|
||||
update();
|
||||
}
|
||||
|
||||
updateColumn(Map<String, dynamic> payload) async {
|
||||
isloading = true;
|
||||
update();
|
||||
await CRUD().post(link: AppLink.updateprofile, payload: payload);
|
||||
await getProfile();
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
updatField(String columnName, TextInputType type) async {
|
||||
Get.defaultDialog(
|
||||
title: '${'Update'.tr} $columnName',
|
||||
content: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .7,
|
||||
child: MyTextForm(
|
||||
controller: txtController,
|
||||
label: 'type here'.tr,
|
||||
hint: 'type here',
|
||||
type: type)
|
||||
// TextField(
|
||||
// controller: txtController,
|
||||
// decoration: const InputDecoration(
|
||||
// border: OutlineInputBorder(), hintText: 'type here'),
|
||||
// ),
|
||||
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () {
|
||||
updateColumn({
|
||||
'id': box.read(BoxName.passengerID),
|
||||
columnName: txtController.text,
|
||||
});
|
||||
if (columnName == 'first_name') {
|
||||
box.write(BoxName.name, txtController.text);
|
||||
}
|
||||
Get.back();
|
||||
txtController.clear();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getProfile() async {
|
||||
isloading = true;
|
||||
update();
|
||||
var res = await CRUD().get(link: AppLink.getprofile, payload: {
|
||||
'id': box.read(BoxName.passengerID).toString(),
|
||||
});
|
||||
|
||||
if (res.toString() == 'failure') {
|
||||
// Get.snackbar('failure', 'message');
|
||||
isloading = false;
|
||||
update();
|
||||
} else {
|
||||
var jsonDecoded = jsonDecode(res);
|
||||
prfoileData = jsonDecoded['data'];
|
||||
isloading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getProfile();
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user