mirror of
https://github.com/h7x4/Jisho-Study-Tool.git
synced 2024-12-22 05:57:28 +01:00
h7x4
28f900c02e
* Add lots of new functionality to search results * Fix jlpt level * Make antonyms clickable * Add kanji list * Replace Blocof with BlocBuilder * Make kanji widgets squared * Add missing colons to headers * add romaji under sentences * Fix extensive search not showing * Miscellaneous refactoring
25 lines
986 B
Dart
25 lines
986 B
Dart
import 'package:get_it/get_it.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
final SharedPreferences _prefs = GetIt.instance.get<SharedPreferences>();
|
|
|
|
const Map<String, dynamic> _defaults = {
|
|
'romajiEnabled': false,
|
|
'extensiveSearch': true,
|
|
'darkThemeEnabled': false,
|
|
'autoThemeEnabled': false,
|
|
};
|
|
|
|
bool _getSettingOrDefault(String settingName) =>
|
|
_prefs.getBool(settingName) ?? _defaults[settingName];
|
|
|
|
bool get romajiEnabled => _getSettingOrDefault('romajiEnabled');
|
|
bool get extensiveSearchEnabled => _getSettingOrDefault('extensiveSearch');
|
|
bool get darkThemeEnabled => _getSettingOrDefault('darkThemeEnabled');
|
|
bool get autoThemeEnabled => _getSettingOrDefault('autoThemeEnabled');
|
|
|
|
set romajiEnabled(b) => _prefs.setBool('romajiEnabled', b);
|
|
set extensiveSearchEnabled(b) => _prefs.setBool('extensiveSearch', b);
|
|
set darkThemeEnabled(b) => _prefs.setBool('darkThemeEnabled', b);
|
|
set autoThemeEnabled(b) => _prefs.setBool('autoThemeEnabled', b);
|