nc-photos/app/lib/controller/account_controller.dart

43 lines
1.3 KiB
Dart
Raw Normal View History

import 'package:kiwi/kiwi.dart';
import 'package:nc_photos/account.dart';
2023-06-10 12:44:02 +02:00
import 'package:nc_photos/controller/account_pref_controller.dart';
import 'package:nc_photos/controller/collections_controller.dart';
import 'package:nc_photos/controller/server_controller.dart';
import 'package:nc_photos/di_container.dart';
class AccountController {
void setCurrentAccount(Account account) {
_account = account;
_collectionsController?.dispose();
_collectionsController = null;
2023-06-04 19:14:03 +02:00
_serverController?.dispose();
_serverController = null;
2023-06-10 12:44:02 +02:00
_accountPrefController?.dispose();
_accountPrefController = null;
}
Account get account => _account!;
CollectionsController get collectionsController =>
_collectionsController ??= CollectionsController(
KiwiContainer().resolve<DiContainer>(),
account: _account!,
serverController: serverController,
);
ServerController get serverController =>
_serverController ??= ServerController(
account: _account!,
);
2023-06-10 12:44:02 +02:00
AccountPrefController get accountPrefController =>
_accountPrefController ??= AccountPrefController(
account: _account!,
);
Account? _account;
CollectionsController? _collectionsController;
ServerController? _serverController;
2023-06-10 12:44:02 +02:00
AccountPrefController? _accountPrefController;
}