Build Android (FCM) / build-android-fcm (push) Canceled after 0s
Build Android / build-android (push) Canceled after 0s
Build iOS / build-ios (push) Canceled after 0s
Build Linux / build-linux (push) Canceled after 0s
Build macOS / build-macos (push) Canceled after 0s
Build Windows / build-windows (push) Canceled after 0s
Release (main) / android (oneme) (push) Canceled after 0s
Release (main) / android (qlyra) (push) Canceled after 0s
Release (main) / windows (push) Canceled after 0s
Release (main) / linux (push) Canceled after 0s
Release (main) / macos (push) Canceled after 0s
Release (main) / ios (push) Canceled after 0s
Release (main) / release (push) Canceled after 0s
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
import '../../frontend/widgets/liquid_glass.dart';
|
|
import 'persisted_setting.dart';
|
|
|
|
enum ComposerBackground { standard, frostBlur, liquidGlass }
|
|
|
|
class ComposerMaterial {
|
|
static bool isLiquid(ComposerBackground value) =>
|
|
value == ComposerBackground.liquidGlass && LiquidGlass.isSupported;
|
|
|
|
static bool isFrost(ComposerBackground value) =>
|
|
value == ComposerBackground.frostBlur ||
|
|
(value == ComposerBackground.liquidGlass && !LiquidGlass.isSupported);
|
|
}
|
|
|
|
class AppComposerBackground {
|
|
static const prefKey = 'app_composer_background';
|
|
|
|
static final _setting = PersistedEnum<ComposerBackground>(
|
|
prefKey: prefKey,
|
|
defaultValue: ComposerBackground.standard,
|
|
encode: (value) => value.name,
|
|
decode: _parse,
|
|
);
|
|
|
|
static ValueNotifier<ComposerBackground> get current => _setting.current;
|
|
|
|
static Future<ComposerBackground> load() => _setting.load();
|
|
|
|
static Future<void> save(ComposerBackground value) => _setting.save(value);
|
|
|
|
static ComposerBackground _parse(String? val) =>
|
|
enumFromName(ComposerBackground.values, val, ComposerBackground.standard);
|
|
}
|