TF-460 Add presentation layer for implement get all identities
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/dashboard/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_property.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||
|
||||
class ManageAccountMenuController extends BaseController {
|
||||
|
||||
final dashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
|
||||
final listAccountProperties = <AccountProperty>[
|
||||
AccountProperty.profiles
|
||||
final listAccountMenuItem = <AccountMenuItem>[
|
||||
AccountMenuItem.profiles
|
||||
];
|
||||
|
||||
@override
|
||||
@@ -19,4 +19,8 @@ class ManageAccountMenuController extends BaseController {
|
||||
@override
|
||||
void onError(error) {
|
||||
}
|
||||
|
||||
void selectAccountMenuItem(AccountMenuItem newAccountMenuItem) {
|
||||
dashBoardController.selectAccountMenuItem(newAccountMenuItem);
|
||||
}
|
||||
}
|
||||
@@ -65,23 +65,29 @@ class ManageAccountMenuView extends GetWidget<ManageAccountMenuController> {
|
||||
padding: const EdgeInsets.only(left: 16, right: 8),
|
||||
key: const Key('list_manage_account_property'),
|
||||
shrinkWrap: true,
|
||||
itemCount: controller.listAccountProperties.length,
|
||||
itemBuilder: (context, index) => Obx(() => AccountPropertyTileBuilder(
|
||||
itemCount: controller.listAccountMenuItem.length,
|
||||
itemBuilder: (context, index) => Obx(() => AccountMenuItemTileBuilder(
|
||||
context,
|
||||
_imagePaths,
|
||||
_responsiveUtils,
|
||||
controller.listAccountProperties[index],
|
||||
controller.dashBoardController.accountPropertySelected.value))),
|
||||
controller.listAccountMenuItem[index],
|
||||
controller.dashBoardController.accountMenuItemSelected.value,
|
||||
onSelectAccountMenuItemAction: (newAccountMenuItem) =>
|
||||
controller.selectAccountMenuItem(newAccountMenuItem)))),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16),
|
||||
child: Divider(color: AppColor.lineItemListColor, height: 0.5, thickness: 0.2)),
|
||||
Padding(padding: const EdgeInsets.only(left: 32),
|
||||
child: InkWell(child: Row(children: [
|
||||
SvgPicture.asset(_imagePaths.icLogout, fit: BoxFit.fill),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(AppLocalizations.of(context).sign_out,
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
]))),
|
||||
child: InkWell(
|
||||
onTap: () => controller.dashBoardController.logoutAction(),
|
||||
child: Row(children: [
|
||||
SvgPicture.asset(_imagePaths.icLogout, fit: BoxFit.fill),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(AppLocalizations.of(context).sign_out,
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
])
|
||||
)
|
||||
),
|
||||
]),
|
||||
)),
|
||||
]
|
||||
|
||||
+21
-16
@@ -1,54 +1,59 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_property.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||
|
||||
class AccountPropertyTileBuilder extends StatelessWidget {
|
||||
typedef OnSelectAccountMenuItemAction = void Function(AccountMenuItem);
|
||||
|
||||
class AccountMenuItemTileBuilder extends StatelessWidget {
|
||||
|
||||
final BuildContext _context;
|
||||
final ImagePaths _imagePaths;
|
||||
final ResponsiveUtils _responsiveUtils;
|
||||
final AccountProperty _accountProperty;
|
||||
final AccountProperty _accountPropertySelected;
|
||||
final AccountMenuItem _menuItem;
|
||||
final AccountMenuItem _menuItemSelected;
|
||||
final OnSelectAccountMenuItemAction? onSelectAccountMenuItemAction;
|
||||
|
||||
const AccountPropertyTileBuilder(
|
||||
const AccountMenuItemTileBuilder(
|
||||
this._context,
|
||||
this._imagePaths,
|
||||
this._responsiveUtils,
|
||||
this._accountProperty,
|
||||
this._accountPropertySelected, {Key? key}
|
||||
this._menuItem,
|
||||
this._menuItemSelected,
|
||||
{Key? key, this.onSelectAccountMenuItemAction}
|
||||
) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Theme(
|
||||
return InkWell(
|
||||
onTap: () => onSelectAccountMenuItemAction?.call(_menuItem),
|
||||
child: Theme(
|
||||
data: ThemeData(
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent),
|
||||
child: Container(
|
||||
key: const Key('account_property_tile'),
|
||||
key: const Key('account_menu_item_tile'),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: backgroundColorItem
|
||||
),
|
||||
color: backgroundColorItem),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: MediaQuery(
|
||||
data: const MediaQueryData(padding: EdgeInsets.zero),
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
SvgPicture.asset(_accountProperty.getIcon(_imagePaths), width: 28, height: 28, fit: BoxFit.fill),
|
||||
SvgPicture.asset(_menuItem.getIcon(_imagePaths), width: 28, height: 28, fit: BoxFit.fill),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(_accountProperty.getName(context),
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
Expanded(child: Text(_menuItem.getName(context),
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
]),
|
||||
])
|
||||
)
|
||||
)
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
Color get backgroundColorItem {
|
||||
if (_accountPropertySelected == _accountProperty) {
|
||||
if (_menuItemSelected == _menuItem) {
|
||||
return AppColor.colorBgMailboxSelected;
|
||||
}
|
||||
return _responsiveUtils.isDesktop(_context) ? AppColor.colorBgDesktop : Colors.white;
|
||||
|
||||
Reference in New Issue
Block a user