fix reaction picker spacing and size

This commit is contained in:
Salvatore Giordano
2021-01-12 14:35:29 +01:00
parent 40910f93f1
commit 294c9edafb
+51 -45
View File
@@ -78,57 +78,63 @@ class _ReactionPickerState extends State<ReactionPicker>
-1; -1;
var index = reactionIcons.indexOf(reactionIcon); var index = reactionIcons.indexOf(reactionIcon);
return RawMaterialButton( return ConstrainedBox(
elevation: 0,
padding: const EdgeInsets.all(0),
clipBehavior: Clip.none,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
constraints: BoxConstraints.tightFor( constraints: BoxConstraints.tightFor(
height: 24, height: 24,
width: 24, width: 24,
), ),
child: AnimatedBuilder( child: RawMaterialButton(
animation: animations[index], elevation: 0,
builder: (context, val) { padding: const EdgeInsets.all(0),
return Transform.scale( clipBehavior: Clip.none,
alignment: Alignment.center, shape: ContinuousRectangleBorder(
scale: animations[index].value, borderRadius: BorderRadius.circular(16),
child: StreamSvgIcon( ),
assetName: reactionIcon.assetName, constraints: BoxConstraints.tightFor(
height: max( height: 24,
0, width: 24,
animations[index].value * 24.0, ),
child: AnimatedBuilder(
animation: animations[index],
builder: (context, val) {
return Transform.scale(
alignment: Alignment.center,
scale: animations[index].value,
child: StreamSvgIcon(
assetName: reactionIcon.assetName,
height: max(
0,
animations[index].value * 24.0,
),
width: max(
0,
animations[index].value * 24.0,
),
color: ownReactionIndex != -1
? StreamChatTheme.of(context)
.colorTheme
.accentBlue
: Theme.of(context)
.iconTheme
.color
.withOpacity(.5),
), ),
width: max( );
0, }),
animations[index].value * 24.0, onPressed: () {
), if (ownReactionIndex != -1) {
color: ownReactionIndex != -1 removeReaction(
? StreamChatTheme.of(context) context,
.colorTheme widget.message.ownReactions[ownReactionIndex],
.accentBlue
: Theme.of(context)
.iconTheme
.color
.withOpacity(.5),
),
); );
}), } else {
onPressed: () { sendReaction(
if (ownReactionIndex != -1) { context,
removeReaction( reactionIcon.type,
context, );
widget.message.ownReactions[ownReactionIndex], }
); },
} else { ),
sendReaction(
context,
reactionIcon.type,
);
}
},
); );
}) })
.insertBetween(SizedBox( .insertBetween(SizedBox(