TF-1877 Fix error TextEditingController was used after being disposed on some screen

(cherry picked from commit 50e4c6ec55eea21a45a5a8dd31cd239245248df3)
This commit is contained in:
dab246
2023-06-30 15:45:59 +07:00
committed by Dat Vu
parent 32adfb3581
commit 6c06d0742c
30 changed files with 377 additions and 942 deletions
@@ -30,6 +30,7 @@ import 'package:tmail_ui_user/features/manage_account/presentation/manage_accoun
import 'package:tmail_ui_user/features/rules_filter_creator/presentation/model/creator_action_type.dart';
import 'package:tmail_ui_user/features/rules_filter_creator/presentation/model/rules_filter_creator_arguments.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/routes/dialog_router.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
import 'package:tmail_ui_user/main/routes/app_routes.dart';
@@ -88,23 +89,12 @@ class EmailRulesController extends BaseController {
if (accountId != null && session != null) {
final arguments = RulesFilterCreatorArguments(accountId, session);
if (PlatformInfo.isWeb) {
showDialogRuleFilterCreator(
context: context,
arguments: arguments,
onCreatedRuleFilter: (arguments) {
if (arguments is CreateNewEmailRuleFilterRequest) {
_createNewRuleFilterAction(accountId, arguments);
}
});
} else {
final newRuleFilterRequest = await push(
AppRoutes.rulesFilterCreator,
arguments: arguments);
final newRuleFilterRequest = PlatformInfo.isWeb
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
if (newRuleFilterRequest is CreateNewEmailRuleFilterRequest) {
_createNewRuleFilterAction(accountId, newRuleFilterRequest);
}
if (newRuleFilterRequest is CreateNewEmailRuleFilterRequest) {
_createNewRuleFilterAction(accountId, newRuleFilterRequest);
}
}
}
@@ -140,23 +130,12 @@ class EmailRulesController extends BaseController {
actionType: CreatorActionType.edit,
tMailRule: rule);
if (PlatformInfo.isWeb) {
showDialogRuleFilterCreator(
context: context,
arguments: arguments,
onCreatedRuleFilter: (arguments) {
if (arguments is EditEmailRuleFilterRequest) {
_editEmailRuleFilterAction(accountId, arguments);
}
});
} else {
final newRuleFilterRequest = await push(
AppRoutes.rulesFilterCreator,
arguments: arguments);
final newRuleFilterRequest = PlatformInfo.isWeb
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.rulesFilterCreator, arguments: arguments)
: await push(AppRoutes.rulesFilterCreator, arguments: arguments);
if (newRuleFilterRequest is EditEmailRuleFilterRequest) {
_editEmailRuleFilterAction(accountId, newRuleFilterRequest);
}
if (newRuleFilterRequest is EditEmailRuleFilterRequest) {
_editEmailRuleFilterAction(accountId, newRuleFilterRequest);
}
}
}
@@ -36,6 +36,7 @@ import 'package:tmail_ui_user/features/manage_account/presentation/model/identit
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/widgets/delete_identity_dialog_builder.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
import 'package:tmail_ui_user/main/routes/app_routes.dart';
import 'package:tmail_ui_user/main/routes/dialog_router.dart';
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
class IdentitiesController extends BaseController {
@@ -152,27 +153,14 @@ class IdentitiesController extends BaseController {
if (accountId != null && session != null && userProfile != null) {
final arguments = IdentityCreatorArguments(accountId, session, userProfile);
if (PlatformInfo.isWeb) {
showDialogIdentityCreator(
context: context,
arguments: arguments,
onCreatedIdentity: (arguments) {
if (arguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, arguments);
} else if (arguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, arguments);
}
});
} else {
final newIdentityArguments = await push(
AppRoutes.identityCreator,
arguments: arguments);
final newIdentityArguments = PlatformInfo.isWeb
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
: await push(AppRoutes.identityCreator, arguments: arguments);
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, newIdentityArguments);
}
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, newIdentityArguments);
}
}
}
@@ -271,33 +259,20 @@ class IdentitiesController extends BaseController {
final session = _accountDashBoardController.sessionCurrent;
if (accountId != null && session != null && userProfile != null) {
final arguments = IdentityCreatorArguments(
accountId,
session,
userProfile,
identity: identity,
actionType: IdentityActionType.edit);
accountId,
session,
userProfile,
identity: identity,
actionType: IdentityActionType.edit);
if (PlatformInfo.isWeb) {
showDialogIdentityCreator(
context: context,
arguments: arguments,
onCreatedIdentity: (arguments) {
if (arguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, arguments);
} else if (arguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, arguments);
}
});
} else {
final newIdentityArguments = await push(
AppRoutes.identityCreator,
arguments: arguments);
final newIdentityArguments = PlatformInfo.isWeb
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.identityCreator, arguments: arguments)
: await push(AppRoutes.identityCreator, arguments: arguments);
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, newIdentityArguments);
}
if (newIdentityArguments is CreateNewIdentityRequest) {
_createNewIdentityAction(session, accountId, newIdentityArguments);
} else if (newIdentityArguments is EditIdentityRequest) {
_editIdentityAction(session, accountId, newIdentityArguments);
}
}
}