refactor: remove offline indicator and streamline chat page logic

- Deleted the OfflineIndicator widget and its associated logic to simplify the codebase.
- Removed offline checks from the ChatPage, enhancing performance and reducing unnecessary rebuilds.
- Adjusted the ChatsDrawer to change icon size for better visual consistency.
- Cleaned up unused imports related to offline handling across multiple files.
This commit is contained in:
cogwheel0
2025-10-09 16:07:34 +05:30
parent c073d71363
commit 43c7e5200b
4 changed files with 2 additions and 288 deletions

View File

@@ -29,8 +29,6 @@ import 'package:path/path.dart' as path;
import '../../../shared/services/tasks/task_queue.dart';
import '../../tools/providers/tools_providers.dart';
import '../../navigation/widgets/chats_drawer.dart';
import '../../../shared/widgets/offline_indicator.dart';
import '../../../core/services/connectivity_service.dart';
import '../../../core/models/chat_message.dart';
import '../../../core/models/model.dart';
import '../../../shared/widgets/loading_states.dart';
@@ -334,13 +332,6 @@ class _ChatPageState extends ConsumerState<ChatPage> {
if (selectedModel == null) return;
}
final isOnline = ref.read(isOnlineProvider);
final isReviewerMode = ref.read(reviewerModeProvider);
if (!isOnline && !isReviewerMode) {
return;
}
try {
// Get attached files and collect uploaded file IDs (including data URLs for images)
final attachedFiles = ref.read(attachedFilesProvider);
@@ -1039,8 +1030,6 @@ class _ChatPageState extends ConsumerState<ChatPage> {
Widget build(BuildContext context) {
final theme = Theme.of(context);
final l10n = AppLocalizations.of(context)!;
// Use select to watch only connectivity status to reduce rebuilds
final isOnline = ref.watch(isOnlineProvider.select((status) => status));
// Use select to watch only the selected model to reduce rebuilds
final selectedModel = ref.watch(
selectedModelProvider.select((model) => model),
@@ -1537,9 +1526,6 @@ class _ChatPageState extends ConsumerState<ChatPage> {
// File attachments
const FileAttachmentWidget(),
// Offline indicator
const ChatOfflineOverlay(),
// Modern Input (root matches input background including safe area)
RepaintBoundary(
child: MeasureSize(
@@ -1551,8 +1537,6 @@ class _ChatPageState extends ConsumerState<ChatPage> {
}
},
child: ModernChatInput(
enabled:
(isOnline || ref.watch(reviewerModeProvider)),
onSendMessage: (text) =>
_handleMessageSend(text, selectedModel),
onVoiceInput: null,