Skip to content

Commit

Permalink
Add option to have emote menu button on left (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyxchow committed Sep 6, 2022
1 parent f42ed2b commit fc0f7cb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 9 deletions.
21 changes: 12 additions & 9 deletions lib/screens/channel/chat/widgets/chat_bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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)'}'
Expand Down
5 changes: 5 additions & 0 deletions lib/screens/settings/chat_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions lib/screens/settings/stores/settings_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -202,6 +207,7 @@ abstract class _SettingsStoreBase with Store {
chatOnlyPreventSleep = defaultChatOnlyPreventSleep;
autocomplete = defaultAutocomplete;
showBottomBar = defaultShowBottomBar;
emoteMenuButtonOnLeft = defaultEmoteMenuButtonOnLeft;
landscapeChatLeftSide = defaultLandscapeChatLeftSide;
chatNotificationsOnBottom = defaultChatNotificationsOnBottom;
landscapeCutout = defaultLandscapeCutout;
Expand Down
20 changes: 20 additions & 0 deletions lib/screens/settings/stores/settings_store.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fc0f7cb

Please sign in to comment.