From babaa97c6297d62bb262907b147ab56fc383aa32 Mon Sep 17 00:00:00 2001 From: cogwheel0 <172976095+cogwheel0@users.noreply.github.com> Date: Sun, 23 Nov 2025 21:18:19 +0530 Subject: [PATCH] refactor(providers): Remove unused import and update dependencies --- ios/Podfile.lock | 19 ++++---- .../enhanced_accessibility_service.dart | 43 +++++++++++++++++-- .../tools/providers/tools_providers.dart | 1 - .../widgets/improved_loading_states.dart | 7 ++- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d56263b..145cd31 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -49,6 +49,8 @@ PODS: - Flutter - image_picker_ios (0.0.1): - Flutter + - objective_c (0.0.1): + - Flutter - onnxruntime-c (1.22.0) - onnxruntime-objc (1.22.0): - onnxruntime-objc/Core (= 1.22.0) @@ -56,9 +58,6 @@ PODS: - onnxruntime-c (= 1.22.0) - package_info_plus (0.4.5): - Flutter - - path_provider_foundation (0.0.1): - - Flutter - - FlutterMacOS - record_ios (1.1.0): - Flutter - SDWebImage (5.21.1): @@ -104,8 +103,8 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - flutter_tts (from `.symlinks/plugins/flutter_tts/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + - objective_c (from `.symlinks/plugins/objective_c/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - record_ios (from `.symlinks/plugins/record_ios/ios`) - share_handler_ios (from `.symlinks/plugins/share_handler_ios/ios`) - share_handler_ios_models (from `.symlinks/plugins/share_handler_ios/ios/Models`) @@ -146,10 +145,10 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_tts/ios" image_picker_ios: :path: ".symlinks/plugins/image_picker_ios/ios" + objective_c: + :path: ".symlinks/plugins/objective_c/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" - path_provider_foundation: - :path: ".symlinks/plugins/path_provider_foundation/darwin" record_ios: :path: ".symlinks/plugins/record_ios/ios" share_handler_ios: @@ -184,21 +183,21 @@ SPEC CHECKSUMS: flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13 flutter_tts: b88dbc8655d3dc961bc4a796e4e16a4cc1795833 - image_picker_ios: 7fe1ff8e34c1790d6fff70a32484959f563a928a + image_picker_ios: e0ece4aa2a75771a7de3fa735d26d90817041326 + objective_c: 89e720c30d716b036faf9c9684022048eee1eee2 onnxruntime-c: 7f778680e96145956c0a31945f260321eed2611a onnxruntime-objc: 83d28b87525bd971259a66e153ea32b5d023de19 package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499 - path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 record_ios: f75fa1d57f840012775c0e93a38a7f3ceea1a374 SDWebImage: f29024626962457f3470184232766516dee8dfea share_handler_ios: e2244e990f826b2c8eaa291ac3831569438ba0fb share_handler_ios_models: fc638c9b4330dc7f082586c92aee9dfa0b87b871 share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a - shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7 + shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 stts: 1a48df645bb516e86e4121d5253b582749a1d3a6 SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 - url_launcher_ios: 694010445543906933d732453a59da0a173ae33d + url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b vad: 7934867589afe53567f492df66fb1615f2185822 wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556 webview_flutter_wkwebview: 8ebf4fded22593026f7dbff1fbff31ea98573c8d diff --git a/lib/core/services/enhanced_accessibility_service.dart b/lib/core/services/enhanced_accessibility_service.dart index 950706f..fa7bf70 100644 --- a/lib/core/services/enhanced_accessibility_service.dart +++ b/lib/core/services/enhanced_accessibility_service.dart @@ -1,4 +1,5 @@ import 'dart:math' as math; +import 'dart:ui' show FlutterView; import 'package:conduit/l10n/app_localizations.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -15,12 +16,46 @@ class EnhancedAccessibilityService { return AppLocalizations.of(ctx); } + static FlutterView? _resolveView(BuildContext? context) { + if (context != null) { + try { + final view = View.maybeOf(context); + if (view != null) { + return view; + } + } catch (_) {} + } + return WidgetsBinding.instance.platformDispatcher.implicitView; + } + + static TextDirection _resolveTextDirection( + BuildContext? context, + TextDirection? override, + ) { + if (override != null) { + return override; + } + if (context != null) { + final direction = Directionality.maybeOf(context); + if (direction != null) { + return direction; + } + } + return TextDirection.ltr; + } + /// Announce text to screen readers - static void announce( + static Future announce( String message, { - TextDirection textDirection = TextDirection.ltr, - }) { - SemanticsService.announce(message, textDirection); + BuildContext? context, + TextDirection? textDirection, + }) async { + final resolvedContext = context ?? NavigationService.context; + final view = _resolveView(resolvedContext); + if (view == null) return; + + final direction = _resolveTextDirection(resolvedContext, textDirection); + await SemanticsService.sendAnnouncement(view, message, direction); } /// Announce loading state diff --git a/lib/features/tools/providers/tools_providers.dart b/lib/features/tools/providers/tools_providers.dart index 041df95..435c0f2 100644 --- a/lib/features/tools/providers/tools_providers.dart +++ b/lib/features/tools/providers/tools_providers.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:conduit/core/models/tool.dart'; diff --git a/lib/shared/widgets/improved_loading_states.dart b/lib/shared/widgets/improved_loading_states.dart index c0c52df..7523f57 100644 --- a/lib/shared/widgets/improved_loading_states.dart +++ b/lib/shared/widgets/improved_loading_states.dart @@ -57,7 +57,12 @@ class _ImprovedLoadingStateState extends State final l10n = AppLocalizations.of(context); final announcement = widget.message ?? l10n?.loadingContent ?? 'Loading'; final direction = Directionality.maybeOf(context) ?? TextDirection.ltr; - SemanticsService.announce(announcement, direction); + final view = + View.maybeOf(context) ?? + WidgetsBinding.instance.platformDispatcher.implicitView; + if (view != null) { + SemanticsService.sendAnnouncement(view, announcement, direction); + } }); }