Fix slider possition change from outside
This commit is contained in:
parent
5683ab5158
commit
9b7f7aa380
@ -28,10 +28,10 @@ class UniversalSliderState extends State<UniversalSlider> {
|
|||||||
|
|
||||||
double _value;
|
double _value;
|
||||||
bool _changeStarted = false;
|
bool _changeStarted = false;
|
||||||
|
bool _changedHere = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_value = widget.value;
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +39,11 @@ class UniversalSliderState extends State<UniversalSlider> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List <Widget> row = [];
|
List <Widget> row = [];
|
||||||
List <Widget> col = [];
|
List <Widget> col = [];
|
||||||
|
if (!_changedHere) {
|
||||||
|
_value = widget.value;
|
||||||
|
} else {
|
||||||
|
_changedHere = false;
|
||||||
|
}
|
||||||
if (widget.leading != null) {
|
if (widget.leading != null) {
|
||||||
row.add(widget.leading);
|
row.add(widget.leading);
|
||||||
}
|
}
|
||||||
@ -57,6 +62,7 @@ class UniversalSliderState extends State<UniversalSlider> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_value = value;
|
_value = value;
|
||||||
|
_changedHere = true;
|
||||||
});
|
});
|
||||||
widget.onChanged?.call(value);
|
widget.onChanged?.call(value);
|
||||||
},
|
},
|
||||||
@ -64,6 +70,7 @@ class UniversalSliderState extends State<UniversalSlider> {
|
|||||||
_changeStarted = false;
|
_changeStarted = false;
|
||||||
setState(() {
|
setState(() {
|
||||||
_value = value;
|
_value = value;
|
||||||
|
_changedHere = true;
|
||||||
});
|
});
|
||||||
Timer(Duration(milliseconds: 500), () {
|
Timer(Duration(milliseconds: 500), () {
|
||||||
if (!_changeStarted) {
|
if (!_changeStarted) {
|
||||||
|
@ -159,7 +159,7 @@ EventBus eventBus = new EventBus();
|
|||||||
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
|
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
|
||||||
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
|
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
|
||||||
const String appName = 'HA Client';
|
const String appName = 'HA Client';
|
||||||
const appVersionNumber = '1.0.1';
|
const appVersionNumber = '1.1.0';
|
||||||
final String appVersionAdd = secrets['version_type'] ?? '';
|
final String appVersionAdd = secrets['version_type'] ?? '';
|
||||||
final String appVersion = '$appVersionNumber${appVersionAdd.isNotEmpty ? '-' : ''}$appVersionAdd';
|
final String appVersion = '$appVersionNumber${appVersionAdd.isNotEmpty ? '-' : ''}$appVersionAdd';
|
||||||
const whatsNewUrl = 'http://ha-client.app/service/whats_new_1.0.1.md';
|
const whatsNewUrl = 'http://ha-client.app/service/whats_new_1.0.1.md';
|
||||||
|
@ -36,8 +36,9 @@ class AppSettings {
|
|||||||
appTheme = AppTheme.values[prefs.getInt('app-theme') ?? AppTheme.defaultTheme.index];
|
appTheme = AppTheme.values[prefs.getInt('app-theme') ?? AppTheme.defaultTheme.index];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future load(bool quick) async {
|
Future load(bool full) async {
|
||||||
if (!quick) {
|
if (full) {
|
||||||
|
Logger.d('Loading settings...');
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
_domain = prefs.getString('hassio-domain');
|
_domain = prefs.getString('hassio-domain');
|
||||||
_port = prefs.getString('hassio-port');
|
_port = prefs.getString('hassio-port');
|
||||||
@ -53,6 +54,7 @@ class AppSettings {
|
|||||||
locationUpdateInterval = Duration(minutes: prefs.getInt("location-interval") ??
|
locationUpdateInterval = Duration(minutes: prefs.getInt("location-interval") ??
|
||||||
defaultLocationUpdateIntervalMinutes);
|
defaultLocationUpdateIntervalMinutes);
|
||||||
locationTrackingEnabled = prefs.getBool("location-enabled") ?? false;
|
locationTrackingEnabled = prefs.getBool("location-enabled") ?? false;
|
||||||
|
Logger.d('Done. $_domain:$_port');
|
||||||
try {
|
try {
|
||||||
final storage = new FlutterSecureStorage();
|
final storage = new FlutterSecureStorage();
|
||||||
longLivedToken = await storage.read(key: "hacl_llt");
|
longLivedToken = await storage.read(key: "hacl_llt");
|
||||||
|
@ -27,7 +27,9 @@ class ConnectionManager {
|
|||||||
Future init({bool loadSettings, bool forceReconnect: false}) {
|
Future init({bool loadSettings, bool forceReconnect: false}) {
|
||||||
Completer completer = Completer();
|
Completer completer = Completer();
|
||||||
AppSettings().load(loadSettings).then((_) {
|
AppSettings().load(loadSettings).then((_) {
|
||||||
|
Logger.d('Checking config...');
|
||||||
if (AppSettings().isNotConfigured()) {
|
if (AppSettings().isNotConfigured()) {
|
||||||
|
Logger.d('This is first start');
|
||||||
completer.completeError(HACNotSetUpException());
|
completer.completeError(HACNotSetUpException());
|
||||||
} else if (AppSettings().isSomethingMissed()) {
|
} else if (AppSettings().isSomethingMissed()) {
|
||||||
completer.completeError(HACException.checkConnectionSettings());
|
completer.completeError(HACException.checkConnectionSettings());
|
||||||
|
Reference in New Issue
Block a user