TF-460 Add presentation layer for implement get all identities

This commit is contained in:
dab246
2022-04-26 09:31:38 +07:00
committed by Dat H. Pham
parent 4764f9eb90
commit f432dfb376
35 changed files with 591 additions and 204 deletions
@@ -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;