fix pov user y profesional
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:score_repository/score_repository.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
part 'score_event.dart';
|
||||
part 'score_state.dart';
|
||||
@@ -17,14 +17,14 @@ class ScoreBloc extends Bloc<ScoreEvent, ScoreState> {
|
||||
try {
|
||||
emit(ScoreSuccess(_firebaseScoreRepository.getReputation()));
|
||||
} catch (e) {
|
||||
log("siteriespierdes1" + e.toString());
|
||||
log(e.toString());
|
||||
}
|
||||
_firebaseScoreRepository.streamReputation().listen((event) {
|
||||
try {
|
||||
emit(ScoreSuccess(event));
|
||||
} catch (e) {
|
||||
// log
|
||||
log("siteriespierdes2" + e.toString());
|
||||
log(e.toString());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ class ScoreBloc extends Bloc<ScoreEvent, ScoreState> {
|
||||
try {
|
||||
await _firebaseScoreRepository.addComment(event.comment);
|
||||
} catch (e) {
|
||||
log("siteriespierdes3" + e.toString());
|
||||
log(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,36 +228,37 @@ class GeneralDrawer extends StatelessWidget {
|
||||
: reputation.average;
|
||||
|
||||
return ListTile(
|
||||
onTap: () {},
|
||||
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||
color: Colors.black),
|
||||
title: const Text(
|
||||
'Reputación',
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
RatingBar.builder(
|
||||
initialRating: calculoRating(average),
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
itemSize: 25,
|
||||
maxRating: 5,
|
||||
itemBuilder: (context, _) => const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
onRatingUpdate: (rating) {},
|
||||
ignoreGestures: true,
|
||||
onTap: () {},
|
||||
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||
color: Colors.black),
|
||||
title: const Text(
|
||||
'Reputación',
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
RatingBar.builder(
|
||||
initialRating: calculoRating(average),
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
itemSize: 25,
|
||||
maxRating: 5,
|
||||
itemBuilder: (context, _) => const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${average.toStringAsFixed(1)} (${total.toString()})',
|
||||
),
|
||||
],
|
||||
));
|
||||
onRatingUpdate: (rating) {},
|
||||
ignoreGestures: true,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${average.toStringAsFixed(1)} (${total.toString()})',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:prosappco/blocs/chat_bloc/chat_bloc.dart';
|
||||
import 'package:prosappco/components/general_reputation.dart';
|
||||
import 'package:prosappco/screens/user/user_view_profile_screen.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
@@ -59,7 +61,8 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: _getUserAndProfessionalInfo(widget.service),
|
||||
builder: (BuildContext context, AsyncSnapshot<List<dynamic>> snapshot) {
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<dynamic>> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else {
|
||||
@@ -105,15 +108,73 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
subtitle: const Text(
|
||||
'Rating: 5.0',
|
||||
// _disponibilidad(
|
||||
// filteredUsers[index].professionalInfo),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
subtitle: widget.service.userId ==
|
||||
FirebaseAuth.instance.currentUser!.uid
|
||||
? GeneralReputation(
|
||||
userId: widget.service.professionalId,
|
||||
builder: (context, reputation) {
|
||||
final average = reputation.averagePro;
|
||||
final total = reputation.totalPro;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
RatingBar.builder(
|
||||
initialRating:
|
||||
calculoRating(average),
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
itemSize: 25,
|
||||
maxRating: 5,
|
||||
itemBuilder: (context, _) =>
|
||||
const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
onRatingUpdate: (rating) {},
|
||||
ignoreGestures: true,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${average.toStringAsFixed(1)} (${total.toString()})',
|
||||
),
|
||||
],
|
||||
);
|
||||
})
|
||||
: GeneralReputation(
|
||||
userId: widget.service.userId,
|
||||
builder: (context, reputation) {
|
||||
final average = reputation.average;
|
||||
final total = reputation.total;
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
RatingBar.builder(
|
||||
initialRating:
|
||||
calculoRating(average),
|
||||
minRating: 1,
|
||||
direction: Axis.horizontal,
|
||||
allowHalfRating: true,
|
||||
itemCount: 5,
|
||||
itemSize: 25,
|
||||
maxRating: 5,
|
||||
itemBuilder: (context, _) =>
|
||||
const Icon(
|
||||
Icons.star,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
onRatingUpdate: (rating) {},
|
||||
ignoreGestures: true,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${average.toStringAsFixed(1)} (${total.toString()})',
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -318,11 +379,28 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
final MyUser? userInfo;
|
||||
|
||||
if (FirebaseAuth.instance.currentUser!.uid == service.userId) {
|
||||
userInfo = await userRepo.getMyUser(service.userId);
|
||||
} else {
|
||||
userInfo = await userRepo.getMyUser(service.professionalId);
|
||||
} else {
|
||||
userInfo = await userRepo.getMyUser(service.userId);
|
||||
}
|
||||
|
||||
return [userInfo];
|
||||
}
|
||||
|
||||
double calculoRating(double average) {
|
||||
String numeroString = average.toString();
|
||||
List<String> partes = numeroString.split('.');
|
||||
int parteEntera = int.parse(partes[0]);
|
||||
int parteFraccionaria = partes.length > 1 ? int.parse(partes[1]) : 0;
|
||||
|
||||
if (parteFraccionaria >= 3) {
|
||||
parteFraccionaria = 5;
|
||||
} else {
|
||||
parteFraccionaria = 0;
|
||||
}
|
||||
|
||||
// Unir la parte entera y fraccionaria y convertirlo nuevamente a double
|
||||
double resultado = double.parse('$parteEntera.$parteFraccionaria');
|
||||
return resultado;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:prosappco/blocs/score_bloc/score_bloc.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/components/general_reputation.dart';
|
||||
import 'package:score_repository/score_repository.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
@@ -24,11 +25,20 @@ class _ScoreScreenState extends State<ScoreScreen> {
|
||||
double _rating = 1.0;
|
||||
TextEditingController commentController = TextEditingController();
|
||||
late Future<List<dynamic>> _userInfoFuture;
|
||||
late bool isProfessional;
|
||||
late String userId;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_userInfoFuture = _getUserAndProfessionalInfo(widget.service);
|
||||
isProfessional =
|
||||
FirebaseAuth.instance.currentUser!.uid == widget.service.userId
|
||||
? true
|
||||
: false;
|
||||
|
||||
userId =
|
||||
isProfessional ? widget.service.professionalId : widget.service.userId;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -56,48 +66,155 @@ class _ScoreScreenState extends State<ScoreScreen> {
|
||||
} else {
|
||||
final userInfo = snapshot.data![0] as MyUser;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: ListTile(
|
||||
leading: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture ?? ''),
|
||||
fit: BoxFit.contain,
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture!),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 50,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${userInfo.name}',
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
)
|
||||
],
|
||||
),
|
||||
GeneralReputation(
|
||||
userId: userId,
|
||||
builder: (BuildContext context,
|
||||
ReputationEntity reputation) {
|
||||
final double average;
|
||||
|
||||
if (isProfessional) {
|
||||
average = reputation.averagePro;
|
||||
} else {
|
||||
average = reputation.average;
|
||||
}
|
||||
|
||||
return Positioned(
|
||||
top: 3,
|
||||
right: MediaQuery.of(context).size.width *
|
||||
0.3,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 3,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Text(
|
||||
userInfo.name ?? '',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
subtitle: const Text(
|
||||
'Rating: 5.0',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius:
|
||||
BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color:
|
||||
Colors.black.withOpacity(0.1),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 2,
|
||||
offset: const Offset(
|
||||
0,
|
||||
1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.star,
|
||||
color: Colors.yellow,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
average.toStringAsFixed(2),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
// child: ListTile(
|
||||
// leading: Container(
|
||||
// width: 60,
|
||||
// height: 60,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.grey.shade300,
|
||||
// shape: BoxShape.circle,
|
||||
// image: userInfo.picture == null
|
||||
// ? null
|
||||
// : DecorationImage(
|
||||
// image: NetworkImage(
|
||||
// userInfo.picture ?? ''),
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
// ),
|
||||
// child: userInfo.picture == null
|
||||
// ? Icon(
|
||||
// CupertinoIcons.person,
|
||||
// color: Colors.grey.shade400,
|
||||
// size: 40,
|
||||
// )
|
||||
// : null,
|
||||
// ),
|
||||
// title: Text(
|
||||
// userInfo.name ?? '',
|
||||
// overflow: TextOverflow.ellipsis,
|
||||
// style: const TextStyle(
|
||||
// fontSize: 15,
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// ),
|
||||
// subtitle: const Text(
|
||||
// 'Rating: 5.0',
|
||||
// style: TextStyle(
|
||||
// fontSize: 13,
|
||||
// color: Colors.blue,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -129,6 +246,16 @@ class _ScoreScreenState extends State<ScoreScreen> {
|
||||
},
|
||||
ignoreGestures: false,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
customMessage(_rating),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40, vertical: 40),
|
||||
@@ -226,6 +353,26 @@ class _ScoreScreenState extends State<ScoreScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
String customMessage(double rating) {
|
||||
if (rating > 4.0) {
|
||||
return '¡Excelente! 👏🌟';
|
||||
}
|
||||
|
||||
if (rating < 2.0) {
|
||||
return '¡Malo! 😔❌';
|
||||
}
|
||||
|
||||
if (rating <= 4.0 && rating >= 3.0) {
|
||||
return '¡Bueno! 👍😊';
|
||||
}
|
||||
|
||||
if (rating < 3.0 && rating >= 2.0) {
|
||||
return '¡Regular! 😐🔄';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
Future<List<dynamic>> _getUserAndProfessionalInfo(
|
||||
ServiceEntity service) async {
|
||||
final userRepo = FirebaseUserRepository(FirebaseAuth.instance);
|
||||
@@ -233,9 +380,9 @@ class _ScoreScreenState extends State<ScoreScreen> {
|
||||
final MyUser? userInfo;
|
||||
|
||||
if (FirebaseAuth.instance.currentUser!.uid == service.userId) {
|
||||
userInfo = await userRepo.getMyUser(service.userId);
|
||||
} else {
|
||||
userInfo = await userRepo.getMyUser(service.professionalId);
|
||||
} else {
|
||||
userInfo = await userRepo.getMyUser(service.userId);
|
||||
}
|
||||
|
||||
return [userInfo];
|
||||
|
||||
@@ -7,9 +7,11 @@ import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/components/general_reputation.dart';
|
||||
import 'package:prosappco/components/general_secondary_button.dart';
|
||||
import 'package:prosappco/screens/chat/chat_screen.dart';
|
||||
import 'package:prosappco/screens/score/score_screen.dart';
|
||||
import 'package:score_repository/score_repository.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -75,49 +77,126 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture!,
|
||||
),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${userInfo.name}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture!),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color:
|
||||
Colors.grey.shade400,
|
||||
size: 50,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${userInfo.name}',
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${DateFormat('dd MMMM', 'es').format(DateTime.parse(service.day))} - ${ScheduleEntity.getFormatTime(service.range1Hour1)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${DateFormat('dd MMMM', 'es').format(DateTime.parse(service.day))} - ${ScheduleEntity.getFormatTime(service.range1Hour1)}',
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
GeneralReputation(
|
||||
userId: service.userId,
|
||||
builder: (BuildContext context,
|
||||
ReputationEntity reputation) {
|
||||
final average = reputation.average;
|
||||
|
||||
return Positioned(
|
||||
top: 3,
|
||||
right: MediaQuery.of(context)
|
||||
.size
|
||||
.width *
|
||||
0.3,
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius:
|
||||
BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black
|
||||
.withOpacity(0.1),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 2,
|
||||
offset: const Offset(
|
||||
0,
|
||||
1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.star,
|
||||
color: Colors.yellow,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
average
|
||||
.toStringAsFixed(2),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: const Text('Rating: 5.0'),
|
||||
),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
@@ -376,19 +455,19 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 20,
|
||||
vertical: 15,
|
||||
horizontal: 0,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.near_me,
|
||||
size: 30,
|
||||
size: 25,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
width: 230,
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -7,9 +7,12 @@ import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/service_bloc/service_bloc.dart';
|
||||
import 'package:prosappco/components/drawer_reputation.dart';
|
||||
import 'package:prosappco/components/general_reputation.dart';
|
||||
import 'package:prosappco/screens/chat/chat_screen.dart';
|
||||
import 'package:prosappco/components/general_secondary_button.dart';
|
||||
import 'package:prosappco/screens/score/score_screen.dart';
|
||||
import 'package:score_repository/score_repository.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -76,50 +79,174 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture!,
|
||||
),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color: Colors.grey.shade400,
|
||||
size: 40,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
title: Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${userInfo.name}',
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 95,
|
||||
height: 95,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey.shade300,
|
||||
shape: BoxShape.circle,
|
||||
image: userInfo.picture == null
|
||||
? null
|
||||
: DecorationImage(
|
||||
image: NetworkImage(
|
||||
userInfo.picture!),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
child: userInfo.picture == null
|
||||
? Icon(
|
||||
CupertinoIcons.person,
|
||||
color:
|
||||
Colors.grey.shade400,
|
||||
size: 50,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'${userInfo.name}',
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Row(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${DateFormat('dd MMMM', 'es').format(DateTime.parse(service.day))} - ${ScheduleEntity.getFormatTime(service.range1Hour1)}',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Text(
|
||||
'${DateFormat('dd MMMM', 'es').format(DateTime.parse(service.day))} - ${ScheduleEntity.getFormatTime(service.range1Hour1)}',
|
||||
style: TextStyle(
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
GeneralReputation(
|
||||
userId: service.professionalId,
|
||||
builder: (BuildContext context,
|
||||
ReputationEntity reputation) {
|
||||
final average =
|
||||
reputation.averagePro;
|
||||
|
||||
return Positioned(
|
||||
top: 3,
|
||||
right: MediaQuery.of(context)
|
||||
.size
|
||||
.width *
|
||||
0.3,
|
||||
child: Container(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 10,
|
||||
vertical: 3,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius:
|
||||
BorderRadius.circular(20),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black
|
||||
.withOpacity(0.1),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 2,
|
||||
offset: const Offset(
|
||||
0,
|
||||
1,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.star,
|
||||
color: Colors.yellow,
|
||||
size: 20,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
average
|
||||
.toStringAsFixed(2),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: const Text('Rating: 5.0'),
|
||||
),
|
||||
|
||||
// ListTile(
|
||||
// leading: Container(
|
||||
// width: 60,
|
||||
// height: 60,
|
||||
// decoration: BoxDecoration(
|
||||
// color: Colors.grey.shade300,
|
||||
// shape: BoxShape.circle,
|
||||
// image: userInfo.picture == null
|
||||
// ? null
|
||||
// : DecorationImage(
|
||||
// image: NetworkImage(
|
||||
// userInfo.picture!,
|
||||
// ),
|
||||
// fit: BoxFit.contain,
|
||||
// ),
|
||||
// ),
|
||||
// child: userInfo.picture == null
|
||||
// ? Icon(
|
||||
// CupertinoIcons.person,
|
||||
// color: Colors.grey.shade400,
|
||||
// size: 40,
|
||||
// )
|
||||
// : null,
|
||||
// ),
|
||||
// title: Row(
|
||||
// crossAxisAlignment:
|
||||
// CrossAxisAlignment.start,
|
||||
// children: [
|
||||
// Text(
|
||||
// '${userInfo.name}',
|
||||
// style: const TextStyle(
|
||||
// fontWeight: FontWeight.bold),
|
||||
// ),
|
||||
// const SizedBox(width: 5),
|
||||
// Text(
|
||||
// '${DateFormat('dd MMMM', 'es').format(DateTime.parse(service.day))} - ${ScheduleEntity.getFormatTime(service.range1Hour1)}',
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[600],
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// subtitle: const Text('Rating: 5.0'),
|
||||
// ),
|
||||
|
||||
Container(
|
||||
margin: const EdgeInsets.only(
|
||||
left: 40,
|
||||
@@ -345,19 +472,19 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 20,
|
||||
vertical: 15,
|
||||
horizontal: 0,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.near_me,
|
||||
size: 30,
|
||||
size: 25,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
SizedBox(
|
||||
width: 230,
|
||||
width: MediaQuery.of(context).size.width * 0.6,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -53,7 +53,7 @@ class FirebaseScoreRepository {
|
||||
final snap = await reputationsCollection.doc(userId).get();
|
||||
return ReputationEntity.fromDocument(snap.data()!);
|
||||
} catch (e) {
|
||||
log("siteriespierdes4" + e.toString());
|
||||
log(e.toString());
|
||||
return const ReputationEntity(
|
||||
total: 0,
|
||||
average: 0,
|
||||
|
||||
Reference in New Issue
Block a user