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

feat: enable emoji buttons in chat input #289

Merged
merged 1 commit into from
Jul 13, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2652,5 +2652,6 @@
"documents": "Documents",
"location": "Location",
"contact": "Contact",
"file": "File"
"file": "File",
"keyboard": "Keyboard"
}
14 changes: 9 additions & 5 deletions lib/pages/chat/chat_emoji_picker.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';

import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart';

import 'package:fluffychat/config/themes.dart';
import 'chat.dart';

Expand All @@ -14,13 +13,18 @@ class ChatEmojiPicker extends StatelessWidget {
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
height: controller.showEmojiPicker
? MediaQuery.of(context).size.height / 2
: 0,
width: MediaQuery.of(context).size.width,
height: controller.showEmojiPicker ? MediaQuery.of(context).size.height / 3 : 0,
child: controller.showEmojiPicker
? EmojiPicker(
onEmojiSelected: controller.onEmojiSelected,
onBackspacePressed: controller.emojiPickerBackspace,
config: Config(
backspaceColor: Theme.of(context).colorScheme.primary,
bgColor: Theme.of(context).colorScheme.surface,
indicatorColor: Theme.of(context).colorScheme.primary,
iconColorSelected: Theme.of(context).colorScheme.primary,
),
)
: null,
);
Expand Down
19 changes: 13 additions & 6 deletions lib/pages/chat/chat_input_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,19 @@ class ChatInputRow extends StatelessWidget {
child: child,
);
},
child: TwakeIconButton(
paddingAll: controller.inputText.isEmpty ? 5.0: 12,
tooltip: "Emojis",
onPressed: () {print;},
icon: Icons.tag_faces,
),
child: !controller.showEmojiPicker
? TwakeIconButton(
paddingAll: controller.inputText.isEmpty ? 5.0 : 12,
tooltip: L10n.of(context)!.emojis,
onPressed: () => controller.emojiPickerAction(),
icon: Icons.tag_faces,
)
: TwakeIconButton(
paddingAll: controller.inputText.isEmpty ? 5.0 : 12,
tooltip: L10n.of(context)!.keyboard,
onPressed: () => controller.inputFocus.requestFocus(),
icon: Icons.keyboard,
),
),
),
),
Expand Down
92 changes: 52 additions & 40 deletions lib/pages/chat/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,58 +269,70 @@ class ChatView extends StatelessWidget {
if (controller.room!.canSendDefaultMessages &&
controller.room!.membership == Membership.join)
Container(
margin: EdgeInsets.only(
bottom: bottomSheetPadding,
left: bottomSheetPadding,
right: bottomSheetPadding,
),
constraints: const BoxConstraints(
maxWidth: FluffyThemes.columnWidth * 2.5,
),
alignment: Alignment.center,
child: controller.room?.isAbandonedDMRoom ==
true
? Row(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
foregroundColor: Theme.of(context)
.colorScheme
.error,
),
icon: const Icon(
Icons.archive_outlined,
),
onPressed: controller.leaveChat,
label: Text(
L10n.of(context)!.leave,
),
),
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
? Padding(
padding: EdgeInsets.only(
bottom: bottomSheetPadding,
left: bottomSheetPadding,
right: bottomSheetPadding,
),
hoangdat marked this conversation as resolved.
Show resolved Hide resolved
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
foregroundColor: Theme.of(context)
.colorScheme
.error,
),
icon: const Icon(
Icons.archive_outlined,
),
onPressed: controller.leaveChat,
label: Text(
L10n.of(context)!.leave,
),
),
icon: const Icon(
Icons.chat_outlined,
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
),
icon: const Icon(
Icons.chat_outlined,
),
onPressed: controller.recreateChat,
label: Text(
L10n.of(context)!.reopenChat,
),
),
onPressed: controller.recreateChat,
label: Text(
L10n.of(context)!.reopenChat,
),
),
],
],
),
)
: Column(
mainAxisSize: MainAxisSize.min,
children: [
const ConnectionStatusHeader(),
///Currently we can't support reactions
// ReactionsPicker(controller),
ReplyDisplay(controller),
ChatInputRow(controller),
...[
const ConnectionStatusHeader(),
// Currently we can't support reactions
// ReactionsPicker(controller),
ReplyDisplay(controller),
ChatInputRow(controller),
].map(
(widget) => Padding(
padding: EdgeInsets.only(
left: bottomSheetPadding,
right: bottomSheetPadding,
),
child: widget,
),
),
SizedBox(height: bottomSheetPadding),
ChatEmojiPicker(controller),
],
),
Expand Down
15 changes: 9 additions & 6 deletions lib/widgets/twake_components/twake_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,16 @@ class TwakeIconButton extends StatelessWidget {
message: tooltip,
child: Padding(
padding: EdgeInsets.all(paddingAll ?? 8.0),
child: icon != null
child: icon != null
? Icon(
icon,
size: size,
fill: fill,
weight: weight)
: imagePath != null ? SvgPicture.asset(imagePath!) : null,
icon,
size: size,
fill: fill,
weight: weight,
)
: imagePath != null
? SvgPicture.asset(imagePath!)
: null,
),
),
),
Expand Down
Loading