prosapp_web_app has chat, dashboard, calendar, support, 13 providers and Fluro URL routing. Keep Dockerfile + nginx.conf from previous prosappweb. Upgrade google_fonts 6.2.1 → 8.1.0 (Dart 3.12 compat fix). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:prosapp_web_app/models/comment_entity.dart';
|
|
import 'package:prosapp_web_app/models/score_entity.dart';
|
|
import 'package:prosapp_web_app/repositories/firebase_score_repository.dart';
|
|
|
|
class ScoreProvider with ChangeNotifier {
|
|
final FirebaseScoreRepository _firebaseScoreRepository =
|
|
FirebaseScoreRepository();
|
|
|
|
ReputationEntity _reputation = const ReputationEntity(
|
|
total: 0,
|
|
average: 0,
|
|
totalPro: 0,
|
|
averagePro: 0,
|
|
);
|
|
ReputationEntity get reputation => _reputation;
|
|
|
|
List<CommentEntity> _comments = [];
|
|
List<CommentEntity> get comments => _comments;
|
|
|
|
// Método para cargar reputación dinámica según el ID
|
|
Future<void> loadReputation(String userId) async {
|
|
try {
|
|
final reputation =
|
|
await _firebaseScoreRepository.getReputationByUserId(userId);
|
|
_reputation = reputation;
|
|
notifyListeners();
|
|
} catch (e) {
|
|
debugPrint('Error loading reputation: $e');
|
|
}
|
|
}
|
|
|
|
// Método para cargar comentarios dinámicamente
|
|
void loadComments(String userId, {required bool isProfessional}) {
|
|
final commentStream = isProfessional
|
|
? _firebaseScoreRepository.getScoresForProfessional(userId)
|
|
: _firebaseScoreRepository.getScoresForUser(userId);
|
|
|
|
commentStream.listen((comments) {
|
|
_comments = comments;
|
|
notifyListeners();
|
|
});
|
|
}
|
|
|
|
Future<void> addComment(CommentEntity comment) async {
|
|
try {
|
|
await _firebaseScoreRepository.addComment(comment);
|
|
notifyListeners();
|
|
} catch (e) {
|
|
debugPrint('Error adding comment: $e');
|
|
}
|
|
}
|
|
}
|