diff --git a/core/lib/core.dart b/core/lib/core.dart index 432f9e855..8af345ccd 100644 --- a/core/lib/core.dart +++ b/core/lib/core.dart @@ -62,6 +62,7 @@ export 'presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder export 'presentation/views/modal_sheets/edit_text_modal_sheet_builder.dart'; export 'presentation/views/search/search_bar_view.dart'; export 'presentation/views/popup_menu/popup_menu_item_widget.dart'; +export 'presentation/views/tab_bar/custom_tab_indicator.dart'; // Resources export 'presentation/resources/assets_paths.dart'; diff --git a/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart b/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart new file mode 100644 index 000000000..1486c0614 --- /dev/null +++ b/core/lib/presentation/views/tab_bar/custom_tab_indicator.dart @@ -0,0 +1,61 @@ +import 'package:flutter/widgets.dart'; + +enum CustomIndicatorSize { + tiny, + normal, + full, +} + +class CustomIndicator extends Decoration { + final double indicatorHeight; + final Color indicatorColor; + final CustomIndicatorSize indicatorSize; + + const CustomIndicator({ + required this.indicatorHeight, + required this.indicatorColor, + required this.indicatorSize + }); + + @override + _CustomPainter createBoxPainter([VoidCallback? onChanged]) { + return new _CustomPainter(this, onChanged); + } +} + +class _CustomPainter extends BoxPainter { + final CustomIndicator decoration; + + _CustomPainter(this.decoration, VoidCallback? onChanged) : super(onChanged); + + @override + void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { + assert(configuration.size != null); + + Rect? rect; + if (decoration.indicatorSize == CustomIndicatorSize.full) { + rect = Offset(offset.dx, + (configuration.size!.height - decoration.indicatorHeight)) & + Size(configuration.size!.width, decoration.indicatorHeight); + } else if (decoration.indicatorSize == CustomIndicatorSize.normal) { + rect = Offset(offset.dx + 6, + (configuration.size!.height - decoration.indicatorHeight)) & + Size(configuration.size!.width - 12, decoration.indicatorHeight); + } else if (decoration.indicatorSize == CustomIndicatorSize.tiny) { + rect = Offset(offset.dx + configuration.size!.width / 2 - 8, + (configuration.size!.height - decoration.indicatorHeight)) & + Size(16, decoration.indicatorHeight); + } + + if (rect != null) { + final Paint paint = Paint(); + paint.color = decoration.indicatorColor; + paint.style = PaintingStyle.fill; + canvas.drawRRect( + RRect.fromRectAndCorners(rect, + topRight: Radius.circular(8), + topLeft: Radius.circular(8)), + paint); + } + } +} diff --git a/lib/features/manage_account/presentation/content/manage_account_content_bindings.dart b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_bindings.dart similarity index 73% rename from lib/features/manage_account/presentation/content/manage_account_content_bindings.dart rename to lib/features/manage_account/presentation/account_properties/profiles/identities/identities_bindings.dart index 003018475..a7ee750be 100644 --- a/lib/features/manage_account/presentation/content/manage_account_content_bindings.dart +++ b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_bindings.dart @@ -1,12 +1,12 @@ 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'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/identities/identities_controller.dart'; -class ManageAccountContentBindings extends BaseBindings { +class IdentitiesBindings extends BaseBindings { @override void bindingsController() { - Get.lazyPut(() => ManageAccountContentController()); + Get.lazyPut(() => IdentitiesController()); } @override diff --git a/lib/features/manage_account/presentation/content/manage_account_content_controller.dart b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_controller.dart similarity index 70% rename from lib/features/manage_account/presentation/content/manage_account_content_controller.dart rename to lib/features/manage_account/presentation/account_properties/profiles/identities/identities_controller.dart index 94a2e64e3..de1a0edad 100644 --- a/lib/features/manage_account/presentation/content/manage_account_content_controller.dart +++ b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_controller.dart @@ -1,7 +1,7 @@ import 'package:tmail_ui_user/features/base/base_controller.dart'; -class ManageAccountContentController extends BaseController { +class IdentitiesController extends BaseController { @override void onDone() { diff --git a/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_view.dart b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_view.dart new file mode 100644 index 000000000..8ab722a35 --- /dev/null +++ b/lib/features/manage_account/presentation/account_properties/profiles/identities/identities_view.dart @@ -0,0 +1,17 @@ + +import 'package:core/core.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/identities/identities_controller.dart'; + +class IdentitiesView extends GetWidget { + + final _responsiveUtils = Get.find(); + + IdentitiesView({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container(color: Colors.green); + } +} \ No newline at end of file diff --git a/lib/features/manage_account/presentation/account_properties/profiles/profiles_bindings.dart b/lib/features/manage_account/presentation/account_properties/profiles/profiles_bindings.dart new file mode 100644 index 000000000..dea8ddd3b --- /dev/null +++ b/lib/features/manage_account/presentation/account_properties/profiles/profiles_bindings.dart @@ -0,0 +1,38 @@ +import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/base/base_bindings.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/identities/identities_bindings.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/profiles_controller.dart'; + +class ProfileBindings extends BaseBindings { + + @override + void dependencies() { + super.dependencies(); + IdentitiesBindings(); + } + + @override + void bindingsController() { + Get.lazyPut(() => ProfilesController()); + } + + @override + void bindingsDataSource() { + } + + @override + void bindingsDataSourceImpl() { + } + + @override + void bindingsInteractor() { + } + + @override + void bindingsRepository() { + } + + @override + void bindingsRepositoryImpl() { + } +} \ No newline at end of file diff --git a/lib/features/manage_account/presentation/account_properties/profiles/profiles_controller.dart b/lib/features/manage_account/presentation/account_properties/profiles/profiles_controller.dart new file mode 100644 index 000000000..2f5761408 --- /dev/null +++ b/lib/features/manage_account/presentation/account_properties/profiles/profiles_controller.dart @@ -0,0 +1,17 @@ + +import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/base/base_controller.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/model/profiles_tab_type.dart'; + +class ProfilesController extends BaseController { + + final tabTypeSelected = ProfilesTabType.identities.obs; + + @override + void onDone() { + } + + @override + void onError(error) { + } +} \ No newline at end of file diff --git a/lib/features/manage_account/presentation/account_properties/profiles/profiles_view.dart b/lib/features/manage_account/presentation/account_properties/profiles/profiles_view.dart new file mode 100644 index 000000000..011ccdc6b --- /dev/null +++ b/lib/features/manage_account/presentation/account_properties/profiles/profiles_view.dart @@ -0,0 +1,63 @@ + +import 'package:core/core.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/identities/identities_view.dart'; +import 'package:tmail_ui_user/features/manage_account/presentation/account_properties/profiles/profiles_controller.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; + +class ProfilesView extends GetWidget { + + final _responsiveUtils = Get.find(); + + ProfilesView({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: _responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white, + body: Container( + margin: _responsiveUtils.isDesktop(context) + ? const EdgeInsets.only(left: 48, right: 24, top: 24, bottom: 24) + : EdgeInsets.zero, + decoration: BoxDecoration( + borderRadius: _responsiveUtils.isDesktop(context) ? BorderRadius.circular(20) : null, + border: _responsiveUtils.isDesktop(context) ? Border.all(color: AppColor.colorBorderBodyThread, width: 1) : null, + color: Colors.white), + padding: const EdgeInsets.all(10), + child: DefaultTabController( + initialIndex: 0, + length: 1, + child: Scaffold( + appBar: TabBar( + unselectedLabelColor: AppColor.colorTextButtonHeaderThread, + unselectedLabelStyle: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.normal, + color: AppColor.colorTextButtonHeaderThread), + labelStyle: const TextStyle( + fontSize: 15, + fontWeight: FontWeight.normal, + color: AppColor.primaryColor), + labelColor: AppColor.primaryColor, + indicatorSize: TabBarIndicatorSize.label, + isScrollable: true, + indicator: const CustomIndicator( + indicatorHeight: 4, + indicatorColor: AppColor.primaryColor, + indicatorSize: CustomIndicatorSize.full), + onTap: (index) {}, + tabs: [ + Tab(text: AppLocalizations.of(context).identities), + ]), + body: TabBarView( + children: [ + IdentitiesView(), + ], + ), + ) + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/features/manage_account/presentation/content/manage_account_content_view.dart b/lib/features/manage_account/presentation/content/manage_account_content_view.dart deleted file mode 100644 index 9cbfbfb9f..000000000 --- a/lib/features/manage_account/presentation/content/manage_account_content_view.dart +++ /dev/null @@ -1,14 +0,0 @@ - -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 { - - const ManageAccountContentView({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Container(color: Colors.black); - } -} \ No newline at end of file diff --git a/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_bindings.dart b/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_bindings.dart index 022a33386..1e96bfe10 100644 --- a/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_bindings.dart +++ b/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_bindings.dart @@ -2,7 +2,7 @@ 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/account_properties/profiles/profiles_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'; @@ -12,7 +12,7 @@ class ManageAccountDashBoardBindings extends BaseBindings { void dependencies() { super.dependencies(); ManageAccountMenuBindings().dependencies(); - ManageAccountContentBindings().dependencies(); + ProfileBindings().dependencies(); } @override diff --git a/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_view.dart b/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_view.dart index 72bd198f4..0debeae8f 100644 --- a/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_view.dart +++ b/lib/features/manage_account/presentation/dashboard/manage_account_dashboard_view.dart @@ -1,11 +1,13 @@ import 'package:core/core.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.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/account_properties/profiles/profiles_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/features/manage_account/presentation/model/account_property.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/routes/route_navigation.dart'; @@ -71,11 +73,23 @@ class ManageAccountDashBoardView extends GetWidget {})) + .build(), + Expanded(child: Padding( + padding: const EdgeInsets.only(left: 24, right: 24, bottom: 16), + child: _manageAccountContentView())) + ]) ), ]), ); @@ -111,4 +125,27 @@ class ManageAccountDashBoardView extends GetWidget controller.openMenuDrawer()), + const SizedBox(width: 12), + Expanded(child: Text( + AppLocalizations.of(context).manage_account, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontSize: 21, color: Colors.black, fontWeight: FontWeight.bold))), + ]); + } + + Widget _manageAccountContentView() { + switch(controller.accountPropertySelected.value) { + case AccountProperty.profiles: + return ProfilesView(); + default: + return const SizedBox.shrink(); + } + } } \ No newline at end of file diff --git a/lib/features/manage_account/presentation/menu/manage_account_menu_view.dart b/lib/features/manage_account/presentation/menu/manage_account_menu_view.dart index 66886db10..ba867636d 100644 --- a/lib/features/manage_account/presentation/menu/manage_account_menu_view.dart +++ b/lib/features/manage_account/presentation/menu/manage_account_menu_view.dart @@ -22,6 +22,36 @@ class ManageAccountMenuView extends GetWidget { backgroundColor: Colors.white, body: Column( children: [ + if (!_responsiveUtils.isDesktop(context)) + Container( + color: Colors.white, + padding: const EdgeInsets.only(top: 16, bottom: 16, left: 16), + 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.dashBoardController.appInformation.value != null) { + return Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + 'v.${controller.dashBoardController.appInformation.value!.version}', + textAlign: TextAlign.center, + style: const TextStyle(fontSize: 13, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500), + ), + ); + } else { + return const SizedBox.shrink(); + } + }), + ]) + ), + if (!_responsiveUtils.isDesktop(context)) + const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2), Expanded(child: Container( color: _responsiveUtils.isDesktop(context) ? AppColor.colorBgDesktop : Colors.white, child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/features/manage_account/presentation/model/profiles_tab_type.dart b/lib/features/manage_account/presentation/model/profiles_tab_type.dart new file mode 100644 index 000000000..60270292c --- /dev/null +++ b/lib/features/manage_account/presentation/model/profiles_tab_type.dart @@ -0,0 +1,24 @@ + + +import 'package:flutter/material.dart'; +import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; + +enum ProfilesTabType { + personalInfo, + identities, + follower, +} + +extension ProfilesTabTypeExtension on ProfilesTabType { + + String getName(BuildContext context) { + switch(this) { + case ProfilesTabType.personalInfo: + return AppLocalizations.of(context).identities; + case ProfilesTabType.identities: + return AppLocalizations.of(context).identities; + case ProfilesTabType.follower: + return AppLocalizations.of(context).identities; + } + } +} \ No newline at end of file diff --git a/lib/l10n/intl_messages.arb b/lib/l10n/intl_messages.arb index d48bcd3b2..4d9c2dd48 100644 --- a/lib/l10n/intl_messages.arb +++ b/lib/l10n/intl_messages.arb @@ -1,5 +1,5 @@ { - "@@last_modified": "2022-04-25T17:48:51.808593", + "@@last_modified": "2022-04-25T19:06:15.088714", "initializing_data": "Initializing data...", "@initializing_data": { "type": "text", @@ -1113,5 +1113,11 @@ "type": "text", "placeholders_order": [], "placeholders": {} + }, + "identities": "Identities", + "@identities": { + "type": "text", + "placeholders_order": [], + "placeholders": {} } } \ No newline at end of file diff --git a/lib/main/localizations/app_localizations.dart b/lib/main/localizations/app_localizations.dart index 921d06dbc..ab6576c63 100644 --- a/lib/main/localizations/app_localizations.dart +++ b/lib/main/localizations/app_localizations.dart @@ -1168,4 +1168,9 @@ class AppLocalizations { return Intl.message('Profiles', name: 'profiles'); } + + String get identities { + return Intl.message('Identities', + name: 'identities'); + } } \ No newline at end of file