lint
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
/// Displays a list of users who reacted
|
||||
class UserReactionDisplay extends StatelessWidget {
|
||||
|
||||
/// Constructor for creating a [UserReactionDisplay]
|
||||
const UserReactionDisplay({
|
||||
Key? key,
|
||||
@@ -24,38 +23,38 @@ class UserReactionDisplay extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Container(
|
||||
color: Colors.black87,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: reactionToEmoji.keys.map((reactionType) {
|
||||
final firstUserReaction = message.latestReactions!
|
||||
.firstWhere((element) => element.type == reactionType,
|
||||
//ignore: unnecessary_parenthesis
|
||||
orElse: (() => null) as Reaction Function()?);
|
||||
color: Colors.black87,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: reactionToEmoji.keys.map((reactionType) {
|
||||
final firstUserReaction = message.latestReactions!
|
||||
.firstWhere((element) => element.type == reactionType,
|
||||
//ignore: unnecessary_parenthesis
|
||||
orElse: (() => null) as Reaction Function()?);
|
||||
|
||||
if (firstUserReaction.user == null) {
|
||||
return IconButton(
|
||||
iconSize: size,
|
||||
icon: Container(),
|
||||
onPressed: null,
|
||||
);
|
||||
}
|
||||
|
||||
if (firstUserReaction.user == null) {
|
||||
return IconButton(
|
||||
iconSize: size,
|
||||
icon: Container(),
|
||||
onPressed: null,
|
||||
);
|
||||
}
|
||||
|
||||
return IconButton(
|
||||
iconSize: size,
|
||||
icon: UserAvatar(
|
||||
user: firstUserReaction.user!,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: size - 5,
|
||||
maxWidth: size - 5,
|
||||
icon: UserAvatar(
|
||||
user: firstUserReaction.user!,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: size - 5,
|
||||
maxWidth: size - 5,
|
||||
),
|
||||
onTap: (user) {},
|
||||
),
|
||||
onTap: (user) {},
|
||||
),
|
||||
onPressed: () {},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
onPressed: () {},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,88 +27,89 @@ Future<bool?> showConfirmationDialog(
|
||||
Widget? icon,
|
||||
String? question,
|
||||
String? cancelText,
|
||||
}) => showModalBottomSheet(
|
||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
builder: (context) {
|
||||
final effect = StreamChatTheme.of(context).colorTheme.borderTop;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(height: 26),
|
||||
if (icon != null) icon,
|
||||
const SizedBox(height: 26),
|
||||
Text(
|
||||
title,
|
||||
style: StreamChatTheme.of(context).textTheme.headlineBold,
|
||||
),
|
||||
const SizedBox(height: 7),
|
||||
if (question != null)
|
||||
}) =>
|
||||
showModalBottomSheet(
|
||||
backgroundColor: StreamChatTheme.of(context).colorTheme.white,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
builder: (context) {
|
||||
final effect = StreamChatTheme.of(context).colorTheme.borderTop;
|
||||
return SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(height: 26),
|
||||
if (icon != null) icon,
|
||||
const SizedBox(height: 26),
|
||||
Text(
|
||||
question,
|
||||
textAlign: TextAlign.center,
|
||||
title,
|
||||
style: StreamChatTheme.of(context).textTheme.headlineBold,
|
||||
),
|
||||
const SizedBox(height: 36),
|
||||
Container(
|
||||
color: effect.color!.withOpacity(effect.alpha ?? 1),
|
||||
height: 1,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (cancelText != null)
|
||||
const SizedBox(height: 7),
|
||||
if (question != null)
|
||||
Text(
|
||||
question,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(height: 36),
|
||||
Container(
|
||||
color: effect.color!.withOpacity(effect.alpha ?? 1),
|
||||
height: 1,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
if (cancelText != null)
|
||||
Flexible(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
},
|
||||
child: Text(
|
||||
cancelText,
|
||||
style: StreamChatTheme.of(context)
|
||||
.textTheme
|
||||
.bodyBold
|
||||
.copyWith(
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme
|
||||
.black
|
||||
.withOpacity(0.5)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(false);
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Text(
|
||||
cancelText,
|
||||
okText,
|
||||
style: StreamChatTheme.of(context)
|
||||
.textTheme
|
||||
.bodyBold
|
||||
.copyWith(
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme
|
||||
.black
|
||||
.withOpacity(0.5)),
|
||||
.accentRed),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
child: Text(
|
||||
okText,
|
||||
style: StreamChatTheme.of(context)
|
||||
.textTheme
|
||||
.bodyBold
|
||||
.copyWith(
|
||||
color: StreamChatTheme.of(context)
|
||||
.colorTheme
|
||||
.accentRed),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
/// Shows info dialog
|
||||
Future<bool?> showInfoDialog(
|
||||
@@ -118,16 +119,17 @@ Future<bool?> showInfoDialog(
|
||||
Widget? icon,
|
||||
String? details,
|
||||
StreamChatThemeData? theme,
|
||||
}) => showModalBottomSheet(
|
||||
backgroundColor:
|
||||
theme?.colorTheme.white ?? StreamChatTheme.of(context).colorTheme.white,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
builder: (context) => SafeArea(
|
||||
}) =>
|
||||
showModalBottomSheet(
|
||||
backgroundColor: theme?.colorTheme.white ??
|
||||
StreamChatTheme.of(context).colorTheme.white,
|
||||
context: context,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16),
|
||||
topRight: Radius.circular(16),
|
||||
)),
|
||||
builder: (context) => SafeArea(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -173,7 +175,7 @@ Future<bool?> showInfoDialog(
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
|
||||
/// Get random png with initials
|
||||
String getRandomPicUrl(User user) =>
|
||||
@@ -338,16 +340,17 @@ Widget wrapAttachmentWidget(
|
||||
// ignore: avoid_positional_boolean_parameters
|
||||
bool reverse,
|
||||
BorderRadius borderRadius,
|
||||
) => ClipRRect(
|
||||
borderRadius: borderRadius,
|
||||
child: Material(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: attachmentShape,
|
||||
type: MaterialType.transparency,
|
||||
child: Transform(
|
||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
||||
alignment: Alignment.center,
|
||||
child: attachmentWidget,
|
||||
) =>
|
||||
ClipRRect(
|
||||
borderRadius: borderRadius,
|
||||
child: Material(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
shape: attachmentShape,
|
||||
type: MaterialType.transparency,
|
||||
child: Transform(
|
||||
transform: Matrix4.rotationY(reverse ? pi : 0),
|
||||
alignment: Alignment.center,
|
||||
child: attachmentWidget,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
|
||||
@@ -4,10 +4,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:shimmer/shimmer.dart';
|
||||
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
|
||||
import 'package:video_thumbnail/video_thumbnail.dart';
|
||||
import 'package:stream_chat_flutter/src/video_service.dart';
|
||||
|
||||
import 'stream_svg_icon.dart';
|
||||
import 'video_service.dart';
|
||||
|
||||
/// Widget for creating video thumbnail image
|
||||
class VideoThumbnailImage extends StatefulWidget {
|
||||
/// Constructor for creating [VideoThumbnailImage]
|
||||
const VideoThumbnailImage({
|
||||
@@ -38,6 +37,8 @@ class VideoThumbnailImage extends StatefulWidget {
|
||||
|
||||
/// Builds widget on error
|
||||
final Widget Function(BuildContext, Object?)? errorBuilder;
|
||||
|
||||
/// Builds placeholder
|
||||
final WidgetBuilder? placeholderBuilder;
|
||||
|
||||
@override
|
||||
@@ -69,8 +70,8 @@ class _VideoThumbnailImageState extends State<VideoThumbnailImage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => FutureBuilder<Uint8List?>(
|
||||
future: thumbnailFuture,
|
||||
builder: (context, snapshot) => AnimatedSwitcher(
|
||||
future: thumbnailFuture,
|
||||
builder: (context, snapshot) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 350),
|
||||
child: Builder(
|
||||
key: ValueKey<AsyncSnapshot<Uint8List?>>(snapshot),
|
||||
@@ -108,5 +109,5 @@ class _VideoThumbnailImageState extends State<VideoThumbnailImage> {
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user