simplify settings
This commit is contained in:
parent
60a97e6a24
commit
a2d30ec086
9 changed files with 14 additions and 128 deletions
|
|
@ -123,7 +123,6 @@ class IRCMessage {
|
|||
void Function()? onTapName,
|
||||
void Function(String)? onTapPingedUser,
|
||||
bool showMessage = true,
|
||||
bool useReadableColors = false,
|
||||
Map<String, UserTwitch>? channelIdToUserTwitch,
|
||||
TimestampType timestamp = TimestampType.disabled,
|
||||
}) {
|
||||
|
|
@ -370,20 +369,18 @@ class IRCMessage {
|
|||
int.parse((tags['color'] ?? '#868686').replaceFirst('#', '0xFF')),
|
||||
);
|
||||
|
||||
if (useReadableColors) {
|
||||
final hsl = HSLColor.fromColor(color);
|
||||
if (isLightTheme == true) {
|
||||
if (hsl.lightness >= 0.5) {
|
||||
color = hsl
|
||||
.withLightness(hsl.lightness + ((0 - hsl.lightness) * 0.5))
|
||||
.toColor();
|
||||
}
|
||||
} else {
|
||||
if (hsl.lightness <= 0.5) {
|
||||
color = hsl
|
||||
.withLightness(hsl.lightness + ((1 - hsl.lightness) * 0.5))
|
||||
.toColor();
|
||||
}
|
||||
final hsl = HSLColor.fromColor(color);
|
||||
if (isLightTheme == true) {
|
||||
if (hsl.lightness >= 0.5) {
|
||||
color = hsl
|
||||
.withLightness(hsl.lightness + ((0 - hsl.lightness) * 0.5))
|
||||
.toColor();
|
||||
}
|
||||
} else {
|
||||
if (hsl.lightness <= 0.5) {
|
||||
color = hsl
|
||||
.withLightness(hsl.lightness + ((1 - hsl.lightness) * 0.5))
|
||||
.toColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ abstract class ChatStoreBase with Store {
|
|||
required this.displayName,
|
||||
}) {
|
||||
// Enable wakelock to prevent the chat from sleeping.
|
||||
if (settings.chatOnlyPreventSleep) WakelockPlus.enable();
|
||||
WakelockPlus.enable();
|
||||
|
||||
// Create a reaction that will reconnect to chat when logging in or out.
|
||||
// Closing the channel will trigger a reconnect with the new credentials.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ class ChatBottomBar extends StatelessWidget {
|
|||
assetsStore: chatStore.assetsStore,
|
||||
emoteScale: chatStore.settings.emoteScale,
|
||||
badgeScale: chatStore.settings.badgeScale,
|
||||
useReadableColors: chatStore.settings.useReadableColors,
|
||||
launchExternal: chatStore.settings.launchUrlExternal,
|
||||
timestamp: chatStore.settings.timestampType,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ class ChatMessage extends StatelessWidget {
|
|||
assetsStore: chatStore.assetsStore,
|
||||
emoteScale: chatStore.settings.emoteScale,
|
||||
badgeScale: chatStore.settings.badgeScale,
|
||||
useReadableColors: chatStore.settings.useReadableColors,
|
||||
launchExternal: chatStore.settings.launchUrlExternal,
|
||||
timestamp: chatStore.settings.timestampType,
|
||||
channelIdToUserTwitch:
|
||||
|
|
@ -172,7 +171,6 @@ class ChatMessage extends StatelessWidget {
|
|||
assetsStore: chatStore.assetsStore,
|
||||
emoteScale: chatStore.settings.emoteScale,
|
||||
badgeScale: chatStore.settings.badgeScale,
|
||||
useReadableColors: chatStore.settings.useReadableColors,
|
||||
launchExternal: chatStore.settings.launchUrlExternal,
|
||||
timestamp: chatStore.settings.timestampType,
|
||||
channelIdToUserTwitch:
|
||||
|
|
@ -305,7 +303,6 @@ class ChatMessage extends StatelessWidget {
|
|||
emoteScale: chatStore.settings.emoteScale,
|
||||
badgeScale: chatStore.settings.badgeScale,
|
||||
showMessage: chatStore.settings.showDeletedMessages,
|
||||
useReadableColors: chatStore.settings.useReadableColors,
|
||||
launchExternal: chatStore.settings.launchUrlExternal,
|
||||
timestamp: chatStore.settings.timestampType,
|
||||
channelIdToUserTwitch:
|
||||
|
|
@ -399,8 +396,6 @@ class ChatMessage extends StatelessWidget {
|
|||
assetsStore: chatStore.assetsStore,
|
||||
emoteScale: chatStore.settings.emoteScale,
|
||||
badgeScale: chatStore.settings.badgeScale,
|
||||
useReadableColors:
|
||||
chatStore.settings.useReadableColors,
|
||||
launchExternal: chatStore.settings.launchUrlExternal,
|
||||
timestamp: chatStore.settings.timestampType,
|
||||
channelIdToUserTwitch:
|
||||
|
|
|
|||
|
|
@ -352,9 +352,7 @@ class VideoOverlay extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (orientation == Orientation.landscape &&
|
||||
settingsStore.showLatency)
|
||||
latencyTooltip,
|
||||
if (orientation == Orientation.landscape) latencyTooltip,
|
||||
Tooltip(
|
||||
message: 'Enter picture-in-picture',
|
||||
preferBelow: false,
|
||||
|
|
|
|||
|
|
@ -146,14 +146,6 @@ class _ChatSettingsState extends State<ChatSettings> {
|
|||
onChanged: (newValue) => settingsStore.fontSize = newValue,
|
||||
),
|
||||
const SectionHeader('Message appearance'),
|
||||
SettingsListSwitch(
|
||||
title: 'Use readable name colors',
|
||||
subtitle: const Text(
|
||||
'Adjusts the lightness value of overly bright and dark names.',
|
||||
),
|
||||
value: settingsStore.useReadableColors,
|
||||
onChanged: (newValue) => settingsStore.useReadableColors = newValue,
|
||||
),
|
||||
SettingsListSwitch(
|
||||
title: 'Show deleted messages',
|
||||
subtitle: const Text(
|
||||
|
|
@ -275,16 +267,6 @@ class _ChatSettingsState extends State<ChatSettings> {
|
|||
onChanged: (newValue) =>
|
||||
settingsStore.fullScreenChatOverlayOpacity = newValue,
|
||||
),
|
||||
const SectionHeader('Sleep'),
|
||||
SettingsListSwitch(
|
||||
title: 'Prevent sleep in chat-only mode',
|
||||
subtitle: const Text(
|
||||
'Requires restarting the chat in order to take effect.',
|
||||
),
|
||||
value: settingsStore.chatOnlyPreventSleep,
|
||||
onChanged: (newValue) =>
|
||||
settingsStore.chatOnlyPreventSleep = newValue,
|
||||
),
|
||||
const SectionHeader('Muted keywords'),
|
||||
SettingsMutedWords(settingsStore: settingsStore),
|
||||
SettingsListSwitch(
|
||||
|
|
|
|||
|
|
@ -63,7 +63,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
// Player defaults
|
||||
static const defaultShowVideo = true;
|
||||
static const defaultDefaultToHighestQuality = false;
|
||||
static const defaultShowLatency = true;
|
||||
static const defaultUseEnhancedRendering = false;
|
||||
|
||||
// Overlay defaults
|
||||
|
|
@ -80,10 +79,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
@observable
|
||||
var defaultToHighestQuality = defaultDefaultToHighestQuality;
|
||||
|
||||
@JsonKey(defaultValue: defaultShowLatency)
|
||||
@observable
|
||||
var showLatency = defaultShowLatency;
|
||||
|
||||
@JsonKey(defaultValue: defaultUseEnhancedRendering)
|
||||
@observable
|
||||
var useEnhancedRendering = defaultUseEnhancedRendering;
|
||||
|
|
@ -105,7 +100,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
void resetVideoSettings() {
|
||||
showVideo = defaultShowVideo;
|
||||
defaultToHighestQuality = defaultDefaultToHighestQuality;
|
||||
showLatency = defaultShowLatency;
|
||||
useEnhancedRendering = defaultUseEnhancedRendering;
|
||||
|
||||
showOverlay = defaultShowOverlay;
|
||||
|
|
@ -122,7 +116,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
static const defaultFontSize = 12.0;
|
||||
|
||||
// Message appearance defaults
|
||||
static const defaultUseReadableColors = true;
|
||||
static const defaultShowDeletedMessages = false;
|
||||
static const defaultShowChatMessageDividers = false;
|
||||
static const defaultTimestampType = TimestampType.disabled;
|
||||
|
|
@ -147,9 +140,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
static const defaultChatWidth = 0.25;
|
||||
static const defaultFullScreenChatOverlayOpacity = 0.5;
|
||||
|
||||
// Sleep defaults
|
||||
static const defaultChatOnlyPreventSleep = false;
|
||||
|
||||
// mute words defaults
|
||||
static const defaultMutedWords = <String>[];
|
||||
static const defaultMatchWholeWord = true;
|
||||
|
|
@ -191,10 +181,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
var fontSize = defaultFontSize;
|
||||
|
||||
// Message appearance options
|
||||
@JsonKey(defaultValue: defaultUseReadableColors)
|
||||
@observable
|
||||
var useReadableColors = defaultUseReadableColors;
|
||||
|
||||
@JsonKey(defaultValue: defaultShowDeletedMessages)
|
||||
@observable
|
||||
var showDeletedMessages = defaultShowDeletedMessages;
|
||||
|
|
@ -262,11 +248,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
@observable
|
||||
var fullScreenChatOverlayOpacity = defaultFullScreenChatOverlayOpacity;
|
||||
|
||||
// Sleep options
|
||||
@JsonKey(defaultValue: defaultChatOnlyPreventSleep)
|
||||
@observable
|
||||
var chatOnlyPreventSleep = defaultChatOnlyPreventSleep;
|
||||
|
||||
// Autocomplete options
|
||||
@JsonKey(defaultValue: defaultAutocomplete)
|
||||
@observable
|
||||
|
|
@ -322,7 +303,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
messageSpacing = defaultMessageSpacing;
|
||||
fontSize = defaultFontSize;
|
||||
|
||||
useReadableColors = defaultUseReadableColors;
|
||||
showDeletedMessages = defaultShowDeletedMessages;
|
||||
showChatMessageDividers = defaultShowChatMessageDividers;
|
||||
timestampType = defaultTimestampType;
|
||||
|
|
@ -343,8 +323,6 @@ abstract class _SettingsStoreBase with Store {
|
|||
chatWidth = defaultChatWidth;
|
||||
fullScreenChatOverlayOpacity = defaultFullScreenChatOverlayOpacity;
|
||||
|
||||
chatOnlyPreventSleep = defaultChatOnlyPreventSleep;
|
||||
|
||||
mutedWords = defaultMutedWords;
|
||||
matchWholeWord = defaultMatchWholeWord;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
|
|||
..showVideo = json['showVideo'] as bool? ?? true
|
||||
..defaultToHighestQuality =
|
||||
json['defaultToHighestQuality'] as bool? ?? false
|
||||
..showLatency = json['showLatency'] as bool? ?? true
|
||||
..useEnhancedRendering = json['useEnhancedRendering'] as bool? ?? false
|
||||
..showOverlay = json['showOverlay'] as bool? ?? true
|
||||
..toggleableOverlay = json['toggleableOverlay'] as bool? ?? false
|
||||
|
|
@ -28,7 +27,6 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
|
|||
..messageScale = (json['messageScale'] as num?)?.toDouble() ?? 1.0
|
||||
..messageSpacing = (json['messageSpacing'] as num?)?.toDouble() ?? 8.0
|
||||
..fontSize = (json['fontSize'] as num?)?.toDouble() ?? 12.0
|
||||
..useReadableColors = json['useReadableColors'] as bool? ?? true
|
||||
..showDeletedMessages = json['showDeletedMessages'] as bool? ?? false
|
||||
..showChatMessageDividers =
|
||||
json['showChatMessageDividers'] as bool? ?? false
|
||||
|
|
@ -54,7 +52,6 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
|
|||
..chatWidth = (json['chatWidth'] as num?)?.toDouble() ?? 0.25
|
||||
..fullScreenChatOverlayOpacity =
|
||||
(json['fullScreenChatOverlayOpacity'] as num?)?.toDouble() ?? 0.5
|
||||
..chatOnlyPreventSleep = json['chatOnlyPreventSleep'] as bool? ?? false
|
||||
..autocomplete = json['autocomplete'] as bool? ?? true
|
||||
..showTwitchEmotes = json['showTwitchEmotes'] as bool? ?? true
|
||||
..showTwitchBadges = json['showTwitchBadges'] as bool? ?? true
|
||||
|
|
@ -87,7 +84,6 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
|
|||
'launchUrlExternal': instance.launchUrlExternal,
|
||||
'showVideo': instance.showVideo,
|
||||
'defaultToHighestQuality': instance.defaultToHighestQuality,
|
||||
'showLatency': instance.showLatency,
|
||||
'useEnhancedRendering': instance.useEnhancedRendering,
|
||||
'showOverlay': instance.showOverlay,
|
||||
'toggleableOverlay': instance.toggleableOverlay,
|
||||
|
|
@ -97,7 +93,6 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
|
|||
'messageScale': instance.messageScale,
|
||||
'messageSpacing': instance.messageSpacing,
|
||||
'fontSize': instance.fontSize,
|
||||
'useReadableColors': instance.useReadableColors,
|
||||
'showDeletedMessages': instance.showDeletedMessages,
|
||||
'showChatMessageDividers': instance.showChatMessageDividers,
|
||||
'timestampType': _$TimestampTypeEnumMap[instance.timestampType]!,
|
||||
|
|
@ -114,7 +109,6 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
|
|||
_$LandscapeCutoutTypeEnumMap[instance.landscapeCutout]!,
|
||||
'chatWidth': instance.chatWidth,
|
||||
'fullScreenChatOverlayOpacity': instance.fullScreenChatOverlayOpacity,
|
||||
'chatOnlyPreventSleep': instance.chatOnlyPreventSleep,
|
||||
'autocomplete': instance.autocomplete,
|
||||
'showTwitchEmotes': instance.showTwitchEmotes,
|
||||
'showTwitchBadges': instance.showTwitchBadges,
|
||||
|
|
@ -271,22 +265,6 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
});
|
||||
}
|
||||
|
||||
late final _$showLatencyAtom =
|
||||
Atom(name: '_SettingsStoreBase.showLatency', context: context);
|
||||
|
||||
@override
|
||||
bool get showLatency {
|
||||
_$showLatencyAtom.reportRead();
|
||||
return super.showLatency;
|
||||
}
|
||||
|
||||
@override
|
||||
set showLatency(bool value) {
|
||||
_$showLatencyAtom.reportWrite(value, super.showLatency, () {
|
||||
super.showLatency = value;
|
||||
});
|
||||
}
|
||||
|
||||
late final _$useEnhancedRenderingAtom =
|
||||
Atom(name: '_SettingsStoreBase.useEnhancedRendering', context: context);
|
||||
|
||||
|
|
@ -432,22 +410,6 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
});
|
||||
}
|
||||
|
||||
late final _$useReadableColorsAtom =
|
||||
Atom(name: '_SettingsStoreBase.useReadableColors', context: context);
|
||||
|
||||
@override
|
||||
bool get useReadableColors {
|
||||
_$useReadableColorsAtom.reportRead();
|
||||
return super.useReadableColors;
|
||||
}
|
||||
|
||||
@override
|
||||
set useReadableColors(bool value) {
|
||||
_$useReadableColorsAtom.reportWrite(value, super.useReadableColors, () {
|
||||
super.useReadableColors = value;
|
||||
});
|
||||
}
|
||||
|
||||
late final _$showDeletedMessagesAtom =
|
||||
Atom(name: '_SettingsStoreBase.showDeletedMessages', context: context);
|
||||
|
||||
|
|
@ -696,23 +658,6 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
});
|
||||
}
|
||||
|
||||
late final _$chatOnlyPreventSleepAtom =
|
||||
Atom(name: '_SettingsStoreBase.chatOnlyPreventSleep', context: context);
|
||||
|
||||
@override
|
||||
bool get chatOnlyPreventSleep {
|
||||
_$chatOnlyPreventSleepAtom.reportRead();
|
||||
return super.chatOnlyPreventSleep;
|
||||
}
|
||||
|
||||
@override
|
||||
set chatOnlyPreventSleep(bool value) {
|
||||
_$chatOnlyPreventSleepAtom.reportWrite(value, super.chatOnlyPreventSleep,
|
||||
() {
|
||||
super.chatOnlyPreventSleep = value;
|
||||
});
|
||||
}
|
||||
|
||||
late final _$autocompleteAtom =
|
||||
Atom(name: '_SettingsStoreBase.autocomplete', context: context);
|
||||
|
||||
|
|
@ -1034,7 +979,6 @@ largeStreamCard: ${largeStreamCard},
|
|||
launchUrlExternal: ${launchUrlExternal},
|
||||
showVideo: ${showVideo},
|
||||
defaultToHighestQuality: ${defaultToHighestQuality},
|
||||
showLatency: ${showLatency},
|
||||
useEnhancedRendering: ${useEnhancedRendering},
|
||||
showOverlay: ${showOverlay},
|
||||
toggleableOverlay: ${toggleableOverlay},
|
||||
|
|
@ -1044,7 +988,6 @@ emoteScale: ${emoteScale},
|
|||
messageScale: ${messageScale},
|
||||
messageSpacing: ${messageSpacing},
|
||||
fontSize: ${fontSize},
|
||||
useReadableColors: ${useReadableColors},
|
||||
showDeletedMessages: ${showDeletedMessages},
|
||||
showChatMessageDividers: ${showChatMessageDividers},
|
||||
timestampType: ${timestampType},
|
||||
|
|
@ -1060,7 +1003,6 @@ landscapeForceVerticalChat: ${landscapeForceVerticalChat},
|
|||
landscapeCutout: ${landscapeCutout},
|
||||
chatWidth: ${chatWidth},
|
||||
fullScreenChatOverlayOpacity: ${fullScreenChatOverlayOpacity},
|
||||
chatOnlyPreventSleep: ${chatOnlyPreventSleep},
|
||||
autocomplete: ${autocomplete},
|
||||
showTwitchEmotes: ${showTwitchEmotes},
|
||||
showTwitchBadges: ${showTwitchBadges},
|
||||
|
|
|
|||
|
|
@ -34,11 +34,6 @@ class VideoSettings extends StatelessWidget {
|
|||
value: settingsStore.defaultToHighestQuality,
|
||||
onChanged: (newValue) =>
|
||||
settingsStore.defaultToHighestQuality = newValue,
|
||||
),
|
||||
SettingsListSwitch(
|
||||
title: 'Show latency',
|
||||
value: settingsStore.showLatency,
|
||||
onChanged: (newValue) => settingsStore.showLatency = newValue,
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
SettingsListSwitch(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue