add lottie animation for typing indicator

This commit is contained in:
Salvatore Giordano
2020-11-25 12:25:43 +01:00
parent 9fd7a6a7f8
commit 24c5e39bda
5 changed files with 26 additions and 26 deletions
File diff suppressed because one or more lines are too long
+6 -21
View File
@@ -227,27 +227,12 @@ class ChannelPage extends StatelessWidget {
body: Column(
children: <Widget>[
Expanded(
child: Stack(
children: <Widget>[
MessageListView(
threadBuilder: (_, parentMessage) {
return ThreadPage(
parent: parentMessage,
);
},
),
Positioned.fill(
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 4,
),
child: TypingIndicator(
alignment: Alignment.bottomRight,
),
),
),
],
child: MessageListView(
threadBuilder: (_, parentMessage) {
return ThreadPage(
parent: parentMessage,
);
},
),
),
MessageInput(),
+1 -1
View File
@@ -1,6 +1,6 @@
name: example
description: A new Flutter project.
version: 1.0.72+74
version: 1.0.74+76
environment:
sdk: ">=2.2.2 <3.0.0"
+16 -4
View File
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:stream_chat/stream_chat.dart';
import 'package:stream_chat_flutter/src/stream_channel.dart';
@@ -38,10 +39,21 @@ class TypingIndicator extends StatelessWidget {
? Align(
key: Key('typings'),
alignment: alignment,
child: Text(
'${snapshot.data.map((u) => u.name).join(',')} ${snapshot.data.length == 1 ? 'is' : 'are'} typing...',
maxLines: 1,
style: style,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Lottie.asset(
'animations/typing_dots.json',
package: 'stream_chat_flutter',
alignment: Alignment.center,
height: 4,
),
Text(
' ${snapshot.data.map((u) => u.name).join(',')} ${snapshot.data.length == 1 ? 'is' : 'are'} typing',
maxLines: 1,
style: style,
),
],
),
)
: Align(
+2
View File
@@ -32,6 +32,7 @@ dependencies:
mime: ^0.9.6+3
visibility_detector: ^0.1.5
http_parser: ^3.1.4
lottie: ^0.7.0+1
substring_highlight: ^0.1.2
flutter_slidable: ^0.5.4
carousel_slider: ^2.2.1
@@ -47,6 +48,7 @@ flutter:
- images/
- svgs/
- lib/svgs/
- animations/
dev_dependencies:
pedantic: ^1.9.0