refactor: update changeUserRole method to accept named parameters for improved clarity and modify ProfilePage to utilize new method signature
This commit is contained in:
@@ -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(
|
||||||
|
|||||||
@@ -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] ?? '',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -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],
|
||||||
|
|||||||
Reference in New Issue
Block a user