TF-2313 Apply scrollbar for setting view

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 6f92d6cca5562c3e508f58832fc078daf4944ed3)
This commit is contained in:
dab246
2023-11-22 17:55:17 +07:00
committed by Dat H. Pham
parent de7cc457b5
commit 34db6f893d
2 changed files with 24 additions and 1 deletions
@@ -1,6 +1,7 @@
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/presentation/utils/responsive_utils.dart';
import 'package:core/utils/app_logger.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.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';
@@ -10,6 +11,7 @@ class SettingsController extends GetxController {
final manageAccountDashboardController = Get.find<ManageAccountDashBoardController>();
final responsiveUtils = Get.find<ResponsiveUtils>();
final imagePaths = Get.find<ImagePaths>();
final settingScrollController = ScrollController();
void selectSettings(AccountMenuItem accountMenuItem) {
log('SettingsController::selectSettings(): $accountMenuItem');
@@ -23,4 +25,10 @@ class SettingsController extends GetxController {
manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.none);
manageAccountDashboardController.settingsPageLevel.value = SettingsPageLevel.universal;
}
@override
void onClose() {
settingScrollController.dispose();
super.onClose();
}
}
@@ -1,6 +1,8 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/utils/platform_info.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/base/widget/scrollbar_list_view.dart';
import 'package:tmail_ui_user/features/mailbox/presentation/widgets/user_information_widget.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings/settings_controller.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
@@ -13,7 +15,8 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
final child = SingleChildScrollView(
controller: PlatformInfo.isMobile ? null : controller.settingScrollController,
child: Column(children: [
Obx(() => UserInformationWidget(
userProfile: controller.manageAccountDashboardController.userProfile.value,
@@ -131,5 +134,17 @@ class SettingsFirstLevelView extends GetWidget<SettingsController> {
),
]),
);
if (PlatformInfo.isMobile) {
return child;
} else {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: ScrollbarListView(
scrollController: controller.settingScrollController,
child: child
),
);
}
}
}