git ignore update and edit profile update

This commit is contained in:
2025-02-20 14:01:23 +02:00
parent dd5c2e598e
commit 4e11cbcce5
2 changed files with 50 additions and 44 deletions

3
.gitignore vendored
View File

@@ -12,4 +12,5 @@ Mzansi_Mail/
# database/#innodb_redo/#ib_redo*
.venv
google-chrome-stable_current_amd64.deb
.env
.env
Frontend/android/app/.cxx

View File

@@ -66,58 +66,63 @@ class _MIHProfilePictureState extends State<MIHProfilePicture> {
right: 0,
child: IconButton.filled(
onPressed: () async {
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'png'],
);
// print(
// "Platform: ${MzanziInnovationHub.of(context)!.theme.getPlatform()}");
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
"Web") {
if (result == null) return;
final selectedFile = result.files.first;
setState(() {
widget.onChange(selectedFile);
widget.proPic = selectedFile;
//print("MIH Profile Picture: ${widget.proPic}");
propicPreview = MemoryImage(widget.proPic!.bytes!);
});
setState(() {
widget.proPicController.text = selectedFile.name;
});
} else {
try {
// print(
// "================\nHere for Android\n========================");
if (result != null) {
// print("here 1");
File file = File(result.files.single.path!);
PlatformFile? androidFile = PlatformFile(
path: file.path,
name: file.path.split('/').last,
size: file.lengthSync(),
bytes: await file.readAsBytes(), // Read file bytes
//extension: fileExtension,
);
// print("here 2");
// "Platform: ${MzanziInnovationHub.of(context)!.theme.getPlatform()}");
FilePickerResult? result =
await FilePicker.platform.pickFiles(
type: FileType.image,
);
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
"Web") {
if (result == null) return;
final selectedFile = result.files.first;
setState(() {
// print("here 3");
widget.onChange(androidFile);
// print("here 4");
widget.proPic = androidFile;
// print("here 5");
widget.onChange(selectedFile);
widget.proPic = selectedFile;
//print("MIH Profile Picture: ${widget.proPic}");
//print("bytes: ${widget.proPic!.bytes!}");
propicPreview = FileImage(file);
propicPreview = MemoryImage(widget.proPic!.bytes!);
});
setState(() {
widget.proPicController.text = widget.proPic!.name;
widget.proPicController.text = selectedFile.name;
});
} else {
// User canceled the picker
// print(
// "================\nHere for Android & IOS\n========================");
if (result != null) {
// print("here 1");
File file = File(result.files.single.path!);
PlatformFile? androidFile = PlatformFile(
path: file.path,
name: file.path.split('/').last,
size: file.lengthSync(),
bytes: await file.readAsBytes(), // Read file bytes
//extension: fileExtension,
);
// print("here 2");
setState(() {
// print("here 3");
widget.onChange(androidFile);
// print("here 4");
widget.proPic = androidFile;
// print("here 5");
//print("MIH Profile Picture: ${widget.proPic}");
//print("bytes: ${widget.proPic!.bytes!}");
propicPreview = FileImage(file);
});
setState(() {
widget.proPicController.text = widget.proPic!.name;
});
} else {
print("here in else");
// User canceled the picker
}
}
} catch (e) {
print("Error: $e");
}
},
icon: const Icon(Icons.edit),