TF-460 Create ManageAccountDashBoardView
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/content/manage_account_content_controller.dart';
|
||||
|
||||
class ManageAccountContentBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => ManageAccountContentController());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
|
||||
class ManageAccountContentController extends BaseController {
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(error) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/content/manage_account_content_controller.dart';
|
||||
|
||||
class ManageAccountContentView extends GetWidget<ManageAccountContentController> {
|
||||
|
||||
const ManageAccountContentView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(color: Colors.black);
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/login/domain/repository/credential_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/get_user_profile_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/content/manage_account_content_bindings.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/menu/manage_account_menu_bindings.dart';
|
||||
|
||||
class ManageAccountDashBoardBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void dependencies() {
|
||||
super.dependencies();
|
||||
ManageAccountMenuBindings().dependencies();
|
||||
ManageAccountContentBindings().dependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => ManageAccountDashBoardController(
|
||||
Get.find<GetUserProfileInteractor>(),
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
Get.lazyPut(() => GetUserProfileInteractor(Get.find<CredentialRepository>()));
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:tmail_ui_user/features/base/reloadable/reloadable_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/state/get_user_profile_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/usecases/get_user_profile_interactor.dart';
|
||||
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
|
||||
final GetUserProfileInteractor _getUserProfileInteractor;
|
||||
|
||||
final appInformation = Rxn<PackageInfo>();
|
||||
final userProfile = Rxn<UserProfile>();
|
||||
|
||||
ManageAccountDashBoardController(
|
||||
this._getUserProfileInteractor,
|
||||
);
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
_getUserProfile();
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
viewState.value.fold(
|
||||
(failure) {},
|
||||
(success) {
|
||||
if (success is GetUserProfileSuccess) {
|
||||
userProfile.value = success.userProfile;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(error) {
|
||||
}
|
||||
|
||||
void _getUserProfile() async {
|
||||
consumeState(_getUserProfileInteractor.execute());
|
||||
}
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/content/manage_account_content_view.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/menu/manage_account_menu_view.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardController> with
|
||||
UserSettingPopupMenuMixin {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
ManageAccountDashBoardView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Stack(children: [
|
||||
ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
desktop: Column(children: [
|
||||
Row(children: [
|
||||
Container(width: 256, color: Colors.white,
|
||||
padding: const EdgeInsets.only(top: 25, bottom: 25, left: 32),
|
||||
child: Row(children: [
|
||||
(SloganBuilder(arrangedByHorizontal: true)
|
||||
..setSloganText(AppLocalizations.of(context).app_name)
|
||||
..setSloganTextAlign(TextAlign.center)
|
||||
..setSloganTextStyle(const TextStyle(color: Colors.black, fontSize: 20, fontWeight: FontWeight.bold))
|
||||
..setSizeLogo(24)
|
||||
..setLogo(_imagePaths.icLogoTMail))
|
||||
.build(),
|
||||
Obx(() {
|
||||
if (controller.appInformation.value != null) {
|
||||
return Padding(padding: const EdgeInsets.only(top: 6),
|
||||
child: Text(
|
||||
'v.${controller.appInformation.value!.version}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500),
|
||||
));
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
])
|
||||
),
|
||||
Expanded(child: Padding(
|
||||
padding: const EdgeInsets.only(right: 10, top: 16, bottom: 10, left: 48),
|
||||
child: _buildRightHeader(context)))
|
||||
]),
|
||||
Expanded(child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(child: const ManageAccountMenuView(), width: _responsiveUtils.defaultSizeMenuWidthWeb),
|
||||
const Expanded(child: ManageAccountContentView())
|
||||
],
|
||||
))
|
||||
]),
|
||||
tabletLarge: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(child: const ManageAccountMenuView(), width: _responsiveUtils.defaultSizeMenuWidthWeb),
|
||||
const Expanded(child: ManageAccountContentView())
|
||||
],
|
||||
),
|
||||
mobile: const ManageAccountContentView()
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRightHeader(BuildContext context) {
|
||||
return Row(children: [
|
||||
const Spacer(),
|
||||
(SearchBarView(_imagePaths)
|
||||
..hintTextSearch(AppLocalizations.of(context).search_emails)
|
||||
..maxSizeWidth(240)
|
||||
..addOnOpenSearchViewAction(() => {}))
|
||||
.build(),
|
||||
const SizedBox(width: 16),
|
||||
(AvatarBuilder()
|
||||
..text(controller.userProfile.value?.getAvatarText() ?? '')
|
||||
..backgroundColor(Colors.white)
|
||||
..textColor(Colors.black)
|
||||
..context(context)
|
||||
..addOnTapAvatarActionWithPositionClick((position) =>
|
||||
controller.openPopupMenuAction(context, position, popupMenuUserSettingActionTile(context,
|
||||
controller.userProfile.value,
|
||||
onLogoutAction: () => controller.logoutAction(),
|
||||
onSettingAction: () {
|
||||
popBack();
|
||||
controller.goToSettings();
|
||||
})))
|
||||
..addBoxShadows([const BoxShadow(
|
||||
color: AppColor.colorShadowBgContentEmail,
|
||||
spreadRadius: 1, blurRadius: 1, offset: Offset(0, 0.5))])
|
||||
..size(48))
|
||||
.build(),
|
||||
const SizedBox(width: 16)
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_controller.dart';
|
||||
|
||||
class ManageAccountMenuBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => ManageAccountMenuController());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
|
||||
class ManageAccountMenuController extends BaseController {
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(error) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_controller.dart';
|
||||
|
||||
class ManageAccountMenuView extends GetWidget<ManageAccountMenuController> {
|
||||
|
||||
const ManageAccountMenuView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(color: Colors.green);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user