cwtch-ui/lib/torstatus.dart

33 lines
681 B
Dart
Raw Normal View History

2021-06-24 23:10:45 +00:00
import 'package:flutter/material.dart';
class TorStatus extends ChangeNotifier {
int progress;
String status;
bool connected;
String version;
TorStatus({this.connected = false, this.progress = 0, this.status = "", this.version = ""});
/// Called by the event bus.
2024-02-14 04:02:33 +00:00
handleUpdate(int newProgress, String newStatus) {
2021-06-24 23:10:45 +00:00
if (progress == 100) {
connected = true;
} else {
connected = false;
}
2024-02-14 04:02:33 +00:00
progress = newProgress;
status = newStatus;
if (newProgress != 100) {
status = "$newProgress% - $newStatus";
}
2021-06-24 23:10:45 +00:00
notifyListeners();
}
2024-02-14 04:02:33 +00:00
updateVersion(String newVersion) {
version = newVersion;
2021-06-24 23:10:45 +00:00
notifyListeners();
}
}