Configure message style

This commit is contained in:
2025-09-23 19:39:27 +08:00
parent cb2af379fa
commit b0f3b6b5c3
7 changed files with 148 additions and 89 deletions

View File

@@ -26,6 +26,7 @@ const kAppAprilFoolFeatures = 'app_april_fool_features';
const kAppWindowSize = 'app_window_size';
const kAppEnterToSend = 'app_enter_to_send';
const kAppDefaultPoolId = 'app_default_pool_id';
const kAppMessageDisplayStyle = 'app_message_display_style';
const kFeaturedPostsCollapsedId =
'featured_posts_collapsed_id'; // Key for storing the ID of the collapsed featured post
@@ -67,6 +68,7 @@ sealed class AppSettings with _$AppSettings {
required int? appColorScheme, // The color stored via the int type
required Size? windowSize, // The window size for desktop platforms
required String? defaultPoolId,
required String messageDisplayStyle,
}) = _AppSettings;
}
@@ -87,6 +89,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
appColorScheme: prefs.getInt(kAppColorSchemeStoreKey),
windowSize: _getWindowSizeFromPrefs(prefs),
defaultPoolId: prefs.getString(kAppDefaultPoolId),
messageDisplayStyle: prefs.getString(kAppMessageDisplayStyle) ?? 'bubble',
);
}
@@ -106,6 +109,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
}
return null;
}
void setDefaultPoolId(String? value) {
final prefs = ref.read(sharedPreferencesProvider);
if (value != null) {
@@ -122,7 +126,7 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
state = state.copyWith(autoTranslate: value);
}
void setDataSavingMode(bool value){
void setDataSavingMode(bool value) {
final prefs = ref.read(sharedPreferencesProvider);
prefs.setBool(kAppDataSavingMode, value);
state = state.copyWith(dataSavingMode: value);
@@ -186,6 +190,12 @@ class AppSettingsNotifier extends _$AppSettingsNotifier {
Size? getWindowSize() {
return state.windowSize;
}
void setMessageDisplayStyle(String value) {
final prefs = ref.read(sharedPreferencesProvider);
prefs.setString(kAppMessageDisplayStyle, value);
state = state.copyWith(messageDisplayStyle: value);
}
}
final updateInfoProvider =