Line data Source code
1 : import 'package:flutter/material.dart'; 2 : 3 : class TorStatus extends ChangeNotifier { 4 : int progress; 5 : String status; 6 : bool connected; 7 : String version; 8 : 9 0 : TorStatus({this.connected = false, this.progress = 0, this.status = "", this.version = ""}); 10 : 11 : /// Called by the event bus. 12 0 : handleUpdate(int newProgress, String newStatus) { 13 0 : if (progress == 100) { 14 0 : connected = true; 15 : } else { 16 0 : connected = false; 17 : } 18 : 19 0 : progress = newProgress; 20 0 : status = newStatus; 21 0 : if (newProgress != 100) { 22 0 : status = "$newProgress% - $newStatus"; 23 : } 24 : 25 0 : notifyListeners(); 26 : } 27 : 28 0 : updateVersion(String newVersion) { 29 0 : version = newVersion; 30 0 : notifyListeners(); 31 : } 32 : }