mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:58:56 +03:30
39 lines
766 B
Dart
39 lines
766 B
Dart
import '../config/urls.dart';
|
|
import '../config/user.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:http/http.dart' as http;
|
|
|
|
class TestResult with ChangeNotifier{
|
|
final int id;
|
|
final String name;
|
|
final String date;
|
|
final String deviceId;
|
|
String result;
|
|
|
|
bool get isVerified {
|
|
return result == 'Verified';
|
|
}
|
|
|
|
TestResult({
|
|
this.id,
|
|
this.name,
|
|
this.date,
|
|
this.deviceId,
|
|
this.result,
|
|
});
|
|
|
|
Future<void> toggleVerify() async {
|
|
final response = await http.post(
|
|
Uri.parse(Url.verifyTest(id)), headers: {
|
|
'Authorization': User.token
|
|
}
|
|
);
|
|
|
|
if (response.statusCode == 200) {
|
|
result = result == 'Verified' ? 'NotVerified' : 'Verified';
|
|
notifyListeners();
|
|
}
|
|
|
|
}
|
|
}
|