chore(repo): finish adding dart_code_metrics.yaml
Signed-off-by: xsahil03x <xdsahil@gmail.com>
This commit is contained in:
@@ -33,7 +33,7 @@ jobs:
|
||||
flutter-version: ${{ env.flutter_version }}
|
||||
|
||||
- name: "Install Tools"
|
||||
run: flutter pub global activate melos
|
||||
run: flutter pub global activate melos 1.0.0-dev.3
|
||||
- name: "Bootstrap Workspace"
|
||||
run: melos bootstrap
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
flutter-version: ${{ env.flutter_version }}
|
||||
- name: "Install Tools"
|
||||
run: |
|
||||
flutter pub global activate melos
|
||||
flutter pub global activate melos 1.0.0-dev.3
|
||||
- name: "Bootstrap Workspace"
|
||||
run: melos bootstrap
|
||||
- name: "Dart Analyze"
|
||||
|
||||
@@ -149,12 +149,6 @@ linter:
|
||||
|
||||
# https://dartcodemetrics.dev/docs/getting-started/introduction
|
||||
dart_code_metrics:
|
||||
metrics-exclude:
|
||||
- packages/*/test/**
|
||||
metrics:
|
||||
source-lines-of-code: 90
|
||||
maximum-nesting-level: 5
|
||||
halstead-volume: 150
|
||||
rules:
|
||||
# Dart Specific
|
||||
- binary-expression-operand-order
|
||||
@@ -162,6 +156,7 @@ dart_code_metrics:
|
||||
- prefer-match-file-name:
|
||||
exclude:
|
||||
- packages/*/test/**
|
||||
- packages/*/example/**
|
||||
- packages/**/util/**
|
||||
- packages/**/utils.dart
|
||||
- packages/stream_chat/lib/src/client/client.dart
|
||||
@@ -181,5 +176,4 @@ dart_code_metrics:
|
||||
|
||||
# Flutter specific
|
||||
- always-remove-listener
|
||||
- avoid-unnecessary-setstate
|
||||
- avoid-wrapping-in-padding
|
||||
- avoid-unnecessary-setstate
|
||||
+1
-1
@@ -4,7 +4,7 @@ versioning:
|
||||
mode: independent
|
||||
|
||||
packages:
|
||||
- packages/stream_chat*/*
|
||||
- packages/**
|
||||
|
||||
scripts:
|
||||
lint:all:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: stream_chat_example
|
||||
description: A new Flutter project.
|
||||
|
||||
publish_to: "none"
|
||||
@@ -11,8 +11,7 @@ dependencies:
|
||||
cupertino_icons: ^1.0.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
stream_chat:
|
||||
path: ../
|
||||
stream_chat: ^2.2.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: stream_chat_flutter_example
|
||||
description: A new Flutter project.
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
@@ -27,18 +27,9 @@ dependencies:
|
||||
cupertino_icons: ^1.0.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dependency_overrides:
|
||||
stream_chat:
|
||||
path: ../../stream_chat
|
||||
stream_chat_flutter:
|
||||
path: ../../stream_chat_flutter
|
||||
stream_chat_flutter_core:
|
||||
path: ../../stream_chat_flutter_core
|
||||
stream_chat_localizations:
|
||||
path: ../../stream_chat_localizations
|
||||
stream_chat_persistence:
|
||||
path: ../../stream_chat_persistence
|
||||
stream_chat_flutter: ^2.2.1
|
||||
stream_chat_localizations: ^1.1.0
|
||||
stream_chat_persistence: ^2.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@@ -54,131 +54,135 @@ class AttachmentActionsModal extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
const SizedBox(height: kToolbarHeight),
|
||||
Container(
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 8),
|
||||
width: MediaQuery.of(context).size.width * 0.5,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildButton(
|
||||
context,
|
||||
context.translations.replyLabel,
|
||||
StreamSvgIcon.iconCurveLineLeftUp(
|
||||
size: 24,
|
||||
color: theme.colorTheme.textLowEmphasis,
|
||||
),
|
||||
() {
|
||||
Navigator.pop(context, ReturnActionType.reply);
|
||||
},
|
||||
),
|
||||
_buildButton(
|
||||
context,
|
||||
context.translations.showInChatLabel,
|
||||
StreamSvgIcon.eye(
|
||||
size: 24,
|
||||
color: theme.colorTheme.textHighEmphasis,
|
||||
),
|
||||
onShowMessage,
|
||||
),
|
||||
_buildButton(
|
||||
context,
|
||||
message.attachments[currentIndex].type == 'video'
|
||||
? context.translations.saveVideoLabel
|
||||
: context.translations.saveImageLabel,
|
||||
StreamSvgIcon.iconSave(
|
||||
size: 24,
|
||||
color: theme.colorTheme.textLowEmphasis,
|
||||
),
|
||||
() {
|
||||
final attachment = message.attachments[currentIndex];
|
||||
final isImage = attachment.type == 'image';
|
||||
final Future<String?> Function(
|
||||
Attachment, {
|
||||
void Function(int, int) progressCallback,
|
||||
}) saveFile = fileDownloader ?? _downloadAttachment;
|
||||
final Future<String?> Function(
|
||||
Attachment, {
|
||||
void Function(int, int) progressCallback,
|
||||
}) saveImage = imageDownloader ?? _downloadAttachment;
|
||||
final downloader = isImage ? saveImage : saveFile;
|
||||
|
||||
final progressNotifier = ValueNotifier<_DownloadProgress?>(
|
||||
_DownloadProgress.initial(),
|
||||
);
|
||||
|
||||
downloader(
|
||||
attachment,
|
||||
progressCallback: (received, total) {
|
||||
progressNotifier.value = _DownloadProgress(
|
||||
total,
|
||||
received,
|
||||
);
|
||||
},
|
||||
).catchError((e, stk) {
|
||||
progressNotifier.value = null;
|
||||
});
|
||||
|
||||
// Closing attachment actions modal before opening
|
||||
// attachment download dialog
|
||||
Navigator.pop(context);
|
||||
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
barrierColor: theme.colorTheme.overlay,
|
||||
builder: (context) => _buildDownloadProgressDialog(
|
||||
context,
|
||||
progressNotifier,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (StreamChat.of(context).currentUser?.id == message.user?.id)
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width * 0.5,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: SizedBox(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
_buildButton(
|
||||
context,
|
||||
context.translations.deleteLabel.capitalize(),
|
||||
StreamSvgIcon.delete(
|
||||
context.translations.replyLabel,
|
||||
StreamSvgIcon.iconCurveLineLeftUp(
|
||||
size: 24,
|
||||
color: theme.colorTheme.accentError,
|
||||
color: theme.colorTheme.textLowEmphasis,
|
||||
),
|
||||
() {
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
if (message.attachments.length > 1 ||
|
||||
message.text?.isNotEmpty == true) {
|
||||
final remainingAttachments = [...message.attachments]
|
||||
..removeAt(currentIndex);
|
||||
channel.updateMessage(message.copyWith(
|
||||
attachments: remainingAttachments,
|
||||
));
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..maybePop();
|
||||
} else {
|
||||
channel.deleteMessage(message);
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..maybePop();
|
||||
}
|
||||
Navigator.pop(context, ReturnActionType.reply);
|
||||
},
|
||||
color: theme.colorTheme.accentError,
|
||||
),
|
||||
]
|
||||
.map<Widget>((e) => Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: e,
|
||||
))
|
||||
.insertBetween(
|
||||
Container(
|
||||
height: 1,
|
||||
color: theme.colorTheme.borders,
|
||||
_buildButton(
|
||||
context,
|
||||
context.translations.showInChatLabel,
|
||||
StreamSvgIcon.eye(
|
||||
size: 24,
|
||||
color: theme.colorTheme.textHighEmphasis,
|
||||
),
|
||||
onShowMessage,
|
||||
),
|
||||
_buildButton(
|
||||
context,
|
||||
message.attachments[currentIndex].type == 'video'
|
||||
? context.translations.saveVideoLabel
|
||||
: context.translations.saveImageLabel,
|
||||
StreamSvgIcon.iconSave(
|
||||
size: 24,
|
||||
color: theme.colorTheme.textLowEmphasis,
|
||||
),
|
||||
() {
|
||||
final attachment = message.attachments[currentIndex];
|
||||
final isImage = attachment.type == 'image';
|
||||
final Future<String?> Function(
|
||||
Attachment, {
|
||||
void Function(int, int) progressCallback,
|
||||
}) saveFile = fileDownloader ?? _downloadAttachment;
|
||||
final Future<String?> Function(
|
||||
Attachment, {
|
||||
void Function(int, int) progressCallback,
|
||||
}) saveImage = imageDownloader ?? _downloadAttachment;
|
||||
final downloader = isImage ? saveImage : saveFile;
|
||||
|
||||
final progressNotifier =
|
||||
ValueNotifier<_DownloadProgress?>(
|
||||
_DownloadProgress.initial(),
|
||||
);
|
||||
|
||||
downloader(
|
||||
attachment,
|
||||
progressCallback: (received, total) {
|
||||
progressNotifier.value = _DownloadProgress(
|
||||
total,
|
||||
received,
|
||||
);
|
||||
},
|
||||
).catchError((e, stk) {
|
||||
progressNotifier.value = null;
|
||||
});
|
||||
|
||||
// Closing attachment actions modal before opening
|
||||
// attachment download dialog
|
||||
Navigator.pop(context);
|
||||
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
barrierColor: theme.colorTheme.overlay,
|
||||
builder: (context) => _buildDownloadProgressDialog(
|
||||
context,
|
||||
progressNotifier,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
if (StreamChat.of(context).currentUser?.id ==
|
||||
message.user?.id)
|
||||
_buildButton(
|
||||
context,
|
||||
context.translations.deleteLabel.capitalize(),
|
||||
StreamSvgIcon.delete(
|
||||
size: 24,
|
||||
color: theme.colorTheme.accentError,
|
||||
),
|
||||
() {
|
||||
final channel = StreamChannel.of(context).channel;
|
||||
if (message.attachments.length > 1 ||
|
||||
message.text?.isNotEmpty == true) {
|
||||
final remainingAttachments = [...message.attachments]
|
||||
..removeAt(currentIndex);
|
||||
channel.updateMessage(message.copyWith(
|
||||
attachments: remainingAttachments,
|
||||
));
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..maybePop();
|
||||
} else {
|
||||
channel.deleteMessage(message);
|
||||
Navigator.of(context)
|
||||
..pop()
|
||||
..maybePop();
|
||||
}
|
||||
},
|
||||
color: theme.colorTheme.accentError,
|
||||
),
|
||||
]
|
||||
.map<Widget>((e) => Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: e,
|
||||
))
|
||||
.insertBetween(
|
||||
Container(
|
||||
height: 1,
|
||||
color: theme.colorTheme.borders,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -112,8 +112,8 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
||||
attachment.assetUrl ??
|
||||
attachment.thumbUrl;
|
||||
return PhotoView(
|
||||
loadingBuilder: (context, image) =>
|
||||
const Offstage(),imageProvider: (imageUrl == null &&
|
||||
loadingBuilder: (context, image) => const Offstage(),
|
||||
imageProvider: (imageUrl == null &&
|
||||
attachment.localUri != null &&
|
||||
attachment.file?.bytes != null)
|
||||
? Image.memory(attachment.file!.bytes!).image
|
||||
|
||||
@@ -251,26 +251,29 @@ class _GalleryFooterState extends State<GalleryFooter> {
|
||||
children: [
|
||||
media,
|
||||
if (widget.message.user != null)
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white.withOpacity(0.6),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 8,
|
||||
color: chatThemeData
|
||||
.colorTheme.textHighEmphasis
|
||||
.withOpacity(0.3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: UserAvatar(
|
||||
user: widget.message.user!,
|
||||
constraints:
|
||||
BoxConstraints.tight(const Size(24, 24)),
|
||||
showOnlineStatus: false,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(2),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.white.withOpacity(0.6),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 8,
|
||||
color: chatThemeData
|
||||
.colorTheme.textHighEmphasis
|
||||
.withOpacity(0.3),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: UserAvatar(
|
||||
user: widget.message.user!,
|
||||
constraints:
|
||||
BoxConstraints.tight(const Size(24, 24)),
|
||||
showOnlineStatus: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -752,28 +752,31 @@ class MessageInputState extends State<MessageInput> {
|
||||
? Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
constraints: BoxConstraints.tight(const Size(64, 24)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: _streamChatTheme.colorTheme.accentPrimary,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
StreamSvgIcon.lightning(
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
Text(
|
||||
_chosenCommand?.name.toUpperCase() ?? '',
|
||||
style: _streamChatTheme.textTheme.footnoteBold.copyWith(
|
||||
child: Container(
|
||||
constraints: BoxConstraints.tight(const Size(64, 24)),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: _streamChatTheme.colorTheme.accentPrimary,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
StreamSvgIcon.lightning(
|
||||
color: Colors.white,
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
Text(
|
||||
_chosenCommand?.name.toUpperCase() ?? '',
|
||||
style:
|
||||
_streamChatTheme.textTheme.footnoteBold.copyWith(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -1024,8 +1027,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
_attachments.isNotEmpty)
|
||||
? null
|
||||
: () {
|
||||
pickFile(DefaultAttachmentTypes.image,
|
||||
camera: true);
|
||||
pickFile(
|
||||
DefaultAttachmentTypes.image,
|
||||
camera: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
@@ -1038,8 +1043,10 @@ class MessageInputState extends State<MessageInput> {
|
||||
_attachments.isNotEmpty)
|
||||
? null
|
||||
: () {
|
||||
pickFile(DefaultAttachmentTypes.video,
|
||||
camera: true);
|
||||
pickFile(
|
||||
DefaultAttachmentTypes.video,
|
||||
camera: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -1053,13 +1060,15 @@ class MessageInputState extends State<MessageInput> {
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: _streamChatTheme.colorTheme.inputBg,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: _streamChatTheme.colorTheme.inputBg,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -189,7 +189,7 @@ class QuotedMessageWidget extends StatelessWidget {
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: CachedNetworkImageProvider(
|
||||
attachment.imageUrl!,
|
||||
attachment.thumbUrl!,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: stream_chat_flutter_core_example
|
||||
description: Example app for testing stream_chat_flutter_core
|
||||
|
||||
# The following line prevents the package from being accidentally published to
|
||||
@@ -26,13 +26,7 @@ dependencies:
|
||||
cupertino_icons: ^1.0.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dependency_overrides:
|
||||
stream_chat:
|
||||
path: ../../stream_chat
|
||||
stream_chat_flutter_core:
|
||||
path: ../../stream_chat_flutter_core
|
||||
|
||||
stream_chat_flutter_core: ^2.2.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: stream_chat_localizations_example
|
||||
description: A new Flutter project.
|
||||
|
||||
publish_to: 'none'
|
||||
@@ -11,16 +11,8 @@ dependencies:
|
||||
cupertino_icons: ^1.0.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dependency_overrides:
|
||||
stream_chat:
|
||||
path: ../../stream_chat
|
||||
stream_chat_flutter:
|
||||
path: ../../stream_chat_flutter
|
||||
stream_chat_flutter_core:
|
||||
path: ../../stream_chat_flutter_core
|
||||
stream_chat_localizations:
|
||||
path: ../../stream_chat_localizations
|
||||
stream_chat_flutter: ^2.2.1
|
||||
stream_chat_localizations: ^1.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: example
|
||||
name: stream_chat_persistence_example
|
||||
description: A new Flutter project.
|
||||
|
||||
publish_to: 'none'
|
||||
@@ -11,12 +11,8 @@ dependencies:
|
||||
cupertino_icons: ^1.0.3
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dependency_overrides:
|
||||
stream_chat:
|
||||
path: ../../stream_chat
|
||||
stream_chat_persistence:
|
||||
path: ../../stream_chat_persistence
|
||||
stream_chat: ^2.2.1
|
||||
stream_chat_persistence: ^2.2.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user