added option to choose more emoji reactions

This commit is contained in:
2024-04-02 14:11:48 +02:00
parent a1ad6aa582
commit 9aa3f7c058
4 changed files with 94 additions and 6 deletions

View File

@ -1,5 +1,6 @@
import 'package:better_open_file/better_open_file.dart';
import 'package:bubble/bubble.dart';
import 'package:emoji_picker_flutter/emoji_picker_flutter.dart' as emojis;
import 'package:flowder/flowder.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
@ -49,6 +50,8 @@ class ChatBubble extends StatefulWidget {
}
class _ChatBubbleState extends State<ChatBubble> {
final TextEditingController _emojiInput = TextEditingController();
BubbleStyle getSystemStyle() {
return BubbleStyle(
color: AppTheme.isDarkMode(context) ? const Color(0xff182229) : Colors.white,
@ -184,7 +187,7 @@ class _ChatBubbleState extends State<ChatBubble> {
),
onLongPress: () {
showDialog(context: context, builder: (context) {
List<String> commonReactions = ['👍', '👎', '😆', '❤️', '👀', '🤔'];
List<String> commonReactions = ['👍', '👎', '😆', '❤️', '😎'];
bool canReact = widget.bubbleData.messageType == GetRoomResponseObjectMessageType.comment;
return SimpleDialog(
children: [
@ -210,18 +213,102 @@ class _ChatBubbleState extends State<ChatBubble> {
params: ReactMessageParams(e),
).run().then((value) => widget.refetch(renew: true));
},
child: Text(e)),
child: Text(e),
),
),
IconButton(
onPressed: () {
showDialog(context: context, builder: (context) {
return SimpleDialog(
contentPadding: const EdgeInsets.all(15),
titlePadding: const EdgeInsets.only(left: 6, top: 15),
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back),
),
const SizedBox(
width: 10,
height: 0,
child: null,
),
const Text('Emoji auswählen'),
],
),
children: [
Column(
children: [
emojis.EmojiPicker(
onBackspacePressed: () {
null;
},
config: emojis.Config(
height: 256,
swapCategoryAndBottomBar: true,
emojiViewConfig: emojis.EmojiViewConfig(
backgroundColor: Theme.of(context).canvasColor,
recentsLimit: 67,
emojiSizeMax: 20,
),
bottomActionBarConfig: emojis.BottomActionBarConfig(
showBackspaceButton: false,
backgroundColor: Theme.of(context).hoverColor.withAlpha(50),
buttonColor: Theme.of(context).dividerColor.withAlpha(70),
),
categoryViewConfig: emojis.CategoryViewConfig(
backgroundColor: Theme.of(context).hoverColor,
iconColorSelected: Theme.of(context).primaryColor,
indicatorColor: Theme.of(context).primaryColor,
),
searchViewConfig: emojis.SearchViewConfig(
backgroundColor: Theme.of(context).dividerColor,
buttonColor: Theme.of(context).dividerColor,
hintText: 'Suchen',
buttonIconColor: Colors.white,
),
),
onEmojiSelected: (emojis.Category? category, emojis.Emoji emoji) {
Navigator.of(context).pop();
Navigator.of(context).pop();
ReactMessage(
chatToken: widget.chatData.token,
messageId: widget.bubbleData.id,
params: ReactMessageParams(emoji.emoji),
).run().then((value) => widget.refetch(renew: true));
},
),
const SizedBox(
width: 1,
height: 25,
child: null,
)
],
),
],
);
});
},
style: IconButton.styleFrom(
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: const Size(40, 40),
),
icon: const Icon(Icons.add_circle_outline_outlined),
),
],
),
const Divider(),
],
)
),
),
Visibility(
visible: canReact,
child: ListTile(
leading: const Icon(Icons.add_reaction_outlined),
leading: const Icon(Icons.emoji_emotions_outlined),
title: const Text('Reaktionen'),
onTap: () {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => MessageReactions(