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