refactor: migrate to flutter_math_fork and markdown_widget for enhanced markdown capabilities

- Replaced flutter_markdown_plus with flutter_math_fork to improve mathematical rendering within markdown content.
- Integrated markdown_widget for better markdown processing and rendering, enhancing overall user experience.
- Updated the markdown configuration to utilize the new packages, ensuring maintainability and adaptability of markdown features.
- Refactored the streaming markdown widget to accommodate the new markdown processing logic, improving code clarity and performance.
This commit is contained in:
cogwheel0
2025-10-04 13:37:47 +05:30
parent 399b44bc74
commit e04b43949b
9 changed files with 434 additions and 131 deletions

View File

@@ -2,6 +2,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/auth/auth_state_manager.dart';
import '../../../core/models/user.dart';
import '../../../core/providers/app_providers.dart';
import '../../../core/services/api_service.dart';
/// Unified auth providers using the new auth state manager
/// These replace the old auth providers for better efficiency
@@ -107,11 +108,24 @@ final authStatusProvider = Provider<AuthStatus>((ref) {
/// Provider to watch for auth state changes and update API service
final authApiIntegrationProvider = Provider<void>((ref) {
ref.listen(authTokenProvider3, (previous, next) {
final api = ref.read(apiServiceProvider);
if (api != null && next != null && next.isNotEmpty) {
api.updateAuthToken(next);
void syncToken(ApiService? api, String? token) {
if (api == null) return;
if (token == null || token.isEmpty) {
api.updateAuthToken(null);
return;
}
api.updateAuthToken(token);
}
// Ensure the current ApiService instance immediately picks up the cached token.
syncToken(ref.read(apiServiceProvider), ref.read(authTokenProvider3));
ref.listen<ApiService?>(apiServiceProvider, (previous, next) {
syncToken(next, ref.read(authTokenProvider3));
});
ref.listen<String?>(authTokenProvider3, (previous, next) {
syncToken(ref.read(apiServiceProvider), next);
});
});