2023-02-27 02:27:42 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:smoke_cess_app/services/settings_service.dart';
|
|
|
|
|
|
|
|
import '../models/settings.dart';
|
|
|
|
|
|
|
|
class SettingsProvider extends ChangeNotifier {
|
|
|
|
Settings? _settings;
|
2023-02-27 11:08:38 +01:00
|
|
|
bool _initialized = false;
|
2023-03-06 14:25:38 +01:00
|
|
|
bool _scanning = false;
|
2023-02-27 02:27:42 +01:00
|
|
|
|
|
|
|
Settings? get settings => _settings;
|
2023-02-27 11:08:38 +01:00
|
|
|
bool get initialized => _initialized;
|
2023-03-06 14:25:38 +01:00
|
|
|
bool get scanning => _scanning;
|
|
|
|
|
|
|
|
set scanning(bool value) {
|
|
|
|
_scanning = value;
|
|
|
|
notifyListeners();
|
|
|
|
}
|
2023-02-27 02:27:42 +01:00
|
|
|
|
|
|
|
SettingsProvider() {
|
|
|
|
initSettings();
|
|
|
|
}
|
|
|
|
|
2023-03-06 21:54:32 +01:00
|
|
|
Future<void> initSettings() async {
|
2023-02-27 11:27:45 +01:00
|
|
|
_settings = await loadSettings();
|
|
|
|
_initialized = _settings != null ? true : false;
|
2023-02-27 02:27:42 +01:00
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
}
|