fix reaction picker spacing and size

This commit is contained in:
Salvatore Giordano
2021-01-12 13:49:44 +01:00
parent d9a50ae42e
commit 40910f93f1
2 changed files with 71 additions and 54 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
name: example name: example
description: A new Flutter project. description: A new Flutter project.
version: 1.1.0+2 version: 1.1.0+3
environment: environment:
sdk: ">=2.2.2 <3.0.0" sdk: ">=2.2.2 <3.0.0"
+26 -9
View File
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/stream_svg_icon.dart'; import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
import '../stream_chat_flutter.dart'; import '../stream_chat_flutter.dart';
import 'extension.dart';
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/reaction_picker.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/reaction_picker.png)
/// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/reaction_picker_paint.png) /// ![screenshot](https://raw.githubusercontent.com/GetStream/stream-chat-flutter/master/screenshots/reaction_picker_paint.png)
@@ -57,30 +58,42 @@ class _ReactionPickerState extends State<ReactionPicker>
return Transform.scale( return Transform.scale(
scale: val, scale: val,
child: Material( child: Material(
borderRadius: BorderRadius.circular(24),
color: StreamChatTheme.of(context).colorTheme.white, color: StreamChatTheme.of(context).colorTheme.white,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0), padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 8.0,
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: reactionIcons.map((reactionIcon) { children: reactionIcons
.map<Widget>((reactionIcon) {
final ownReactionIndex = widget.message.ownReactions final ownReactionIndex = widget.message.ownReactions
?.indexWhere((reaction) => ?.indexWhere((reaction) =>
reaction.type == reactionIcon.type) ?? reaction.type == reactionIcon.type) ??
-1; -1;
var index = reactionIcons.indexOf(reactionIcon); var index = reactionIcons.indexOf(reactionIcon);
return IconButton( return RawMaterialButton(
iconSize: 24, elevation: 0,
icon: AnimatedBuilder( padding: const EdgeInsets.all(0),
clipBehavior: Clip.none,
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
constraints: BoxConstraints.tightFor(
height: 24,
width: 24,
),
child: AnimatedBuilder(
animation: animations[index], animation: animations[index],
builder: (context, val) { builder: (context, val) {
return Transform.scale( return Transform.scale(
alignment: Alignment.center,
scale: animations[index].value, scale: animations[index].value,
child: StreamSvgIcon( child: StreamSvgIcon(
assetName: reactionIcon.assetName, assetName: reactionIcon.assetName,
@@ -117,7 +130,11 @@ class _ReactionPickerState extends State<ReactionPicker>
} }
}, },
); );
}).toList(), })
.insertBetween(SizedBox(
width: 16,
))
.toList(),
), ),
), ),
), ),