Fix code analysis issues: remove unused imports, debug prints, fix deprecated methods and naming conventions

This commit is contained in:
Jganenokk
2026-04-04 22:15:55 +07:00
parent 87f9d6aeb8
commit 491bb9c23e
10 changed files with 42 additions and 66 deletions
+1 -7
View File
@@ -32,12 +32,6 @@ class _CallsTabState extends State<CallsTab> {
final callsModule = CallsModule(api);
final calls = await callsModule.fetchHistory(p.id, p.id);
print('DEBUG UI: Received ${calls.length} calls');
for (final call in calls.take(3)) {
print('DEBUG UI: Call name="${call.name}", peerId=${call.peerId}');
}
// Группируем подряд идущие звонки одному и тому же абоненту в один день с одним и тем же статусом
final List<CallLogEntry> grouped = [];
for (final call in calls) {
if (grouped.isNotEmpty &&
@@ -169,7 +163,7 @@ class _CallsTabState extends State<CallsTab> {
? Image.network(
call.avatarUrl!,
fit: BoxFit.cover,
errorBuilder: (context, _, ___) =>
errorBuilder: (context, error, stackTrace) =>
_buildPlaceholderAvatar(cs, call.name),
)
: _buildPlaceholderAvatar(cs, call.name),
@@ -4,7 +4,6 @@ import 'package:material_symbols_icons/symbols.dart';
import 'dart:math';
import 'dart:ui' as ui;
import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'chat_screen.dart';
import '../calls/calls_tab.dart';
@@ -25,8 +24,8 @@ class _StoriesScrollPhysics extends BouncingScrollPhysics {
const _StoriesScrollPhysics({
required this.blockPositive,
required this.allowPullOverscrollTop,
ScrollPhysics? parent,
}) : super(parent: parent);
super.parent,
});
@override
_StoriesScrollPhysics applyTo(ScrollPhysics? ancestor) {
@@ -382,10 +381,10 @@ class _ChatListScreenState extends State<ChatListScreen>
return _folderChatScrollControllers.first;
}
final p = _folderPageController.page;
final i = (p != null
? p.round()
: _selectedFolderIndex)
.clamp(0, _folderChatScrollControllers.length - 1);
final i = (p != null ? p.round() : _selectedFolderIndex).clamp(
0,
_folderChatScrollControllers.length - 1,
);
return _folderChatScrollControllers[i];
}
@@ -795,10 +794,10 @@ class _ChatListScreenState extends State<ChatListScreen>
vertical: 8,
),
decoration: BoxDecoration(
color: cs.errorContainer.withOpacity(0.3),
color: cs.errorContainer.withValues(alpha: 0.3),
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: cs.error.withOpacity(0.2),
color: cs.error.withValues(alpha: 0.2),
),
),
child: Row(
@@ -933,27 +932,24 @@ class _ChatListScreenState extends State<ChatListScreen>
),
slivers: [
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
if (_isInitialLoading) {
return _buildChatShimmer();
}
final chat = chats[index];
return _buildChatItem(
chat.id.toString(),
chat.title ?? 'Чат',
chat.lastMsgText ?? '',
_formatTime(chat.lastMsgTime),
(chat.iconUrl != null && chat.iconUrl!.isNotEmpty)
? chat.iconUrl!
: '',
isOnline: chat.isOnline,
unreadCount: chat.unreadCount,
isMuted: chat.dontDisturbUntil > 0,
);
},
childCount: _isInitialLoading ? 10 : chats.length,
),
delegate: SliverChildBuilderDelegate((context, index) {
if (_isInitialLoading) {
return _buildChatShimmer();
}
final chat = chats[index];
return _buildChatItem(
chat.id.toString(),
chat.title ?? 'Чат',
chat.lastMsgText ?? '',
_formatTime(chat.lastMsgTime),
(chat.iconUrl != null && chat.iconUrl!.isNotEmpty)
? chat.iconUrl!
: '',
isOnline: chat.isOnline,
unreadCount: chat.unreadCount,
isMuted: chat.dontDisturbUntil > 0,
);
}, childCount: _isInitialLoading ? 10 : chats.length),
),
SliverPadding(
padding: EdgeInsets.only(
@@ -1371,7 +1367,7 @@ class _ChatListScreenState extends State<ChatListScreen>
color: cs.surface,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.1),
color: Colors.black.withValues(alpha: 0.1),
blurRadius: 10,
offset: const Offset(0, 2),
),
@@ -1575,7 +1571,9 @@ class _ChatListScreenState extends State<ChatListScreen>
onLongPress: () => _toggleSelection(id),
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
color: isSelected ? cs.primary.withOpacity(0.08) : Colors.transparent,
color: isSelected
? cs.primary.withValues(alpha: 0.08)
: Colors.transparent,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
child: Row(
@@ -87,7 +87,7 @@ class _ContactsTabState extends State<ContactsTab> {
? Image.network(
contact.baseUrl!,
fit: BoxFit.cover,
errorBuilder: (context, _, ___) =>
errorBuilder: (context, error, stackTrace) =>
_buildPlaceholderAvatar(cs, nameToDisplay),
)
: _buildPlaceholderAvatar(cs, nameToDisplay),
@@ -151,7 +151,7 @@ class _SettingsTabState extends State<SettingsTab> {
? Image.network(
_profile!.baseUrl!,
fit: BoxFit.cover,
errorBuilder: (context, _, __) =>
errorBuilder: (context, error, stackTrace) =>
_buildPlaceholderAvatar(cs, name),
)
: _buildPlaceholderAvatar(cs, name),