Optimize and refactor for MailboxVisibility

This commit is contained in:
dab246
2023-02-17 11:21:54 +07:00
committed by Dat Vu
parent 1f871ac8eb
commit f2a63c083a
17 changed files with 343 additions and 487 deletions
@@ -33,57 +33,52 @@ class SettingsView extends GetWidget<SettingsController> {
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SafeArea(
bottom: false,
child: SizedBox.fromSize(
size: const Size.fromHeight(52),
child: Padding(
padding: SettingsUtils.getPaddingAppBar(context, _responsiveUtils),
child: _buildAppbar(context))),
),
const Divider(color: AppColor.colorDividerComposer, height: 1),
SafeArea(
bottom: false,
top: false,
child: Obx(() {
if (controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsValid == true) {
return VacationNotificationMessageWidget(
return Container(
color: Colors.white,
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox.fromSize(
size: const Size.fromHeight(52),
child: Padding(
padding: SettingsUtils.getPaddingAppBar(context, _responsiveUtils),
child: _buildAppbar(context))),
const Divider(color: AppColor.colorDividerComposer, height: 1),
Obx(() {
if (controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsValid == true) {
return VacationNotificationMessageWidget(
margin: const EdgeInsets.only(
left: BuildUtils.isWeb ? 24 : 16,
right: BuildUtils.isWeb ? 24 : 16,
top: 16),
fromAccountDashBoard: true,
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
actionEndNow: () => controller.manageAccountDashboardController.disableVacationResponder());
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
&& controller.manageAccountDashboardController.inVacationSettings()) {
return VacationNotificationMessageWidget(
margin: const EdgeInsets.only(
left: BuildUtils.isWeb ? 24 : 16,
right: BuildUtils.isWeb ? 24 : 16,
top: 16),
left: BuildUtils.isWeb ? 24 : 16,
right: BuildUtils.isWeb ? 24 : 16,
top: 16),
fromAccountDashBoard: true,
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
actionEndNow: () => controller.manageAccountDashboardController.disableVacationResponder());
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
&& controller.manageAccountDashboardController.inVacationSettings()) {
return VacationNotificationMessageWidget(
margin: const EdgeInsets.only(
left: BuildUtils.isWeb ? 24 : 16,
right: BuildUtils.isWeb ? 24 : 16,
top: 16),
fromAccountDashBoard: true,
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
leadingIcon: const Padding(
padding: EdgeInsets.only(right: 16),
child: Icon(Icons.timer, size: 20),
)
);
} else {
return const SizedBox.shrink();
}
})
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
leadingIcon: const Padding(
padding: EdgeInsets.only(right: 16),
child: Icon(Icons.timer, size: 20),
)
);
} else {
return const SizedBox.shrink();
}
}),
Expanded(child: _bodySettingsScreen())
]
),
Expanded(child: SafeArea(
top: false,
child: _bodySettingsScreen()
))
]
),
);
}
@@ -107,14 +107,6 @@ class SettingsUtils {
}
}
static EdgeInsets getPaddingHeaderWidgetForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isPortraitMobile(context)) {
return const EdgeInsets.only(left: 16, right: 16);
} else {
return const EdgeInsets.all(12);
}
}
static EdgeInsets getPaddingKeepLocalSwitchButtonForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isPortraitMobile(context)) {
return const EdgeInsets.symmetric(horizontal: 18, vertical: 14);
@@ -142,4 +134,12 @@ class SettingsUtils {
return EdgeInsets.zero;
}
}
static EdgeInsets getMarginSettingDetailsView(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return const EdgeInsets.all(16);
} else {
return EdgeInsets.zero;
}
}
}