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