feat(frontend): flossy стиль. Выбор градиент/без
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
class AppPillGradient {
|
||||
static const prefKey = 'app_pill_gradient';
|
||||
static final ValueNotifier<bool> current = ValueNotifier(true);
|
||||
|
||||
static Future<bool> load() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getBool(prefKey) ?? true;
|
||||
}
|
||||
|
||||
static Future<void> save(bool value) async {
|
||||
current.value = value;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setBool(prefKey, value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
enum VisualStyle { materialYou, glossy }
|
||||
|
||||
class AppVisualStyle {
|
||||
static const prefKey = 'app_visual_style';
|
||||
static final ValueNotifier<VisualStyle> current =
|
||||
ValueNotifier(VisualStyle.materialYou);
|
||||
|
||||
static Future<VisualStyle> load() async {
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
return prefs.getString(prefKey) == 'glossy'
|
||||
? VisualStyle.glossy
|
||||
: VisualStyle.materialYou;
|
||||
}
|
||||
|
||||
static Future<void> save(VisualStyle value) async {
|
||||
current.value = value;
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString(
|
||||
prefKey,
|
||||
value == VisualStyle.glossy ? 'glossy' : 'materialYou',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user