chore: Follow up reactions picker

This commit is contained in:
krille-chan 2025-06-17 21:27:25 +02:00
commit f82d26eed1
No known key found for this signature in database

View file

@ -642,10 +642,8 @@ class Message extends StatelessWidget {
child: showReactionPicker child: showReactionPicker
? Padding( ? Padding(
padding: padding:
const EdgeInsets.only( const EdgeInsets.all(
top: 4.0, 4.0,
bottom: 4.0,
left: 8.0,
), ),
child: Material( child: Material(
elevation: 4, elevation: 4,
@ -656,182 +654,179 @@ class Message extends StatelessWidget {
shadowColor: theme shadowColor: theme
.colorScheme.surface .colorScheme.surface
.withAlpha(128), .withAlpha(128),
child: Row( child:
mainAxisSize: SingleChildScrollView(
MainAxisSize.min, scrollDirection:
children: [ Axis.horizontal,
...AppConfig child: Row(
.defaultReactions mainAxisSize:
.map( MainAxisSize.min,
(emoji) => children: [
IconButton( ...AppConfig
padding: .defaultReactions
EdgeInsets .map(
.zero, (emoji) =>
icon: Center( IconButton(
child: Opacity( padding:
opacity: EdgeInsets
sentReactions .zero,
.contains( icon: Center(
emoji, child:
) Opacity(
? 0.33 opacity: sentReactions
: 1, .contains(
child: Text( emoji,
emoji, )
style: ? 0.33
const TextStyle( : 1,
fontSize: child: Text(
20, emoji,
style:
const TextStyle(
fontSize:
20,
),
textAlign:
TextAlign
.center,
), ),
textAlign:
TextAlign
.center,
), ),
), ),
onPressed:
sentReactions
.contains(
emoji,
)
? null
: () {
onSelect(
event,
);
event.room.sendReaction(
event.eventId,
emoji,
);
},
), ),
),
IconButton(
icon: const Icon(
Icons
.add_reaction_outlined,
),
tooltip: L10n.of(
context,
).customReaction,
onPressed: onPressed:
sentReactions () async {
.contains( final emoji =
emoji, await showAdaptiveBottomSheet<
) String>(
? null context:
: () { context,
onSelect( builder:
event, (context) =>
); Scaffold(
event appBar:
.room AppBar(
.sendReaction( title:
event.eventId, Text(
emoji, L10n.of(context)
); .customReaction,
}, ),
), leading:
), CloseButton(
IconButton( onPressed:
icon: const Icon( () =>
Icons Navigator.of(
.add_reaction_outlined, context,
), ).pop(
tooltip: L10n.of( null,
context, ),
).customReaction,
onPressed:
() async {
final emoji =
await showAdaptiveBottomSheet<
String>(
context:
context,
builder:
(context) =>
Scaffold(
appBar:
AppBar(
title: Text(
L10n.of(context)
.customReaction,
),
leading:
CloseButton(
onPressed:
() =>
Navigator.of(
context,
).pop(
null,
), ),
), ),
), body:
body: SizedBox(
SizedBox( height: double
height: double .infinity,
.infinity, child:
child: EmojiPicker(
EmojiPicker( onEmojiSelected: (
onEmojiSelected: ( _,
_, emoji,
emoji, ) =>
) => Navigator.of(
Navigator.of( context,
context, ).pop(
).pop( emoji
emoji .emoji,
.emoji,
),
config:
Config(
emojiViewConfig:
const EmojiViewConfig(
backgroundColor:
Colors.transparent,
), ),
bottomActionBarConfig: config:
const BottomActionBarConfig( Config(
enabled: emojiViewConfig:
false, const EmojiViewConfig(
), backgroundColor:
categoryViewConfig: Colors.transparent,
CategoryViewConfig( ),
initCategory: bottomActionBarConfig:
Category.SMILEYS, const BottomActionBarConfig(
backspaceColor: theme enabled:
.colorScheme false,
.primary, ),
iconColor: theme categoryViewConfig:
.colorScheme CategoryViewConfig(
.primary initCategory:
.withAlpha( Category.SMILEYS,
128, backspaceColor:
theme.colorScheme.primary,
iconColor:
theme.colorScheme.primary.withAlpha(
128,
),
iconColorSelected:
theme.colorScheme.primary,
indicatorColor:
theme.colorScheme.primary,
backgroundColor:
theme.colorScheme.surface,
),
skinToneConfig:
SkinToneConfig(
dialogBackgroundColor:
Color.lerp(
theme.colorScheme.surface,
theme.colorScheme.primaryContainer,
0.75,
)!,
indicatorColor:
theme.colorScheme.onSurface,
), ),
iconColorSelected: theme
.colorScheme
.primary,
indicatorColor: theme
.colorScheme
.primary,
backgroundColor: theme
.colorScheme
.surface,
),
skinToneConfig:
SkinToneConfig(
dialogBackgroundColor:
Color.lerp(
theme.colorScheme.surface,
theme.colorScheme.primaryContainer,
0.75,
)!,
indicatorColor: theme
.colorScheme
.onSurface,
), ),
), ),
), ),
), ),
), );
); if (emoji ==
if (emoji == null) {
null) { return;
return; }
} if (sentReactions
if (sentReactions .contains(
.contains( emoji,
emoji, )) {
)) { return;
return; }
} onSelect(event);
onSelect(event);
await event.room await event.room
.sendReaction( .sendReaction(
event.eventId, event.eventId,
emoji, emoji,
); );
}, },
), ),
], ],
),
), ),
), ),
) )