chore: Follow up emoji picker

This commit is contained in:
krille-chan 2025-06-17 20:57:12 +02:00
commit ba61e3c164
No known key found for this signature in database

View file

@ -424,10 +424,8 @@ class Message extends StatelessWidget {
),
Container(
alignment: alignment,
padding: EdgeInsets.only(
left: 8,
bottom: showReactionPicker ? 40 : 0,
),
padding:
const EdgeInsets.only(left: 8),
child: GestureDetector(
onLongPress: longPressSelect
? null
@ -633,64 +631,77 @@ class Message extends StatelessWidget {
),
),
),
],
),
),
],
),
Positioned(
left:
ownMessage ? null : Avatar.defaultSize + 8,
right: ownMessage ? 0 : null,
bottom: 0,
Align(
alignment: ownMessage
? Alignment.bottomRight
: Alignment.bottomLeft,
child: AnimatedSize(
duration: FluffyThemes.animationDuration,
duration:
FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
alignment: Alignment.bottomCenter,
child: showReactionPicker
? Padding(
padding: const EdgeInsets.only(
top: 8.0,
padding:
const EdgeInsets.only(
top: 4.0,
bottom: 4.0,
left: 8.0,
),
child: Material(
elevation: 4,
borderRadius: BorderRadius.circular(
borderRadius:
BorderRadius.circular(
AppConfig.borderRadius,
),
shadowColor: theme
.colorScheme.surface
.withAlpha(128),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisSize:
MainAxisSize.min,
children: [
...AppConfig.defaultReactions
...AppConfig
.defaultReactions
.map(
(emoji) => IconButton(
padding: EdgeInsets.zero,
(emoji) =>
IconButton(
padding:
EdgeInsets
.zero,
icon: Center(
child: Opacity(
opacity: sentReactions
.contains(emoji)
opacity:
sentReactions
.contains(
emoji,
)
? 0.33
: 1,
child: Text(
emoji,
style:
const TextStyle(
fontSize: 20,
fontSize:
20,
),
textAlign:
TextAlign.center,
TextAlign
.center,
),
),
),
onPressed: sentReactions
.contains(emoji)
onPressed:
sentReactions
.contains(
emoji,
)
? null
: () {
onSelect(event);
event.room
onSelect(
event,
);
event
.room
.sendReaction(
event.eventId,
emoji,
@ -700,24 +711,32 @@ class Message extends StatelessWidget {
),
IconButton(
icon: const Icon(
Icons.add_reaction_outlined,
Icons
.add_reaction_outlined,
),
tooltip: L10n.of(context)
.customReaction,
onPressed: () async {
tooltip: L10n.of(
context,
).customReaction,
onPressed:
() async {
final emoji =
await showAdaptiveBottomSheet<
String>(
context: context,
builder: (context) =>
context:
context,
builder:
(context) =>
Scaffold(
appBar: AppBar(
appBar:
AppBar(
title: Text(
L10n.of(context)
.customReaction,
),
leading: CloseButton(
onPressed: () =>
leading:
CloseButton(
onPressed:
() =>
Navigator.of(
context,
).pop(
@ -725,10 +744,12 @@ class Message extends StatelessWidget {
),
),
),
body: SizedBox(
height:
double.infinity,
child: EmojiPicker(
body:
SizedBox(
height: double
.infinity,
child:
EmojiPicker(
onEmojiSelected: (
_,
emoji,
@ -736,24 +757,25 @@ class Message extends StatelessWidget {
Navigator.of(
context,
).pop(
emoji.emoji,
emoji
.emoji,
),
config: Config(
config:
Config(
emojiViewConfig:
const EmojiViewConfig(
backgroundColor:
Colors
.transparent,
Colors.transparent,
),
bottomActionBarConfig:
const BottomActionBarConfig(
enabled: false,
enabled:
false,
),
categoryViewConfig:
CategoryViewConfig(
initCategory:
Category
.SMILEYS,
Category.SMILEYS,
backspaceColor: theme
.colorScheme
.primary,
@ -763,15 +785,13 @@ class Message extends StatelessWidget {
.withAlpha(
128,
),
iconColorSelected:
theme
iconColorSelected: theme
.colorScheme
.primary,
indicatorColor: theme
.colorScheme
.primary,
backgroundColor:
theme
backgroundColor: theme
.colorScheme
.surface,
),
@ -779,12 +799,8 @@ class Message extends StatelessWidget {
SkinToneConfig(
dialogBackgroundColor:
Color.lerp(
theme
.colorScheme
.surface,
theme
.colorScheme
.primaryContainer,
theme.colorScheme.surface,
theme.colorScheme.primaryContainer,
0.75,
)!,
indicatorColor: theme
@ -796,8 +812,12 @@ class Message extends StatelessWidget {
),
),
);
if (emoji == null) return;
if (sentReactions.contains(
if (emoji ==
null) {
return;
}
if (sentReactions
.contains(
emoji,
)) {
return;
@ -820,6 +840,11 @@ class Message extends StatelessWidget {
),
],
),
),
],
),
],
),
);
},
),