added app settings api
This commit is contained in:
20
lib/service/settings_provider.dart
Normal file
20
lib/service/settings_provider.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../model/settings.dart';
|
||||
import 'storage.dart';
|
||||
|
||||
class SettingsProvider extends ChangeNotifier {
|
||||
SettingsProvider() : _settings = Storage.loadSettings();
|
||||
|
||||
Settings _settings;
|
||||
|
||||
Settings get settings => _settings;
|
||||
|
||||
void setExportDirectoryPath(String path, {bool silent = false}) {
|
||||
_settings = _settings.copyWith(exportDirectoryPath: path);
|
||||
_saveSettings();
|
||||
if (!silent) notifyListeners();
|
||||
}
|
||||
|
||||
void _saveSettings() => Storage.saveSettings(_settings);
|
||||
}
|
||||
Reference in New Issue
Block a user