setting_view_model.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import 'package:cpt_profile/modules/change_mobile/change_mobile_page.dart';
  2. import 'package:cpt_profile/modules/reset_password/reset_password_page.dart';
  3. import 'package:cpt_profile/modules/setting/dialog/account_deactivation_dialog.dart';
  4. import 'package:cpt_profile/modules/setting/setting_state.dart';
  5. import 'package:cs_resources/generated/l10n.dart';
  6. import 'package:plugin_platform/engine/dialog/dialog_engine.dart';
  7. import 'package:plugin_platform/engine/toast/toast_engine.dart';
  8. import 'package:riverpod_annotation/riverpod_annotation.dart';
  9. import 'package:widgets/dialog/app_default_dialog.dart';
  10. part 'setting_view_model.g.dart';
  11. @riverpod
  12. class SettingViewModel extends _$SettingViewModel {
  13. @override
  14. SettingState build() {
  15. return SettingState();
  16. }
  17. void changeEnableNotification(bool value) {
  18. state = state.copyWith(enbaleNofitication: value);
  19. }
  20. //去修改手机号码的页面
  21. void gotoChangeMobilePage() {
  22. ChangeMobilePage.startInstance();
  23. }
  24. void gotoResetPasswordPage() {
  25. ResetPasswordPage.startInstance();
  26. }
  27. // 退出登录
  28. void doLogout() {
  29. DialogEngine.show(
  30. widget: AppDefaultDialog(
  31. message: "Are you sure you want to logout?",
  32. confirmAction: () {
  33. ToastEngine.show("点击了确定");
  34. },
  35. ));
  36. }
  37. //展示删除账号的提示弹窗
  38. void doDeleteAccount() {
  39. DialogEngine.show(widget: AccountDeactivationDialog(
  40. confirmAction: () {
  41. ToastEngine.show("点击了确定");
  42. },
  43. ));
  44. }
  45. }