lint
This commit is contained in:
@@ -26,6 +26,7 @@ class TypingIndicator extends StatelessWidget {
|
||||
/// The padding of this widget
|
||||
final EdgeInsets padding;
|
||||
|
||||
/// Alignment of the typing indicator
|
||||
final Alignment alignment;
|
||||
|
||||
@override
|
||||
@@ -35,41 +36,40 @@ class TypingIndicator extends StatelessWidget {
|
||||
return StreamBuilder<List<User>>(
|
||||
initialData: channelState.typingEvents,
|
||||
stream: channelState.typingEventsStream,
|
||||
builder: (context, snapshot) {
|
||||
return AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 300),
|
||||
child: snapshot.data?.isNotEmpty == true
|
||||
? Padding(
|
||||
padding: padding,
|
||||
child: Align(
|
||||
key: Key('typings'),
|
||||
alignment: alignment,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Lottie.asset(
|
||||
'animations/typing_dots.json',
|
||||
package: 'stream_chat_flutter',
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
' ${snapshot.data![0].name}${snapshot.data!.length == 1 ? '' : ' and ${snapshot.data!.length - 1} more'} ${snapshot.data!.length == 1 ? 'is' : 'are'} typing',
|
||||
maxLines: 1,
|
||||
style: style,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: Align(
|
||||
key: Key('alternative'),
|
||||
builder: (context, snapshot) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: snapshot.data?.isNotEmpty == true
|
||||
? Padding(
|
||||
padding: padding,
|
||||
child: Align(
|
||||
key: const Key('typings'),
|
||||
alignment: alignment,
|
||||
child: Container(
|
||||
child: alternativeWidget ?? Offstage(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Lottie.asset(
|
||||
'animations/typing_dots.json',
|
||||
package: 'stream_chat_flutter',
|
||||
height: 4,
|
||||
),
|
||||
Text(
|
||||
// ignore: lines_longer_than_80_chars
|
||||
' ${snapshot.data![0].name}${snapshot.data!.length == 1 ? '' : ' and ${snapshot.data!.length - 1} more'} ${snapshot.data!.length == 1 ? 'is' : 'are'} typing',
|
||||
maxLines: 1,
|
||||
style: style,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: Align(
|
||||
key: const Key('alternative'),
|
||||
alignment: alignment,
|
||||
child: Container(
|
||||
child: alternativeWidget ?? const Offstage(),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/src/stream_chat_theme.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
/// Widget for showing an unread indicator
|
||||
class UnreadIndicator extends StatelessWidget {
|
||||
/// Constructor for creating an [UnreadIndicator]
|
||||
const UnreadIndicator({
|
||||
Key? key,
|
||||
this.cid,
|
||||
@@ -24,7 +26,7 @@ class UnreadIndicator extends StatelessWidget {
|
||||
: client.state.totalUnreadCount,
|
||||
builder: (context, snapshot) {
|
||||
if (!snapshot.hasData || snapshot.data == 0) {
|
||||
return SizedBox();
|
||||
return const SizedBox();
|
||||
}
|
||||
return Material(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -41,7 +43,7 @@ class UnreadIndicator extends StatelessWidget {
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${snapshot.data! > 99 ? '99+' : snapshot.data}',
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 11,
|
||||
color: Colors.white,
|
||||
),
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
|
||||
import 'stream_chat_theme.dart';
|
||||
|
||||
/// Widget for showing upload progress
|
||||
class UploadProgressIndicator extends StatelessWidget {
|
||||
final int uploaded;
|
||||
final int total;
|
||||
final Color progressIndicatorColor;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final bool showBackground;
|
||||
final TextStyle? textStyle;
|
||||
|
||||
/// Constructor for creating an [UploadProgressIndicator]
|
||||
const UploadProgressIndicator({
|
||||
Key? key,
|
||||
required this.uploaded,
|
||||
@@ -25,6 +19,24 @@ class UploadProgressIndicator extends StatelessWidget {
|
||||
this.textStyle,
|
||||
}) : super(key: key);
|
||||
|
||||
/// Bytes uploaded
|
||||
final int uploaded;
|
||||
|
||||
/// Total bytes
|
||||
final int total;
|
||||
|
||||
/// Color of progress indicator
|
||||
final Color progressIndicatorColor;
|
||||
|
||||
/// Padding for widget
|
||||
final EdgeInsetsGeometry padding;
|
||||
|
||||
/// Flag for showing background
|
||||
final bool showBackground;
|
||||
|
||||
/// [TextStyle] to be applied to text
|
||||
final TextStyle? textStyle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = StreamChatTheme.of(context);
|
||||
@@ -42,7 +54,7 @@ class UploadProgressIndicator extends StatelessWidget {
|
||||
valueColor: AlwaysStoppedAnimation(progressIndicatorColor),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'${_percentage.toInt()}%',
|
||||
style: textStyle ??
|
||||
|
||||
Reference in New Issue
Block a user