MIH Profile Links
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user