MIH Profile Links

This commit is contained in:
2026-05-27 15:36:56 +02:00
parent 33d07b1617
commit 052f937027
30 changed files with 2240 additions and 499 deletions
@@ -25,6 +25,7 @@ class MzansiProfileProvider extends ChangeNotifier {
List<AppUser> userSearchResults = [];
bool hideBusinessUserDetails;
List<ProfileLink> personalLinks = [];
List<ProfileLink> businessLinks = [];
MzansiProfileProvider({
this.personalHome = true,
@@ -156,4 +157,30 @@ class MzansiProfileProvider extends ChangeNotifier {
this.personalLinks = personalLinks;
notifyListeners();
}
void setBusinessLinks({required List<ProfileLink> businessLinks}) {
this.businessLinks = businessLinks;
notifyListeners();
}
void deleteProfileLink({required int linkId}) {
personalLinks.removeWhere((link) => link.idprofile_links == linkId);
businessLinks.removeWhere((link) => link.idprofile_links == linkId);
notifyListeners();
}
void editProfileLink({required ProfileLink updatedLink}) {
int personalIndex = personalLinks.indexWhere(
(link) => link.idprofile_links == updatedLink.idprofile_links);
int businessIndex = businessLinks.indexWhere(
(link) => link.idprofile_links == updatedLink.idprofile_links);
if (personalIndex != -1) {
personalLinks[personalIndex] = updatedLink;
}
if (businessIndex != -1) {
businessLinks[personalIndex] = updatedLink;
}
notifyListeners();
}
}