lint changes reactions

This commit is contained in:
Deven Joshi
2021-05-05 16:32:32 +05:30
parent d1705c26a3
commit 645d21503a
2 changed files with 99 additions and 97 deletions
@@ -1,9 +1,14 @@
/// Reaction icon data
class ReactionIcon {
final String type;
final String assetName;
/// Constructor for creating [ReactionIcon]
ReactionIcon({
required this.type,
required this.assetName,
});
/// Type of reaction
final String type;
/// Asset to display for reaction
final String assetName;
}
@@ -3,23 +3,24 @@ import 'dart:math';
import 'package:ezanimation/ezanimation.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/stream_svg_icon.dart';
import '../stream_chat_flutter.dart';
import 'extension.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.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_paint.png)
///
/// It shows a reaction picker
///
/// Usually you don't use this widget as it's one of the default widgets used by [MessageWidget.onMessageActions].
/// Usually you don't use this widget as it's one of the default widgets used
/// by [MessageWidget.onMessageActions].
class ReactionPicker extends StatefulWidget {
/// Constructor for creating a [ReactionPicker] widget
const ReactionPicker({
Key? key,
required this.message,
}) : super(key: key);
/// Message to attach the reaction to
final Message message;
@override
@@ -39,7 +40,7 @@ class _ReactionPickerState extends State<ReactionPicker>
animations.add(
EzAnimation.tween(
Tween(begin: 0.0, end: 1.0),
Duration(milliseconds: 500),
const Duration(milliseconds: 500),
curve: Curves.easeInOutBack,
),
);
@@ -51,9 +52,8 @@ class _ReactionPickerState extends State<ReactionPicker>
return TweenAnimationBuilder<double>(
tween: Tween(begin: 0, end: 1),
curve: Curves.easeInOutBack,
duration: Duration(milliseconds: 500),
builder: (context, val, wid) {
return Transform.scale(
duration: const Duration(milliseconds: 500),
builder: (context, val, wid) => Transform.scale(
scale: val,
child: Material(
borderRadius: BorderRadius.circular(24),
@@ -77,7 +77,7 @@ class _ReactionPickerState extends State<ReactionPicker>
final index = reactionIcons.indexOf(reactionIcon);
return ConstrainedBox(
constraints: BoxConstraints.tightFor(
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
@@ -86,7 +86,7 @@ class _ReactionPickerState extends State<ReactionPicker>
shape: ContinuousRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
constraints: BoxConstraints.tightFor(
constraints: const BoxConstraints.tightFor(
height: 24,
width: 24,
),
@@ -94,8 +94,8 @@ class _ReactionPickerState extends State<ReactionPicker>
if (ownReactionIndex != -1) {
removeReaction(
context,
widget
.message.ownReactions![ownReactionIndex],
widget.message
.ownReactions![ownReactionIndex],
);
} else {
sendReaction(
@@ -106,8 +106,7 @@ class _ReactionPickerState extends State<ReactionPicker>
},
child: AnimatedBuilder(
animation: animations[index],
builder: (context, val) {
return Transform.scale(
builder: (context, val) => Transform.scale(
scale: animations[index].value,
child: StreamSvgIcon(
assetName: reactionIcon.assetName,
@@ -128,31 +127,29 @@ class _ReactionPickerState extends State<ReactionPicker>
.color!
.withOpacity(.5),
),
);
}),
)),
),
);
})
.insertBetween(SizedBox(
.insertBetween(const SizedBox(
width: 16,
))
.toList(),
),
),
),
);
});
));
}
void triggerAnimations() async {
for (var a in animations) {
for (final a in animations) {
a.start();
await Future.delayed(Duration(milliseconds: 100));
await Future.delayed(const Duration(milliseconds: 100));
}
}
void pop() async {
for (var a in animations) {
for (final a in animations) {
a.stop();
}
Navigator.of(context).pop();
@@ -176,7 +173,7 @@ class _ReactionPickerState extends State<ReactionPicker>
@override
void dispose() {
for (var a in animations) {
for (final a in animations) {
a.dispose();
}
super.dispose();