TF-2682 Create always read receipt setting view

This commit is contained in:
DatDang
2024-03-08 10:08:16 +07:00
committed by Dat H. Pham
parent e08ba15d93
commit 0d94f523ab
6 changed files with 132 additions and 1 deletions
@@ -87,7 +87,7 @@ class AlwaysReadReceiptController extends BaseController {
void _getAlwaysReadReceiptSettingSuccess(
GetAlwaysReadReceiptSettingSuccess success
) {
_updateAlwaysReadReceiptValue(success.isEnabled);
_updateAlwaysReadReceiptValue(success.alwaysReadReceiptEnabled);
}
void _getCurrentAlwaysReadReceiptSetting() {
@@ -0,0 +1,86 @@
import 'package:core/presentation/extensions/color_extension.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/base/mixin/app_loader_mixin.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/always_read_receipt/always_read_receipt_controller.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings_utils.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
class AlwaysReadReceiptView extends GetWidget<AlwaysReadReceiptController> with AppLoaderMixin {
const AlwaysReadReceiptView({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: SettingsUtils.getBackgroundColor(context, controller.responsiveUtils),
body: Container(
color: SettingsUtils.getContentBackgroundColor(context, controller.responsiveUtils),
decoration: SettingsUtils.getBoxDecorationForContent(context, controller.responsiveUtils),
margin: SettingsUtils.getMarginViewForSettingDetails(context, controller.responsiveUtils),
padding: SettingsUtils.getPaddingAlwaysReadReceiptSetting(context, controller.responsiveUtils),
child: Column(
children: [
Obx(() {
if (!controller.isLoading) {
return const SizedBox(height: 3);
}
return horizontalLoadingWidget;
}),
Expanded(
child: ListView(
physics: const ClampingScrollPhysics(),
children: [
Text(
AppLocalizations.of(context).emailReadReceipts,
style: const TextStyle(
fontSize: 17,
height: 24 / 17,
fontWeight: FontWeight.w500,
color: Colors.black)),
const SizedBox(height: 8),
Text(
AppLocalizations.of(context).emailReadReceiptsSettingExplanation,
style: const TextStyle(
fontSize: 16,
height: 20 / 16,
color: AppColor.colorTextSettingDescriptions)),
const SizedBox(height: 24),
Row(
children: [
InkWell(
onTap: controller.toggleAlwaysReadReceipt,
child: Padding(
padding: const EdgeInsets.all(4),
child: Obx(() {
return SvgPicture.asset(
controller.alwaysReadReceipt.value
? controller.imagePaths.icSwitchOn
: controller.imagePaths.icSwitchOff,
fit: BoxFit.fill,
width: 32,
height: 20);
}),
),
),
const SizedBox(width: 12),
Expanded(
child: Text(
AppLocalizations.of(context).emailReadReceiptsToggleDescription,
style: const TextStyle(
fontSize: 16,
height: 20 / 16,
color: Colors.black),
)),
],
),
],
),
),
],
),
),
);
}
}