feat: add game graphic
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
||||
/// تنظیماتِ سراسریِ اپ (فعلاً کیفیتِ گرافیک). با ذخیرهی محلی پایدار میماند.
|
||||
class AppSettings {
|
||||
AppSettings._();
|
||||
static final AppSettings I = AppSettings._();
|
||||
|
||||
final _storage = const FlutterSecureStorage();
|
||||
static const _kLowGfx = 'low_graphics';
|
||||
|
||||
/// حالتِ کممصرف: افکتهای اتمسفری (ذرات، شوکویوِ بریدن، پسزمینهی تصویری)
|
||||
/// خاموش میشوند تا روی گوشیهای ضعیف روان بماند. با ValueNotifier تا UI واکنش دهد.
|
||||
final ValueNotifier<bool> lowGraphics = ValueNotifier(false);
|
||||
|
||||
Future<void> load() async {
|
||||
lowGraphics.value = (await _storage.read(key: _kLowGfx)) == '1';
|
||||
}
|
||||
|
||||
Future<void> setLowGraphics(bool v) async {
|
||||
lowGraphics.value = v;
|
||||
await _storage.write(key: _kLowGfx, value: v ? '1' : '0');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user