refactor: update changeUserRole method to accept named parameters for improved clarity and modify ProfilePage to utilize new method signature

This commit is contained in:
2025-12-30 09:40:15 +03:30
parent 71123c3520
commit b7b203ee51
3 changed files with 11 additions and 8 deletions

View File

@@ -173,12 +173,14 @@ class ProfileLogic extends GetxController {
retryNewPasswordController.clear(); retryNewPasswordController.clear();
} }
Future<void> changeUserRole(String newRole) async { Future<void> changeUserRole({
dLog(newRole); required String route,
await gService.saveRoute(Module.chicken, newRole); required String role,
await gService.saveRole(Module.chicken, newRole); }) async {
await gService.saveRoute(Module.chicken, route);
await gService.saveRole(Module.chicken, role);
Get.offAllNamed(newRole); Get.offAllNamed(route);
} }
void scrollToSelectedItem( void scrollToSelectedItem(

View File

@@ -1003,8 +1003,10 @@ class ProfilePage extends GetView<ProfileLogic> {
title: tmpRole.keys.first, title: tmpRole.keys.first,
index: index, index: index,
onTap: (int p1) { onTap: (int p1) {
controller.changeUserRole(
controller.changeUserRole(tmpRole.values.first); route: tmpRole.values.first,
role: item?[index] ?? '',
);
}, },
); );
}), }),

View File

@@ -70,7 +70,6 @@ class RolePage extends GetView<RoleLogic> {
Module.chicken, Module.chicken,
route, route,
); );
await controller.gService.saveRole( await controller.gService.saveRole(
Module.chicken, Module.chicken,
data[index], data[index],