puntacion

This commit is contained in:
Felipe
2024-04-17 00:48:46 -05:00
parent 61d517aaea
commit 141d11a141
20 changed files with 1078 additions and 77 deletions
@@ -9,6 +9,7 @@ import 'package:professional_repository/professional_repository.dart';
import 'package:prosappco/blocs/service_bloc/service_bloc.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:service_repository/service_repository.dart';
import 'package:setting_repository/setting_repository.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -56,7 +57,8 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
final service = state.service;
return FutureBuilder(
future: _getUserAndProfessionalInfo(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 {
@@ -515,73 +517,91 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
);
}
// if (service.status == ServiceStatus.active) {
// return Stack(
// alignment: AlignmentDirectional.topCenter,
// clipBehavior: Clip.none,
// children: [
// Card(
// color: Colors.green.shade50,
// child: const Padding(
// padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
// child: Text(
// 'En proceso...',
// style: TextStyle(fontSize: 32, color: Colors.green),
// ),
// ),
// ),
// Positioned(
// top: -40,
// child: Container(
// padding: const EdgeInsets.all(16),
// decoration: BoxDecoration(
// color: Colors.white,
// border: Border.all(color: Colors.green.shade50, width: 4),
// shape: BoxShape.circle,
// ),
// child: const Icon(
// Icons.access_time_rounded,
// color: Colors.green,
// size: 48,
// ),
// ),
// )
// ],
// );
// }
if (service.status == ServiceStatus.completed) {
return Stack(
alignment: AlignmentDirectional.topCenter,
clipBehavior: Clip.none,
children: [
Card(
color: Colors.green.shade50,
child: const Padding(
padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
child: Text(
'Completado',
style: TextStyle(fontSize: 32, color: Colors.green),
if (service.userScored) {
return Stack(
alignment: AlignmentDirectional.topCenter,
clipBehavior: Clip.none,
children: [
Card(
color: Colors.green.shade50,
child: const Padding(
padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
child: Text(
'Completado',
style: TextStyle(fontSize: 32, color: Colors.green),
),
),
),
),
Positioned(
top: -40,
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.green.shade50, width: 4),
shape: BoxShape.circle,
Positioned(
top: -40,
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.green.shade50, width: 4),
shape: BoxShape.circle,
),
child: const Icon(
Icons.check_rounded,
color: Colors.green,
size: 48,
),
),
child: const Icon(
Icons.check_rounded,
color: Colors.green,
size: 48,
)
],
);
} else {
return Stack(
alignment: AlignmentDirectional.topCenter,
clipBehavior: Clip.none,
children: [
Card(
color: Colors.green.shade50,
child: Padding(
padding: EdgeInsets.fromLTRB(32, 56, 32, 32),
child: Column(
children: [
Text(
'Completado',
style: TextStyle(fontSize: 32, color: Colors.green),
),
SizedBox(height: 16),
FilledButton(
onPressed: () {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => ScoreScreen(
service: service,
),
),
);
},
child: Text('Calificar'))
],
),
),
),
)
],
);
Positioned(
top: -40,
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.green.shade50, width: 4),
shape: BoxShape.circle,
),
child: const Icon(
Icons.star,
color: Colors.green,
size: 48,
),
),
)
],
);
}
}
return const SizedBox();
@@ -627,16 +647,6 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
}
},
);
// customStatusButton(
// label: 'Iniciar servicio',
// onPressed: () {
// final currentState = context.read<ServiceBloc>().state;
// if (currentState is ServiceLoaded) {
// context.read<ServiceBloc>().add(
// UpdateServiceStatus(widget.serviceId, ServiceStatus.active));
// }
// },
// );
}
if (service.status == ServiceStatus.active) {
@@ -670,7 +680,8 @@ class _ProfessionalServiceScreenState extends State<ProfessionalServiceScreen> {
return '\$${formatter.format(number)}';
}
Future<List<dynamic>> _getUserAndProfessionalInfo(ServiceEntity service) async {
Future<List<dynamic>> _getUserAndProfessionalInfo(
ServiceEntity service) async {
final userRepo = FirebaseUserRepository(FirebaseAuth.instance);
final userInfo = await userRepo.getMyUser(service.userId);