feat(ui): support authenticated image loading with cache manager

Add Riverpod-aware image header and cache manager support for network
images used in avatar and markdown widgets. Convert AvatarImage to a
ConsumerWidget and read a self-signed cache manager and HTTP headers
from Riverpod so CachedNetworkImage can send auth/custom headers and use
the provided cache manager. In Markdown image builder, obtain headers
and cache manager from a ProviderContainer (via ProviderScope.containerOf)
to enable the same authenticated loading in non-consumer contexts.

Introduce image_header_utils.dart to centralize building Authorization
and custom headers from auth/api providers, with helpers for Ref,
WidgetRef, and ProviderContainer. Add dependency adjustments in
pubspec.lock for flutter_cache_manager and http marked as direct main.

These changes ensure protected images (self-signed or auth-required)
load correctly across the app and reuse the configured cache manager.
This commit is contained in:
cogwheel0
2025-10-23 17:36:31 +05:30
parent 060d9721af
commit 0df4b4f050
7 changed files with 149 additions and 40 deletions

View File

@@ -70,6 +70,8 @@ dependencies:
riverpod_annotation: ^3.0.0
flutter_local_notifications: ^19.4.2
connectivity_plus: ^7.0.0
flutter_cache_manager: ^3.4.1
http: ^1.5.0
# Clipboard functionality is available through flutter/services (part of Flutter SDK)