vistas de ciudadano, escalar animaciones de mascota, implementacion de chatbot para concientizacion, modificacion de datos de ciudadano, modificacion de vista principal

This commit is contained in:
shinra32
2026-05-23 05:03:05 -06:00
parent 89dcc6250b
commit ca076607c7
39 changed files with 2909 additions and 560 deletions

View File

@@ -0,0 +1,38 @@
import 'package:dio/dio.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../../core/network/api_client.dart';
import '../models/profile_user.dart';
final profileServiceProvider = Provider<ProfileService>((ref) {
return ProfileService(ref.read(apiClientProvider));
});
class ProfileService {
ProfileService(this._dio);
final Dio _dio;
Future<ProfileUser> getMe() async {
final res = await _dio.get<Map<String, dynamic>>('/users/me');
return ProfileUser.fromJson(res.data!);
}
Future<void> updateMe({String? name, String? email, String? phone}) async {
final payload = <String, dynamic>{};
if (name != null) payload['name'] = name;
if (email != null) payload['email'] = email;
if (phone != null) payload['phone'] = phone;
if (payload.isEmpty) return;
await _dio.patch<void>('/users/me', data: payload);
}
Future<void> changePassword({
required String currentPassword,
required String newPassword,
}) async {
await _dio.post<void>(
'/users/me/change-password',
data: {'current_password': currentPassword, 'new_password': newPassword},
);
}
}