Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to have emote menu button on left #192

Merged
merged 1 commit into from
Sep 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.