11/9/1
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
@@ -48,40 +50,41 @@ class ProfileController extends GetxController {
|
||||
}
|
||||
|
||||
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'),
|
||||
// ),
|
||||
|
||||
Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('${'Update'.tr} $columnName'),
|
||||
content: Column(
|
||||
children: [
|
||||
const SizedBox(height: 16), // Add spacing between title and input
|
||||
CupertinoTextField(
|
||||
controller: txtController,
|
||||
placeholder: 'type here'.tr,
|
||||
keyboardType: type,
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: CupertinoColors.lightBackgroundGray),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
await updateColumn({
|
||||
'id': box.read(BoxName.passengerID),
|
||||
columnName: txtController.text,
|
||||
});
|
||||
if (columnName == 'first_name') {
|
||||
box.write(BoxName.name, txtController.text);
|
||||
}
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
CupertinoButton(
|
||||
color: AppColor.blueColor,
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
await updateColumn({
|
||||
'id': box.read(BoxName.passengerID),
|
||||
columnName: txtController.text,
|
||||
});
|
||||
if (columnName == 'first_name') {
|
||||
box.write(BoxName.name, txtController.text);
|
||||
}
|
||||
|
||||
txtController.clear();
|
||||
},
|
||||
)
|
||||
],
|
||||
txtController.clear();
|
||||
},
|
||||
child: Text('Update'.tr),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user