git ignore update and edit profile update
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -13,3 +13,4 @@ Mzansi_Mail/
|
|||||||
.venv
|
.venv
|
||||||
google-chrome-stable_current_amd64.deb
|
google-chrome-stable_current_amd64.deb
|
||||||
.env
|
.env
|
||||||
|
Frontend/android/app/.cxx
|
||||||
@@ -66,58 +66,63 @@ class _MIHProfilePictureState extends State<MIHProfilePicture> {
|
|||||||
right: 0,
|
right: 0,
|
||||||
child: IconButton.filled(
|
child: IconButton.filled(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
FilePickerResult? result =
|
try {
|
||||||
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 {
|
|
||||||
// print(
|
// print(
|
||||||
// "================\nHere for Android\n========================");
|
// "Platform: ${MzanziInnovationHub.of(context)!.theme.getPlatform()}");
|
||||||
if (result != null) {
|
FilePickerResult? result =
|
||||||
// print("here 1");
|
await FilePicker.platform.pickFiles(
|
||||||
File file = File(result.files.single.path!);
|
type: FileType.image,
|
||||||
PlatformFile? androidFile = PlatformFile(
|
);
|
||||||
path: file.path,
|
|
||||||
name: file.path.split('/').last,
|
if (MzanziInnovationHub.of(context)!.theme.getPlatform() ==
|
||||||
size: file.lengthSync(),
|
"Web") {
|
||||||
bytes: await file.readAsBytes(), // Read file bytes
|
if (result == null) return;
|
||||||
//extension: fileExtension,
|
final selectedFile = result.files.first;
|
||||||
);
|
|
||||||
// print("here 2");
|
|
||||||
setState(() {
|
setState(() {
|
||||||
// print("here 3");
|
widget.onChange(selectedFile);
|
||||||
widget.onChange(androidFile);
|
widget.proPic = selectedFile;
|
||||||
// print("here 4");
|
|
||||||
widget.proPic = androidFile;
|
|
||||||
// print("here 5");
|
|
||||||
//print("MIH Profile Picture: ${widget.proPic}");
|
//print("MIH Profile Picture: ${widget.proPic}");
|
||||||
//print("bytes: ${widget.proPic!.bytes!}");
|
propicPreview = MemoryImage(widget.proPic!.bytes!);
|
||||||
propicPreview = FileImage(file);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.proPicController.text = widget.proPic!.name;
|
widget.proPicController.text = selectedFile.name;
|
||||||
});
|
});
|
||||||
} else {
|
} 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),
|
icon: const Icon(Icons.edit),
|
||||||
|
|||||||
Reference in New Issue
Block a user