fecha
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
import 'package:firebase_auth/firebase_auth.dart';
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
|
||||||
import 'package:prosappco/src/components/photo_view.dart';
|
import 'package:prosappco/src/components/photo_view.dart';
|
||||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
import 'package:prosappco/src/models/score_model.dart';
|
import 'package:prosappco/src/models/score_model.dart';
|
||||||
import 'package:prosappco/src/screens/professional.dart';
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
|
import 'package:prosappco/src/screens/reputation.dart';
|
||||||
|
|
||||||
class ProfessionalInfoScreen extends StatefulWidget {
|
class ProfessionalInfoScreen extends StatefulWidget {
|
||||||
Professional professional;
|
Professional professional;
|
||||||
@@ -18,16 +18,9 @@ class ProfessionalInfoScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
||||||
late final FirebaseAuth _auth;
|
|
||||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
|
||||||
|
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
_auth = FirebaseAuth.instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> months = [
|
List<String> months = [
|
||||||
@@ -156,7 +149,16 @@ class _ProfessionalInfoScreenState extends State<ProfessionalInfoScreen> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () {},
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
CupertinoPageRoute(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return ReputationScreen(
|
||||||
|
professional: widget.professional);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
trailing: const Icon(Icons.keyboard_arrow_right,
|
trailing: const Icon(Icons.keyboard_arrow_right,
|
||||||
color: Colors.black),
|
color: Colors.black),
|
||||||
title: const Text(
|
title: const Text(
|
||||||
|
|||||||
@@ -0,0 +1,89 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
|
||||||
|
import 'package:prosappco/src/components/photo_view.dart';
|
||||||
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
|
import 'package:prosappco/src/models/score_model.dart';
|
||||||
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
|
|
||||||
|
class ReputationScreen extends StatelessWidget {
|
||||||
|
Professional professional;
|
||||||
|
|
||||||
|
ReputationScreen({super.key, required this.professional});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: PopAppbar(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
label: 'Reputación'),
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
..._scoresList(professional.puntuacion.details),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Widget> _scoresList(List<ScoreDetailsModel> list) {
|
||||||
|
return list.map((e) => _scoreItem(e)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _scoreItem(ScoreDetailsModel scoreDetails) {
|
||||||
|
return ListTile(
|
||||||
|
onTap: () {},
|
||||||
|
leading: ReferencePhoto(
|
||||||
|
ref: scoreDetails.avatar,
|
||||||
|
size: 50,
|
||||||
|
sizeCircle: 50,
|
||||||
|
sizeIcon: 35,
|
||||||
|
),
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
RatingBar.builder(
|
||||||
|
initialRating: scoreDetails.score,
|
||||||
|
minRating: 1,
|
||||||
|
direction: Axis.horizontal,
|
||||||
|
allowHalfRating: true,
|
||||||
|
itemCount: 5,
|
||||||
|
itemSize: 22,
|
||||||
|
maxRating: 5,
|
||||||
|
itemPadding: const EdgeInsets.symmetric(horizontal: 0),
|
||||||
|
itemBuilder: (context, _) => const Icon(
|
||||||
|
Icons.star,
|
||||||
|
color: Color(0xFF2BA4EC),
|
||||||
|
),
|
||||||
|
onRatingUpdate: (rating) {},
|
||||||
|
ignoreGestures: true,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
' (${scoreDetails.score})',
|
||||||
|
style: const TextStyle(color: Colors.black54, fontSize: 13),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
subtitle: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: '${scoreDetails.name}, ',
|
||||||
|
style: const TextStyle(fontSize: 15, color: Colors.black),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: '"${scoreDetails.comment}"',
|
||||||
|
style: const TextStyle(fontSize: 15, color: Colors.grey),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,8 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||||
import 'package:prosappco/src/components/drawer_menu.dart';
|
import 'package:prosappco/src/components/drawer_menu.dart';
|
||||||
import 'package:prosappco/src/components/primary_btn.dart';
|
|
||||||
import 'package:prosappco/src/screens/professional.dart';
|
import 'package:prosappco/src/screens/professional.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class ServiceScreen extends StatefulWidget {
|
class ServiceScreen extends StatefulWidget {
|
||||||
const ServiceScreen({super.key});
|
const ServiceScreen({super.key});
|
||||||
@@ -15,6 +15,25 @@ class ServiceScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ServiceScreenState extends State<ServiceScreen> {
|
class _ServiceScreenState extends State<ServiceScreen> {
|
||||||
|
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||||
|
|
||||||
|
DateTime? _selectedDate;
|
||||||
|
|
||||||
|
Future<void> _selectDate(BuildContext context) async {
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(2022),
|
||||||
|
lastDate: DateTime(2025),
|
||||||
|
);
|
||||||
|
|
||||||
|
if (picked != null && picked != _selectedDate) {
|
||||||
|
setState(() {
|
||||||
|
_selectedDate = picked;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final FirebaseStorage storage = FirebaseStorage.instance;
|
final FirebaseStorage storage = FirebaseStorage.instance;
|
||||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
var _ciudad = '';
|
var _ciudad = '';
|
||||||
@@ -199,20 +218,30 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
decoration: const InputDecoration(
|
onTap: () {
|
||||||
suffixIcon: Icon(Icons.arrow_drop_down),
|
_selectDate(context);
|
||||||
prefixIcon: Icon(Icons.calendar_month),
|
},
|
||||||
hintText: 'Fecha'),
|
readOnly: true,
|
||||||
)),
|
decoration: const InputDecoration(
|
||||||
|
prefixIcon: Icon(Icons.calendar_month),
|
||||||
|
hintText: 'Fecha',
|
||||||
|
),
|
||||||
|
controller: TextEditingController(
|
||||||
|
text: _selectedDate == null
|
||||||
|
? ''
|
||||||
|
: formatter.format(_selectedDate!)),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
suffixIcon: Icon(Icons.arrow_drop_down),
|
suffixIcon: Icon(Icons.arrow_drop_down),
|
||||||
hintText: 'Hora'),
|
hintText: 'Hora'),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
|
|||||||
Reference in New Issue
Block a user