chore: Follow up reactions picker

pull/1815/head rc2.0.0-3
krille-chan 4 months ago
parent 959d75fb9d
commit f82d26eed1
No known key found for this signature in database

@ -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,
);
},
), ),
onPressed:
sentReactions
.contains(
emoji,
)
? null
: () {
onSelect(
event,
);
event
.room
.sendReaction(
event.eventId,
emoji,
);
},
),
),
IconButton(
icon: const Icon(
Icons
.add_reaction_outlined,
), ),
tooltip: L10n.of( IconButton(
context, icon: const Icon(
).customReaction, Icons
onPressed: .add_reaction_outlined,
() async { ),
final emoji = tooltip: L10n.of(
await showAdaptiveBottomSheet< context,
String>( ).customReaction,
context: onPressed:
context, () async {
builder: final emoji =
(context) => await showAdaptiveBottomSheet<
Scaffold( String>(
appBar: context:
AppBar( context,
title: Text( builder:
L10n.of(context) (context) =>
.customReaction, Scaffold(
), appBar:
leading: AppBar(
CloseButton( title:
onPressed: Text(
() => L10n.of(context)
Navigator.of( .customReaction,
context,
).pop(
null,
),
),
),
body:
SizedBox(
height: double
.infinity,
child:
EmojiPicker(
onEmojiSelected: (
_,
emoji,
) =>
Navigator.of(
context,
).pop(
emoji
.emoji,
), ),
config: leading:
Config( CloseButton(
emojiViewConfig: onPressed:
const EmojiViewConfig( () =>
backgroundColor: Navigator.of(
Colors.transparent, context,
).pop(
null,
), ),
bottomActionBarConfig: ),
const BottomActionBarConfig( ),
enabled: body:
false, SizedBox(
height: double
.infinity,
child:
EmojiPicker(
onEmojiSelected: (
_,
emoji,
) =>
Navigator.of(
context,
).pop(
emoji
.emoji,
), ),
categoryViewConfig: config:
CategoryViewConfig( Config(
initCategory: emojiViewConfig:
Category.SMILEYS, const EmojiViewConfig(
backspaceColor: theme backgroundColor:
.colorScheme Colors.transparent,
.primary, ),
iconColor: theme bottomActionBarConfig:
.colorScheme const BottomActionBarConfig(
.primary enabled:
.withAlpha( false,
128, ),
categoryViewConfig:
CategoryViewConfig(
initCategory:
Category.SMILEYS,
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,
); );
}, },
), ),
], ],
),
), ),
), ),
) )

Loading…
Cancel
Save