fix pov user y profesional
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:score_repository/score_repository.dart';
|
||||
|
||||
class GeneralReputation extends StatelessWidget {
|
||||
class GeneralReputation extends StatefulWidget {
|
||||
final String userId;
|
||||
final Widget Function(BuildContext, ReputationEntity) builder;
|
||||
|
||||
@@ -13,10 +13,24 @@ class GeneralReputation extends StatelessWidget {
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
State<GeneralReputation> createState() => _GeneralReputationState();
|
||||
}
|
||||
|
||||
class _GeneralReputationState extends State<GeneralReputation> {
|
||||
late Future<ReputationEntity> reputation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
final repository = Injector.appInstance.get<FirebaseScoreRepository>();
|
||||
reputation = repository.getReputationByUserId(widget.userId);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: repository.getReputationByUserId(userId),
|
||||
future: reputation,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
@@ -24,7 +38,7 @@ class GeneralReputation extends StatelessWidget {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
} else {
|
||||
final reputation = snapshot.data!;
|
||||
return builder(context, reputation);
|
||||
return widget.builder(context, reputation);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user