TF-4193 Handle multi click to enable Label visibility feature
This commit is contained in:
@@ -13,6 +13,7 @@ class SettingAppBar extends StatelessWidget {
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
final VoidCallback onBackAction;
|
||||
final VoidCallback? onExportTraceLogAction;
|
||||
final VoidCallback? onMultiClickAction;
|
||||
|
||||
const SettingAppBar({
|
||||
super.key,
|
||||
@@ -22,6 +23,7 @@ class SettingAppBar extends StatelessWidget {
|
||||
required this.responsiveUtils,
|
||||
required this.onBackAction,
|
||||
this.onExportTraceLogAction,
|
||||
this.onMultiClickAction,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -39,6 +41,7 @@ class SettingAppBar extends StatelessWidget {
|
||||
imagePaths: imagePaths,
|
||||
responsiveUtils: responsiveUtils,
|
||||
onBackAction: onBackAction,
|
||||
onMultiClickAction: onMultiClickAction,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-6
@@ -1,6 +1,7 @@
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/utils/theme_utils.dart';
|
||||
import 'package:core/presentation/views/button/multi_click_widget.dart';
|
||||
import 'package:core/presentation/views/button/tmail_button_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||
@@ -11,6 +12,7 @@ class SettingFirstLevelAppBar extends StatelessWidget {
|
||||
final ImagePaths imagePaths;
|
||||
final ResponsiveUtils responsiveUtils;
|
||||
final VoidCallback onBackAction;
|
||||
final VoidCallback? onMultiClickAction;
|
||||
|
||||
const SettingFirstLevelAppBar({
|
||||
super.key,
|
||||
@@ -18,12 +20,27 @@ class SettingFirstLevelAppBar extends StatelessWidget {
|
||||
required this.imagePaths,
|
||||
required this.responsiveUtils,
|
||||
required this.onBackAction,
|
||||
this.onMultiClickAction,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appLocalizations = AppLocalizations.of(context);
|
||||
|
||||
Widget titleWidget = Text(
|
||||
accountMenuItem.getName(appLocalizations),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: ThemeUtils.textStyleM3BodyLarge,
|
||||
);
|
||||
|
||||
if (onMultiClickAction != null) {
|
||||
titleWidget = MultiClickWidget(
|
||||
onMultiTap: onMultiClickAction!,
|
||||
child: titleWidget,
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
height: 64,
|
||||
padding: _getPadding(context),
|
||||
@@ -43,12 +60,7 @@ class SettingFirstLevelAppBar extends StatelessWidget {
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
child: Text(
|
||||
accountMenuItem.getName(appLocalizations),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: ThemeUtils.textStyleM3BodyLarge,
|
||||
),
|
||||
child: titleWidget,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/handle_setup_label_visibility_in_setting_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/validate_setting_capability_supported_extension.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/forward/forward_view.dart';
|
||||
@@ -28,21 +29,37 @@ class SettingsView extends GetWidget<SettingsController> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Obx(() => SettingAppBar(
|
||||
pageLevel: controller
|
||||
Obx(() {
|
||||
final labelVisibility = controller
|
||||
.manageAccountDashboardController
|
||||
.settingsPageLevel
|
||||
.value,
|
||||
accountMenuItem: controller
|
||||
.isLabelVisibility
|
||||
.value;
|
||||
final isLabelCapabilitySupported = controller
|
||||
.manageAccountDashboardController
|
||||
.accountMenuItemSelected
|
||||
.value,
|
||||
imagePaths: controller.imagePaths,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
onBackAction: () => controller.onBackSettingAction(context),
|
||||
onExportTraceLogAction: () =>
|
||||
controller.showExportTraceLogConfirmDialog(context),
|
||||
)),
|
||||
.isLabelCapabilitySupported;
|
||||
|
||||
final disableMultiClick =
|
||||
labelVisibility || !isLabelCapabilitySupported;
|
||||
|
||||
return SettingAppBar(
|
||||
pageLevel: controller
|
||||
.manageAccountDashboardController
|
||||
.settingsPageLevel
|
||||
.value,
|
||||
accountMenuItem: controller
|
||||
.manageAccountDashboardController
|
||||
.accountMenuItemSelected
|
||||
.value,
|
||||
imagePaths: controller.imagePaths,
|
||||
responsiveUtils: controller.responsiveUtils,
|
||||
onBackAction: () => controller.onBackSettingAction(context),
|
||||
onExportTraceLogAction: () =>
|
||||
controller.showExportTraceLogConfirmDialog(context),
|
||||
onMultiClickAction: disableMultiClick
|
||||
? null
|
||||
: controller.manageAccountDashboardController.enableLabelVisibility,
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
final dashboard = controller.manageAccountDashboardController;
|
||||
final vacation = dashboard.vacationResponse.value;
|
||||
|
||||
Reference in New Issue
Block a user