Add option to have emote menu button on left (#192)
This commit is contained in:
parent
f42ed2bc4e
commit
fc0f7cbff7
4 changed files with 43 additions and 9 deletions
|
|
@ -13,6 +13,16 @@ class ChatBottomBar extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final emoteMenuButton = IconButton(
|
||||
color: chatStore.assetsStore.showEmoteMenu ? Theme.of(context).colorScheme.secondary : null,
|
||||
tooltip: 'Emote menu',
|
||||
icon: const Icon(Icons.emoji_emotions_outlined),
|
||||
onPressed: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
chatStore.assetsStore.showEmoteMenu = !chatStore.assetsStore.showEmoteMenu;
|
||||
},
|
||||
);
|
||||
|
||||
return Observer(
|
||||
builder: (context) {
|
||||
final matchingEmotes = [
|
||||
|
|
@ -112,15 +122,8 @@ class ChatBottomBar extends StatelessWidget {
|
|||
enabled: chatStore.auth.isLoggedIn ? true : false,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.fromLTRB(15.0, 10.0, 0.0, 10.0),
|
||||
suffixIcon: IconButton(
|
||||
color: chatStore.assetsStore.showEmoteMenu ? Theme.of(context).colorScheme.secondary : null,
|
||||
tooltip: 'Emote menu',
|
||||
icon: const Icon(Icons.emoji_emotions_outlined),
|
||||
onPressed: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
chatStore.assetsStore.showEmoteMenu = !chatStore.assetsStore.showEmoteMenu;
|
||||
},
|
||||
),
|
||||
prefixIcon: chatStore.settings.emoteMenuButtonOnLeft ? emoteMenuButton : null,
|
||||
suffixIcon: chatStore.settings.emoteMenuButtonOnLeft ? null : emoteMenuButton,
|
||||
hintMaxLines: 1,
|
||||
hintText: chatStore.auth.isLoggedIn
|
||||
? 'Send a message ${chatStore.settings.chatDelay == 0 ? '' : '(${chatStore.settings.chatDelay.toInt()}s delay)'}'
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ class _ChatSettingsState extends State<ChatSettings> {
|
|||
value: settingsStore.showBottomBar,
|
||||
onChanged: (newValue) => settingsStore.showBottomBar = newValue,
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Emote menu button on left side'),
|
||||
value: settingsStore.emoteMenuButtonOnLeft,
|
||||
onChanged: (newValue) => settingsStore.emoteMenuButtonOnLeft = newValue,
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Landscape chat on left side'),
|
||||
value: settingsStore.landscapeChatLeftSide,
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ abstract class _SettingsStoreBase with Store {
|
|||
static const defaultLandscapeCutout = LandscapeCutoutType.none;
|
||||
|
||||
static const defaultShowBottomBar = true;
|
||||
static const defaultEmoteMenuButtonOnLeft = false;
|
||||
static const defaultLandscapeChatLeftSide = false;
|
||||
static const defaultChatNotificationsOnBottom = false;
|
||||
static const defaultChatWidth = 0.3;
|
||||
|
|
@ -128,6 +129,10 @@ abstract class _SettingsStoreBase with Store {
|
|||
@observable
|
||||
var showBottomBar = defaultShowBottomBar;
|
||||
|
||||
@JsonKey(defaultValue: defaultEmoteMenuButtonOnLeft)
|
||||
@observable
|
||||
var emoteMenuButtonOnLeft = defaultEmoteMenuButtonOnLeft;
|
||||
|
||||
@JsonKey(defaultValue: defaultLandscapeChatLeftSide)
|
||||
@observable
|
||||
var landscapeChatLeftSide = defaultLandscapeChatLeftSide;
|
||||
|
|
@ -202,6 +207,7 @@ abstract class _SettingsStoreBase with Store {
|
|||
chatOnlyPreventSleep = defaultChatOnlyPreventSleep;
|
||||
autocomplete = defaultAutocomplete;
|
||||
showBottomBar = defaultShowBottomBar;
|
||||
emoteMenuButtonOnLeft = defaultEmoteMenuButtonOnLeft;
|
||||
landscapeChatLeftSide = defaultLandscapeChatLeftSide;
|
||||
chatNotificationsOnBottom = defaultChatNotificationsOnBottom;
|
||||
landscapeCutout = defaultLandscapeCutout;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ SettingsStore _$SettingsStoreFromJson(Map<String, dynamic> json) =>
|
|||
..chatOnlyPreventSleep = json['chatOnlyPreventSleep'] as bool? ?? true
|
||||
..autocomplete = json['autocomplete'] as bool? ?? true
|
||||
..showBottomBar = json['showBottomBar'] as bool? ?? true
|
||||
..emoteMenuButtonOnLeft = json['emoteMenuButtonOnLeft'] as bool? ?? false
|
||||
..landscapeChatLeftSide = json['landscapeChatLeftSide'] as bool? ?? false
|
||||
..chatNotificationsOnBottom =
|
||||
json['chatNotificationsOnBottom'] as bool? ?? false
|
||||
|
|
@ -71,6 +72,7 @@ Map<String, dynamic> _$SettingsStoreToJson(SettingsStore instance) =>
|
|||
'chatOnlyPreventSleep': instance.chatOnlyPreventSleep,
|
||||
'autocomplete': instance.autocomplete,
|
||||
'showBottomBar': instance.showBottomBar,
|
||||
'emoteMenuButtonOnLeft': instance.emoteMenuButtonOnLeft,
|
||||
'landscapeChatLeftSide': instance.landscapeChatLeftSide,
|
||||
'chatNotificationsOnBottom': instance.chatNotificationsOnBottom,
|
||||
'landscapeCutout':
|
||||
|
|
@ -347,6 +349,23 @@ mixin _$SettingsStore on _SettingsStoreBase, Store {
|
|||
});
|
||||
}
|
||||
|
||||
late final _$emoteMenuButtonOnLeftAtom =
|
||||
Atom(name: '_SettingsStoreBase.emoteMenuButtonOnLeft', context: context);
|
||||
|
||||
@override
|
||||
bool get emoteMenuButtonOnLeft {
|
||||
_$emoteMenuButtonOnLeftAtom.reportRead();
|
||||
return super.emoteMenuButtonOnLeft;
|
||||
}
|
||||
|
||||
@override
|
||||
set emoteMenuButtonOnLeft(bool value) {
|
||||
_$emoteMenuButtonOnLeftAtom.reportWrite(value, super.emoteMenuButtonOnLeft,
|
||||
() {
|
||||
super.emoteMenuButtonOnLeft = value;
|
||||
});
|
||||
}
|
||||
|
||||
late final _$landscapeChatLeftSideAtom =
|
||||
Atom(name: '_SettingsStoreBase.landscapeChatLeftSide', context: context);
|
||||
|
||||
|
|
@ -776,6 +795,7 @@ chatDelay: ${chatDelay},
|
|||
chatOnlyPreventSleep: ${chatOnlyPreventSleep},
|
||||
autocomplete: ${autocomplete},
|
||||
showBottomBar: ${showBottomBar},
|
||||
emoteMenuButtonOnLeft: ${emoteMenuButtonOnLeft},
|
||||
landscapeChatLeftSide: ${landscapeChatLeftSide},
|
||||
chatNotificationsOnBottom: ${chatNotificationsOnBottom},
|
||||
landscapeCutout: ${landscapeCutout},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue