mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 16:48:56 +03:30
Set search for labels by api
This commit is contained in:
@@ -58,7 +58,7 @@ class LabelsProvider extends ChangeNotifier {
|
||||
|
||||
void setLoading() {
|
||||
isloading = true;
|
||||
// notifyListeners();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool isloadingButton = false;
|
||||
@@ -223,14 +223,32 @@ class LabelsProvider extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void search(String value) {
|
||||
Future<void> search(String value) async {
|
||||
items = [];
|
||||
searchBoxValue = value;
|
||||
originalItems!.forEach((result) {
|
||||
if (result.packageName.toString().contains(searchBoxValue)) {
|
||||
items!.add(result);
|
||||
}
|
||||
});
|
||||
|
||||
var response = await http.get(
|
||||
Uri.parse(Url.searchLabels(value)),
|
||||
headers: {
|
||||
'Authorization': User.token,
|
||||
},
|
||||
);
|
||||
|
||||
var testResultData = json.decode(response.body);
|
||||
for (var item in testResultData['data']) {
|
||||
items!.add(
|
||||
LabelResultObject(
|
||||
expireDate: item['expire_date'],
|
||||
id: item['id'].toString(),
|
||||
packageName: item['package'] != null
|
||||
? item['package']['name'].toString()
|
||||
: ' ',
|
||||
packageId:
|
||||
item['package'] != null ? item['package']['id'].toString() : ' ',
|
||||
),
|
||||
);
|
||||
}
|
||||
resetLoading();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -281,7 +299,8 @@ class LabelsProvider extends ChangeNotifier {
|
||||
);
|
||||
}
|
||||
pageNumber += 1;
|
||||
search('');
|
||||
items = originalItems;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<LabelDetailsObject> showLabelResult(String id) async {
|
||||
|
||||
Reference in New Issue
Block a user