update
This commit is contained in:
@@ -243,8 +243,7 @@ class ServiceBloc extends Bloc<ServiceEvent, ServiceState> {
|
||||
}
|
||||
final userIds = services.map((e) => e.userId);
|
||||
|
||||
final List<MyUser> users =
|
||||
await _userRepository.getUsersFromIds(userIds);
|
||||
final List<MyUser> users = await _userRepository.getUsersFromIds(userIds);
|
||||
|
||||
final usersDir = {for (var e in users) e.id: e};
|
||||
|
||||
|
||||
@@ -205,17 +205,12 @@ class GeneralDrawer extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
trailing: shouldProModeActive(
|
||||
context, professionalState)
|
||||
? FutureBuilder(
|
||||
builder: (context,
|
||||
AsyncSnapshot<int> snapshot) {
|
||||
if (!snapshot.hasData ||
|
||||
snapshot.data! < 1) {
|
||||
trailing: shouldProModeActive(context, professionalState)
|
||||
? FutureBuilder(builder: (context, AsyncSnapshot<int> snapshot) {
|
||||
if (!snapshot.hasData || snapshot.data! < 1) {
|
||||
return const SizedBox();
|
||||
}
|
||||
final int notificationCount =
|
||||
snapshot.data!;
|
||||
final int notificationCount = snapshot.data!;
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
@@ -223,14 +218,12 @@ class GeneralDrawer extends StatelessWidget {
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
notificationCount > 9
|
||||
? '+9'
|
||||
: notificationCount
|
||||
.toString(),
|
||||
: notificationCount.toString(),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
@@ -242,8 +235,7 @@ class GeneralDrawer extends StatelessWidget {
|
||||
future: Injector.appInstance
|
||||
.get<FirebaseServiceRepository>()
|
||||
.countPendingServicesForProfessional(
|
||||
FirebaseAuth
|
||||
.instance.currentUser!.uid),
|
||||
FirebaseAuth.instance.currentUser!.uid),
|
||||
)
|
||||
: const Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
@@ -251,8 +243,7 @@ class GeneralDrawer extends StatelessWidget {
|
||||
size: 25,
|
||||
),
|
||||
title: Text(
|
||||
shouldProModeActive(
|
||||
context, professionalState)
|
||||
shouldProModeActive(context, professionalState)
|
||||
? 'Solicitudes'
|
||||
: 'Solicitar servicio',
|
||||
style: const TextStyle(
|
||||
@@ -278,11 +269,8 @@ class GeneralDrawer extends StatelessWidget {
|
||||
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
final isProModeActive = (professionalState
|
||||
is LoadedModeProState) &&
|
||||
professionalState.isProModeActive;
|
||||
isProModeActive
|
||||
? Navigator.push(context,
|
||||
final isProModeActive = (professionalState is LoadedModeProState) && professionalState.isProModeActive;
|
||||
isProModeActive ? Navigator.push(context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) {
|
||||
return const ProfessionalScoreListScreen();
|
||||
@@ -390,17 +378,11 @@ class GeneralDrawer extends StatelessWidget {
|
||||
if (myUserState.status == MyUserStatus.success) {
|
||||
final user = myUserState.user!;
|
||||
|
||||
if (user.name != null &&
|
||||
user.email != null &&
|
||||
user.city != null &&
|
||||
user.phone != null) {
|
||||
if (user.name != null && user.email != null && user.city != null && user.phone != null) {
|
||||
switch (user.proState) {
|
||||
case ProState.active:
|
||||
Navigator.pop(context);
|
||||
case ProState.active: Navigator.pop(context);
|
||||
|
||||
context
|
||||
.read<ProfessionalBloc>()
|
||||
.add(const SwitchProModeEvent());
|
||||
context.read<ProfessionalBloc>().add(const SwitchProModeEvent());
|
||||
|
||||
break;
|
||||
case ProState.inactive:
|
||||
@@ -415,8 +397,7 @@ class GeneralDrawer extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfessionalPendingScreen(),
|
||||
builder: (context) => const ProfessionalPendingScreen(),
|
||||
),
|
||||
);
|
||||
break;
|
||||
@@ -424,8 +405,7 @@ class GeneralDrawer extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
CupertinoPageRoute(
|
||||
builder: (context) =>
|
||||
const ProfessionalDeniedScreen(),
|
||||
builder: (context) => const ProfessionalDeniedScreen(),
|
||||
),
|
||||
);
|
||||
break;
|
||||
|
||||
@@ -28,8 +28,7 @@ class _ProfessionalPendingServiceListScreenState
|
||||
|
||||
serviceBloc = Injector.appInstance.get<ServiceBloc>();
|
||||
|
||||
serviceBloc.add(LoadPendingServicesForProfessional(
|
||||
FirebaseAuth.instance.currentUser!.uid));
|
||||
serviceBloc.add(LoadPendingServicesForProfessional(FirebaseAuth.instance.currentUser!.uid));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -26,7 +26,8 @@ class _UserServiceListScreenState extends State<UserServiceListScreen> {
|
||||
|
||||
serviceBloc = Injector.appInstance.get<ServiceBloc>();
|
||||
|
||||
serviceBloc.add(LoadServicesForUser(FirebaseAuth.instance.currentUser!.uid));
|
||||
serviceBloc
|
||||
.add(LoadServicesForUser(FirebaseAuth.instance.currentUser!.uid));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -127,10 +128,12 @@ class _UserServiceListScreenState extends State<UserServiceListScreen> {
|
||||
customStatus(service),
|
||||
],
|
||||
),
|
||||
Text(
|
||||
'"${service.description.trim()}"',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
service.description.isEmpty
|
||||
? Container()
|
||||
: Text(
|
||||
'"${service.description.trim()}"',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,6 +46,12 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _startTimer() {
|
||||
_timer = Timer.periodic(const Duration(minutes: 5), (timer) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
void _loadSettings() {
|
||||
settingRepository.getSettings().then(
|
||||
(value) => setState(() {
|
||||
@@ -54,12 +60,6 @@ class _UserServiceScreenState extends State<UserServiceScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _startTimer() {
|
||||
_timer = Timer.periodic(const Duration(minutes: 5), (timer) {
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ServiceBloc>(
|
||||
|
||||
@@ -16,8 +16,7 @@ import 'package:user_repository/user_repository.dart';
|
||||
|
||||
class UserServiceScreen extends StatefulWidget {
|
||||
final String serviceId;
|
||||
const UserServiceScreen({Key? key, required this.serviceId})
|
||||
: super(key: key);
|
||||
const UserServiceScreen({super.key, required this.serviceId});
|
||||
|
||||
@override
|
||||
State<UserServiceScreen> createState() => _UserServiceScreenState();
|
||||
|
||||
@@ -5,7 +5,8 @@ class FirebaseServiceRepository {
|
||||
final serviceCollection = FirebaseFirestore.instance.collection('services');
|
||||
|
||||
Future<String> createService(ServiceEntity entity) async {
|
||||
DocumentReference<Map<String, dynamic>> docRef = await serviceCollection.add(entity.toDocument());
|
||||
DocumentReference<Map<String, dynamic>> docRef =
|
||||
await serviceCollection.add(entity.toDocument());
|
||||
return docRef.id;
|
||||
}
|
||||
|
||||
@@ -79,8 +80,7 @@ class FirebaseServiceRepository {
|
||||
.toList());
|
||||
}
|
||||
|
||||
Stream<List<ServiceEntity>> getPendingServicesForProfessional(
|
||||
String professionalId) {
|
||||
Stream<List<ServiceEntity>> getPendingServicesForProfessional(String professionalId) {
|
||||
return serviceCollection
|
||||
.where('professional_id', isEqualTo: professionalId)
|
||||
.where('status', whereIn: [0])
|
||||
|
||||
Reference in New Issue
Block a user