TF-1118 Clear input data when back to setting menu

This commit is contained in:
dab246
2022-11-08 16:57:22 +07:00
committed by Dat H. Pham
parent eaa47b9cd7
commit 21f027246b
13 changed files with 262 additions and 137 deletions
@@ -15,6 +15,7 @@ class SettingsController extends GetxController {
void backToUniversalSettings() {
log('SettingsController::backToUniversalSettings()');
manageAccountDashboardController.clearInputFormView();
manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.none);
manageAccountDashboardController.settingsPageLevel.value = SettingsPageLevel.universal;
}
@@ -32,18 +32,34 @@ class SettingsView extends GetWidget<SettingsController> {
@override
Widget build(BuildContext context) {
return SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox.fromSize(
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),
Obx(() {
),
const Divider(color: AppColor.colorDividerComposer, height: 1),
SafeArea(
bottom: false,
top: false,
child: 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,
@@ -51,29 +67,22 @@ class SettingsView extends GetWidget<SettingsController> {
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),
));
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()
))
]
);
}
@@ -110,16 +119,14 @@ class SettingsView extends GetWidget<SettingsController> {
Widget _buildSettingLevel1AppBar(BuildContext context) {
return Stack(children: [
if (_responsiveUtils.isPortraitMobile(context))
_buildBackButton(context)
else
Align(
Align(
alignment: Alignment.centerLeft,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: controller.backToUniversalSettings,
borderRadius: BorderRadius.circular(15),
customBorder: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(15))),
child: Tooltip(
message: AppLocalizations.of(context).back,
child: Container(
@@ -160,21 +167,6 @@ class SettingsView extends GetWidget<SettingsController> {
]);
}
Widget _buildBackButton(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
child: buildIconWeb(
icon: SvgPicture.asset(_imagePaths.icBack,
width: 18,
height: 18,
color: AppColor.colorTextButton,
fit: BoxFit.fill),
tooltip: AppLocalizations.of(context).back,
onTap: controller.backToUniversalSettings
),
);
}
Widget _buildCloseSettingButton(BuildContext context) {
return buildIconWeb(
icon: SvgPicture.asset(_imagePaths.icClose, width: 28, height: 28, fit: BoxFit.fill),
@@ -21,8 +21,10 @@ class SettingsUtils {
}
static EdgeInsets getPaddingAppBar(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isMobile(context)) {
if (responsiveUtils.isPortraitMobile(context)) {
return const EdgeInsets.symmetric(horizontal: 16);
} else if (responsiveUtils.isLandscapeMobile(context)) {
return const EdgeInsets.symmetric(horizontal: 12);
} else {
return const EdgeInsets.symmetric(horizontal: 32);
}
@@ -80,9 +82,11 @@ class SettingsUtils {
static EdgeInsets getPaddingListRecipientForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isPortraitMobile(context)) {
return const EdgeInsets.only(left: 12, right: 12, bottom: 12);
return const EdgeInsets.symmetric(horizontal: 16);
} if (responsiveUtils.isLandscapeMobile(context)) {
return const EdgeInsets.all(12);
} else {
return const EdgeInsets.only(left: 24, right: 24, bottom: 24);
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
}
}
@@ -93,19 +97,49 @@ class SettingsUtils {
color: Colors.white);
}
static EdgeInsets getMarginTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
static EdgeInsets getPaddingTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isPortraitMobile(context)) {
return EdgeInsets.zero;
return const EdgeInsets.symmetric(horizontal: 16, vertical: 12);
} if (responsiveUtils.isLandscapeMobile(context)) {
return const EdgeInsets.all(12);
} else {
return const EdgeInsets.symmetric(horizontal: 20);
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
}
}
static EdgeInsets getPaddingTitleHeaderForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
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);
} if (responsiveUtils.isLandscapeMobile(context)) {
return const EdgeInsets.all(14);
} else {
return const EdgeInsets.symmetric(horizontal: 34, vertical: 14);
}
}
static EdgeInsets getPaddingInputRecipientForwarding(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isPortraitMobile(context)) {
return const EdgeInsets.symmetric(horizontal: 16, vertical: 12);
} if (responsiveUtils.isLandscapeMobile(context)) {
return const EdgeInsets.all(12);
} else {
return const EdgeInsets.symmetric(horizontal: 32, vertical: 12);
}
}
static EdgeInsets getMarginViewForForwardSettingDetails(BuildContext context, ResponsiveUtils responsiveUtils) {
if (responsiveUtils.isWebDesktop(context)) {
return const EdgeInsets.all(16);
} else {
return EdgeInsets.zero;
}
}
}