TF-801 Add presentation layer for get all vacation
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/style_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/datetime_extension.dart';
|
||||
|
||||
typedef OnTapActionCallback<T> = Function(T? value);
|
||||
|
||||
class BorderButtonField<T> extends StatelessWidget {
|
||||
|
||||
final T? value;
|
||||
final OnTapActionCallback? tapActionCallback;
|
||||
final Widget? icon;
|
||||
final TextStyle? textStyle;
|
||||
final MouseCursor? mouseCursor;
|
||||
final String? hintText;
|
||||
|
||||
const BorderButtonField({
|
||||
super.key,
|
||||
this.value,
|
||||
this.tapActionCallback,
|
||||
this.icon,
|
||||
this.textStyle,
|
||||
this.mouseCursor,
|
||||
this.hintText,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
return InkWell(
|
||||
onTap: () => tapActionCallback?.call(value),
|
||||
mouseCursor: mouseCursor,
|
||||
child: Container(
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: AppColor.colorInputBorderCreateMailbox,
|
||||
width: 1),
|
||||
color: Colors.white),
|
||||
padding: const EdgeInsets.only(left: 12, right: 10),
|
||||
child: Row(children: [
|
||||
Expanded(child: Text(
|
||||
_getName(context, value),
|
||||
style: _getTextStyle(value),
|
||||
maxLines: 1,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
)),
|
||||
icon ?? SvgPicture.asset(_imagePaths.icDropDown)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle? _getTextStyle(T? value) {
|
||||
if (hintText != null && value == null) {
|
||||
return const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorHintInputCreateMailbox);
|
||||
}
|
||||
return textStyle ?? const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black);
|
||||
}
|
||||
|
||||
String _getName(BuildContext context, T? value) {
|
||||
if (value is DateTime) {
|
||||
return value.formatDate(locale: Localizations.localeOf(context).toLanguageTag());
|
||||
}
|
||||
if (value is TimeOfDay) {
|
||||
return value.formatTime(context);
|
||||
}
|
||||
return hintText ?? '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/configuration_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/vacation/vacation_bindings.dart';
|
||||
|
||||
class ConfigurationBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void dependencies() {
|
||||
super.dependencies();
|
||||
VacationBindings().dependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => ConfigurationController());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
|
||||
class ConfigurationController extends BaseController {
|
||||
|
||||
@override
|
||||
void onDone() {}
|
||||
|
||||
@override
|
||||
void onError(error) {}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/configuration_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/vacation/vacation_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/configuration_tab_type.dart';
|
||||
|
||||
class ConfigurationView extends GetWidget<ConfigurationController> {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
ConfigurationView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: _responsiveUtils.isWebDesktop(context)
|
||||
? AppColor.colorBgDesktop
|
||||
: Colors.white,
|
||||
body: Container(
|
||||
margin: _responsiveUtils.isWebDesktop(context)
|
||||
? const EdgeInsets.all(24)
|
||||
: EdgeInsets.zero,
|
||||
color: _responsiveUtils.isWebDesktop(context) ? null : Colors.white,
|
||||
decoration: _responsiveUtils.isWebDesktop(context)
|
||||
? BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
border: Border.all(color: AppColor.colorBorderBodyThread, width: 1),
|
||||
color: Colors.white)
|
||||
: null,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
_responsiveUtils.isWebDesktop(context) ? 20 : 0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: BuildUtils.isWeb ? 10 : 0,
|
||||
right: 10,
|
||||
bottom: 10),
|
||||
child: DefaultTabController(
|
||||
initialIndex: 0,
|
||||
length: 1,
|
||||
child: Scaffold(
|
||||
appBar: TabBar(
|
||||
unselectedLabelColor: AppColor.colorTextButtonHeaderThread,
|
||||
unselectedLabelStyle: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: AppColor.colorTextButtonHeaderThread),
|
||||
labelStyle: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.primaryColor),
|
||||
labelColor: AppColor.primaryColor,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
indicator: const CustomIndicator(
|
||||
indicatorHeight: 4,
|
||||
indicatorColor: AppColor.primaryColor,
|
||||
indicatorSize: CustomIndicatorSize.full),
|
||||
onTap: (index) {},
|
||||
tabs: ConfigurationTabType.values
|
||||
.map((tab) => Tab(text: tab.getTitle(context)))
|
||||
.toList()
|
||||
),
|
||||
body: Column(children: [
|
||||
const Divider(color: AppColor.colorDividerMailbox, height: 0.5, thickness: 0.2),
|
||||
Expanded(child: TabBarView(
|
||||
children: [
|
||||
VacationView(),
|
||||
],
|
||||
))
|
||||
]),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_vacation_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/vacation/vacation_controller.dart';
|
||||
|
||||
class VacationBindings extends BaseBindings {
|
||||
|
||||
@override
|
||||
void bindingsController() {
|
||||
Get.lazyPut(() => VacationController(Get.find<GetAllVacationInteractor>()));
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
Get.lazyPut(() => GetAllVacationInteractor(Get.find<ManageAccountRepository>()));
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
}
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/state/get_all_vacation_state.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/get_all_vacation_interactor.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/vacation/date_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/vacation_presentation.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/vacation_responder_status.dart';
|
||||
|
||||
class VacationController extends BaseController {
|
||||
|
||||
final _accountDashBoardController = Get.find<ManageAccountDashBoardController>();
|
||||
|
||||
final GetAllVacationInteractor _getAllVacationInteractor;
|
||||
|
||||
final vacationPresentation = VacationPresentation.initialize().obs;
|
||||
|
||||
final TextEditingController messageBodyEditorController = TextEditingController();
|
||||
|
||||
VacationResponse? currentVacation;
|
||||
|
||||
VacationController(this._getAllVacationInteractor);
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
_getAllVacation();
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
viewState.value.fold(
|
||||
(failure) => null,
|
||||
(success) {
|
||||
if (success is GetAllVacationSuccess) {
|
||||
_handleGetAllVacationSuccess(success);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void onError(error) {}
|
||||
|
||||
void _getAllVacation() {
|
||||
final accountId = _accountDashBoardController.accountId.value;
|
||||
if (accountId != null) {
|
||||
consumeState(_getAllVacationInteractor.execute(accountId));
|
||||
}
|
||||
}
|
||||
|
||||
void _handleGetAllVacationSuccess(GetAllVacationSuccess success) {
|
||||
if (success.listVacationResponse?.isNotEmpty == true) {
|
||||
currentVacation = success.listVacationResponse!.first;
|
||||
log('VacationController::_handleGetAllVacationSuccess(): $currentVacation');
|
||||
|
||||
final vacationStatus = currentVacation?.isEnabled;
|
||||
final startDate = currentVacation?.fromDate?.value;
|
||||
final endDate = currentVacation?.toDate?.value;
|
||||
final messageBody = currentVacation?.htmlBody ?? currentVacation?.textBody;
|
||||
final startTime = startDate != null
|
||||
? TimeOfDay.fromDateTime(startDate)
|
||||
: null;
|
||||
final endTime = endDate != null
|
||||
? TimeOfDay.fromDateTime(endDate)
|
||||
: null;
|
||||
final vacationStopEnabled = endDate != null;
|
||||
|
||||
if (messageBody != null) {
|
||||
messageBodyEditorController.text = messageBody;
|
||||
}
|
||||
|
||||
updateVacationPresentation(
|
||||
newStatus: vacationStatus == true
|
||||
? VacationResponderStatus.activated
|
||||
: VacationResponderStatus.deactivated,
|
||||
startDate: startDate,
|
||||
startTime: startTime,
|
||||
endDate: endDate,
|
||||
endTime: endTime,
|
||||
vacationStopEnabled: vacationStopEnabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool get isVacationDeactivated =>
|
||||
vacationPresentation.value.status == VacationResponderStatus.deactivated;
|
||||
|
||||
bool get isVacationStopEnabled => vacationPresentation.value.vacationStopEnabled;
|
||||
|
||||
bool get canChangeEndDate => !isVacationDeactivated && isVacationStopEnabled;
|
||||
|
||||
void updateVacationPresentation({
|
||||
VacationResponderStatus? newStatus,
|
||||
DateTime? startDate,
|
||||
TimeOfDay? startTime,
|
||||
DateTime? endDate,
|
||||
TimeOfDay? endTime,
|
||||
bool? vacationStopEnabled,
|
||||
}) {
|
||||
final currentVacation = vacationPresentation.value;
|
||||
final newVacation = currentVacation.copyWidth(
|
||||
status: newStatus,
|
||||
startDate: startDate,
|
||||
startTime: startTime,
|
||||
endDate: endDate,
|
||||
endTime: endTime,
|
||||
vacationStopEnabled: vacationStopEnabled);
|
||||
vacationPresentation.value = newVacation;
|
||||
}
|
||||
|
||||
void selectDate(BuildContext context, DateType dateType, DateTime? currentDate) async {
|
||||
final datePicked = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: currentDate ?? DateTime.now(),
|
||||
initialDatePickerMode: DatePickerMode.day,
|
||||
firstDate: DateTime(1900),
|
||||
lastDate: DateTime(2100),
|
||||
locale: Localizations.localeOf(context)
|
||||
);
|
||||
|
||||
if (datePicked == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dateType == DateType.start) {
|
||||
updateVacationPresentation(startDate: datePicked);
|
||||
} else {
|
||||
updateVacationPresentation(endDate: datePicked);
|
||||
}
|
||||
}
|
||||
|
||||
void selectTime(BuildContext context, DateType dateType, TimeOfDay? currentTime) async {
|
||||
final timePicked = await showTimePicker(
|
||||
context: context,
|
||||
initialTime: currentTime ?? TimeOfDay.now(),
|
||||
);
|
||||
|
||||
if (timePicked == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dateType == DateType.start) {
|
||||
updateVacationPresentation(startTime: timePicked);
|
||||
} else {
|
||||
updateVacationPresentation(endTime: timePicked);
|
||||
}
|
||||
}
|
||||
|
||||
void saveVacation(BuildContext context) {
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
messageBodyEditorController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,454 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/widget/border_button_field.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/vacation/vacation_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/vacation/widgets/vacation_input_decoration_builder.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/date_type.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/vacation_responder_status.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:toggle_switch/toggle_switch.dart';
|
||||
|
||||
class VacationView extends GetWidget<VacationController> {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
VacationView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: ResponsiveWidget(
|
||||
responsiveUtils: _responsiveUtils,
|
||||
desktop: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(children: [
|
||||
Container(
|
||||
width: 200,
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
AppLocalizations.of(context).vacationResponder,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black))),
|
||||
const SizedBox(width: 16),
|
||||
ToggleSwitch(
|
||||
minWidth: 150.0,
|
||||
cornerRadius: 20.0,
|
||||
activeBgColors: const [[Colors.green], [Colors.redAccent]],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.grey,
|
||||
inactiveFgColor: Colors.white,
|
||||
initialLabelIndex: 1,
|
||||
totalSwitches: VacationResponderStatus.values.length,
|
||||
labels: VacationResponderStatus.values
|
||||
.map((status) => status.getTitle(context))
|
||||
.toList(),
|
||||
radiusStyle: true,
|
||||
onToggle: (index) {
|
||||
log('VacationView::build():ToggleSwitch:index: $index');
|
||||
final newStatus = index == 0
|
||||
? VacationResponderStatus.activated
|
||||
: VacationResponderStatus.deactivated;
|
||||
controller.updateVacationPresentation(newStatus: newStatus);
|
||||
},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: Row(children: [
|
||||
Container(
|
||||
width: 200,
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
AppLocalizations.of(context).startDate,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<DateTime>(
|
||||
value: controller.vacationPresentation.value.startDate,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).startDate,
|
||||
icon: const Icon(
|
||||
Icons.date_range,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectDate(context, DateType.start, value)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<TimeOfDay>(
|
||||
value: controller.vacationPresentation.value.startTime,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noStartTime,
|
||||
icon: const Icon(
|
||||
Icons.timer,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectTime(context, DateType.start, value)))),
|
||||
]),
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: Container(
|
||||
width: 200,
|
||||
color: Colors.white,
|
||||
child: CheckboxListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
activeColor: AppColor.primaryColor.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: controller.vacationPresentation.value.vacationStopEnabled,
|
||||
onChanged: (value) =>
|
||||
controller.updateVacationPresentation(vacationStopEnabled: value),
|
||||
title: Text(AppLocalizations.of(context).vacationStopsAt,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0))),
|
||||
),
|
||||
),
|
||||
)),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: !controller.canChangeEndDate,
|
||||
child: Row(children: [
|
||||
Container(
|
||||
width: 200,
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
AppLocalizations.of(context).endDate,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<DateTime>(
|
||||
value: controller.vacationPresentation.value.endDate,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noEndDate,
|
||||
icon: const Icon(
|
||||
Icons.date_range,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectDate(context, DateType.end, value)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<TimeOfDay>(
|
||||
value: controller.vacationPresentation.value.endTime,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noEndTime,
|
||||
icon: const Icon(
|
||||
Icons.timer,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectTime(context, DateType.end, value)))),
|
||||
])
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Container(
|
||||
width: 200,
|
||||
color: Colors.white,
|
||||
child: Text(
|
||||
AppLocalizations.of(context).messageBody,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: _buildMessageBodyWidget(
|
||||
context,
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0))
|
||||
]),
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: buildTextButton(
|
||||
AppLocalizations.of(context).save,
|
||||
width: 128,
|
||||
height: 44,
|
||||
radius: 10,
|
||||
onTap: () => controller.saveVacation(context)),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
mobile: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (_responsiveUtils.isPortraitMobile(context))
|
||||
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).vacationResponder,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black)),
|
||||
const SizedBox(height: 16),
|
||||
ToggleSwitch(
|
||||
minWidth: 150.0,
|
||||
cornerRadius: 20.0,
|
||||
activeBgColors: const [[Colors.green], [Colors.redAccent]],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.grey,
|
||||
inactiveFgColor: Colors.white,
|
||||
initialLabelIndex: 1,
|
||||
totalSwitches: VacationResponderStatus.values.length,
|
||||
labels: VacationResponderStatus.values
|
||||
.map((status) => status.getTitle(context))
|
||||
.toList(),
|
||||
radiusStyle: true,
|
||||
onToggle: (index) {
|
||||
log('VacationView::build():ToggleSwitch:index: $index');
|
||||
final newStatus = index == 0
|
||||
? VacationResponderStatus.activated
|
||||
: VacationResponderStatus.deactivated;
|
||||
controller.updateVacationPresentation(newStatus: newStatus);
|
||||
},
|
||||
)
|
||||
])
|
||||
else
|
||||
Row(children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).vacationResponder,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black)),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
ToggleSwitch(
|
||||
minWidth: 150.0,
|
||||
cornerRadius: 20.0,
|
||||
activeBgColors: const [[Colors.green], [Colors.redAccent]],
|
||||
activeFgColor: Colors.white,
|
||||
inactiveBgColor: Colors.grey,
|
||||
inactiveFgColor: Colors.white,
|
||||
initialLabelIndex: 1,
|
||||
totalSwitches: VacationResponderStatus.values.length,
|
||||
labels: VacationResponderStatus.values
|
||||
.map((status) => status.getTitle(context))
|
||||
.toList(),
|
||||
radiusStyle: true,
|
||||
onToggle: (index) {
|
||||
log('VacationView::build():ToggleSwitch:index: $index');
|
||||
final newStatus = index == 0
|
||||
? VacationResponderStatus.activated
|
||||
: VacationResponderStatus.deactivated;
|
||||
controller.updateVacationPresentation(newStatus: newStatus);
|
||||
},
|
||||
)
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).startDate,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0))),
|
||||
const SizedBox(height: 16),
|
||||
Row(children: [
|
||||
Expanded(child: Obx(() => BorderButtonField<DateTime>(
|
||||
value: controller.vacationPresentation.value.startDate,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).startDate,
|
||||
icon: const Icon(
|
||||
Icons.date_range,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectDate(context, DateType.start, value)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<TimeOfDay>(
|
||||
value: controller.vacationPresentation.value.startTime,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noStartTime,
|
||||
icon: const Icon(
|
||||
Icons.timer,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectTime(context, DateType.start, value))))
|
||||
]),
|
||||
]),
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: CheckboxListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
activeColor: AppColor.primaryColor.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0),
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
value: controller.vacationPresentation.value.vacationStopEnabled,
|
||||
onChanged: (value) =>
|
||||
controller.updateVacationPresentation(vacationStopEnabled: value),
|
||||
title: Text(AppLocalizations.of(context).vacationStopsAt,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0))),
|
||||
),
|
||||
)),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: !controller.canChangeEndDate,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).endDate,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0))),
|
||||
const SizedBox(height: 16),
|
||||
Row(children: [
|
||||
Expanded(child: Obx(() => BorderButtonField<DateTime>(
|
||||
value: controller.vacationPresentation.value.endDate,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noEndDate,
|
||||
icon: const Icon(
|
||||
Icons.date_range,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectDate(context, DateType.end, value)))),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Obx(() => BorderButtonField<TimeOfDay>(
|
||||
value: controller.vacationPresentation.value.endTime,
|
||||
mouseCursor: SystemMouseCursors.text,
|
||||
textStyle: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
!controller.canChangeEndDate ? 0.5 : 1.0)),
|
||||
hintText: AppLocalizations.of(context).noEndTime,
|
||||
icon: const Icon(
|
||||
Icons.timer,
|
||||
color: AppColor.colorIconTextField,
|
||||
size: 20),
|
||||
tapActionCallback: (value) =>
|
||||
controller.selectTime(context, DateType.end, value))))
|
||||
]),
|
||||
])
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Obx(() => AbsorbPointer(
|
||||
absorbing: controller.isVacationDeactivated,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).messageBody,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0))),
|
||||
const SizedBox(height: 16),
|
||||
_buildMessageBodyWidget(
|
||||
context,
|
||||
controller.isVacationDeactivated ? 0.5 : 1.0)
|
||||
]),
|
||||
)),
|
||||
const SizedBox(height: 20),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: buildTextButton(
|
||||
AppLocalizations.of(context).save,
|
||||
width: 128,
|
||||
height: 44,
|
||||
radius: 10,
|
||||
onTap: () => controller.saveVacation(context)),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMessageBodyWidget(BuildContext context, double opacity) {
|
||||
return (TextFieldBuilder()
|
||||
..key(const Key('message_body_editor'))
|
||||
..cursorColor(Colors.black)
|
||||
..addController(controller.messageBodyEditorController)
|
||||
..textStyle(TextStyle(
|
||||
fontWeight: FontWeight.normal,
|
||||
color: Colors.black.withOpacity(opacity),
|
||||
fontSize: 16))
|
||||
..textDecoration((VacationInputDecorationBuilder()
|
||||
..setContentPadding(const EdgeInsets.symmetric(
|
||||
vertical: BuildUtils.isWeb ? 16 : 12,
|
||||
horizontal: 12))
|
||||
..setHintStyle(TextStyle(
|
||||
color: AppColor.colorHintInputCreateMailbox.withOpacity(opacity),
|
||||
fontSize: 16))
|
||||
..setHintText(AppLocalizations.of(context).hintMessageBodyVacation))
|
||||
.build())
|
||||
..minLines(8)
|
||||
..maxLines(null))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class VacationInputDecorationBuilder extends InputDecorationBuilder {
|
||||
|
||||
@override
|
||||
InputDecoration build() {
|
||||
return InputDecoration(
|
||||
enabledBorder: enabledBorder ?? const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderCreateMailbox)),
|
||||
focusedBorder: enabledBorder ?? const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(width: 1, color: AppColor.colorTextButton)),
|
||||
errorBorder: errorBorder ?? const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderErrorVerifyName)),
|
||||
focusedErrorBorder: errorBorder ?? const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(10)),
|
||||
borderSide: BorderSide(width: 1, color: AppColor.colorInputBorderErrorVerifyName)),
|
||||
prefixText: prefixText,
|
||||
labelText: labelText,
|
||||
floatingLabelBehavior: FloatingLabelBehavior.never,
|
||||
labelStyle: labelStyle ?? const TextStyle(color: Colors.black, fontSize: 16),
|
||||
hintText: hintText,
|
||||
isDense: true,
|
||||
hintStyle: hintStyle ?? const TextStyle(color: AppColor.colorHintInputCreateMailbox, fontSize: 16),
|
||||
contentPadding: contentPadding ?? const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
|
||||
errorText: errorText,
|
||||
errorStyle: errorTextStyle ?? const TextStyle(color: AppColor.colorInputBorderErrorVerifyName, fontSize: 13),
|
||||
filled: true,
|
||||
fillColor: errorText?.isNotEmpty == true
|
||||
? AppColor.colorInputBackgroundErrorVerifyName
|
||||
: Colors.white);
|
||||
}
|
||||
}
|
||||
@@ -44,9 +44,9 @@ class EmailRulesView extends GetWidget<EmailRulesController> with AppLoaderMixin
|
||||
return const EdgeInsets.only(left: 16, top: 16, right: 24, bottom: 24);
|
||||
} else if (_responsiveUtils.isTabletLarge(context) ||
|
||||
_responsiveUtils.isTablet(context)) {
|
||||
return const EdgeInsets.only(right: 32, top: 16, bottom: 16);
|
||||
return const EdgeInsets.only(right: 24, top: 16, bottom: 16);
|
||||
} else {
|
||||
return const EdgeInsets.only(right: 32, top: 16, bottom: 16);
|
||||
return const EdgeInsets.only(right: 24, top: 16, bottom: 16);
|
||||
}
|
||||
} else {
|
||||
if (_responsiveUtils.isDesktop(context) ||
|
||||
@@ -55,7 +55,7 @@ class EmailRulesView extends GetWidget<EmailRulesController> with AppLoaderMixin
|
||||
_responsiveUtils.isTablet(context)) {
|
||||
return const EdgeInsets.only(right: 32, top: 16, bottom: 16);
|
||||
} else {
|
||||
return const EdgeInsets.only(top: 16, bottom: 16, right: 28, left: 20);
|
||||
return const EdgeInsets.only(right: 18, top: 16, bottom: 16, left: 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
extension DateTimeExtension on DateTime? {
|
||||
|
||||
String formatDate({String pattern = 'yyyy/MM/dd', String locale = 'en_US'}) {
|
||||
if (this != null) {
|
||||
return DateFormat(pattern, locale).format(this!.toLocal());
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension TimeOfDayExtension on TimeOfDay? {
|
||||
|
||||
String formatTime(BuildContext context) {
|
||||
if (this != null) {
|
||||
return this!.format(context);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -21,7 +21,7 @@ class LanguageAndRegionView extends GetWidget<LanguageAndRegionController> {
|
||||
body: Container(
|
||||
width: double.infinity,
|
||||
margin: _responsiveUtils.isWebDesktop(context)
|
||||
? const EdgeInsets.only(left: 48, right: 24, top: 24, bottom: 24)
|
||||
? const EdgeInsets.all(24)
|
||||
: EdgeInsets.zero,
|
||||
color: _responsiveUtils.isWebDesktop(context) ? null : Colors.white,
|
||||
decoration: _responsiveUtils.isWebDesktop(context)
|
||||
@@ -37,7 +37,7 @@ class LanguageAndRegionView extends GetWidget<LanguageAndRegionController> {
|
||||
padding: EdgeInsets.only(
|
||||
left: _responsiveUtils.isWebDesktop(context) ? 24 : 10,
|
||||
top: 24,
|
||||
right: 24),
|
||||
right: BuildUtils.isWeb ? 24 : 18),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -26,6 +26,7 @@ import 'package:tmail_ui_user/features/manage_account/data/network/manage_accoun
|
||||
import 'package:tmail_ui_user/features/manage_account/data/repository/manage_account_repository_impl.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/repository/manage_account_repository.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/domain/usecases/log_out_oidc_interactor.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/configuration_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/language_and_region_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/manage_account_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/menu/manage_account_menu_bindings.dart';
|
||||
@@ -39,6 +40,7 @@ class ManageAccountDashBoardBindings extends BaseBindings {
|
||||
ManageAccountMenuBindings().dependencies();
|
||||
ProfileBindings().dependencies();
|
||||
LanguageAndRegionBindings().dependencies();
|
||||
ConfigurationBindings().dependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -23,15 +23,12 @@ import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
class ManageAccountDashBoardController extends ReloadableController {
|
||||
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
|
||||
final menuDrawerKey = GlobalKey<ScaffoldState>(debugLabel: 'manage_account');
|
||||
|
||||
final appInformation = Rxn<PackageInfo>();
|
||||
final userProfile = Rxn<UserProfile>();
|
||||
final accountId = Rxn<AccountId>();
|
||||
final accountMenuItemSelected = AccountMenuItem.profiles.obs;
|
||||
|
||||
final sessionCurrent = Rxn<Session>();
|
||||
|
||||
ManageAccountDashBoardController(
|
||||
@@ -116,7 +113,7 @@ class ManageAccountDashBoardController extends ReloadableController {
|
||||
ForwardBindings().dependencies();
|
||||
}
|
||||
accountMenuItemSelected.value = newAccountMenuItem;
|
||||
if (currentContext != null && !_responsiveUtils.isDesktop(currentContext!)) {
|
||||
if (isMenuDrawerOpen) {
|
||||
closeMenuDrawer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/user_setting_popup_menu_mixin.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/configuration/configuration_view.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/forward/forward_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/language_and_region/language_and_region_view.dart';
|
||||
@@ -160,6 +161,8 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
case AccountMenuItem.vacation:
|
||||
return VacationView();
|
||||
default:
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ class ManageAccountMenuController extends BaseController {
|
||||
final listAccountMenuItem = RxList<AccountMenuItem>([
|
||||
AccountMenuItem.profiles,
|
||||
AccountMenuItem.languageAndRegion,
|
||||
AccountMenuItem.vacation,
|
||||
]);
|
||||
|
||||
void _initWorker() {
|
||||
@@ -51,6 +52,9 @@ class ManageAccountMenuController extends BaseController {
|
||||
listAccountMenuItem.add(
|
||||
AccountMenuItem.languageAndRegion,
|
||||
);
|
||||
listAccountMenuItem.add(
|
||||
AccountMenuItem.vacation,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -99,7 +99,7 @@ class ManageAccountMenuView extends GetWidget<ManageAccountMenuController> {
|
||||
child: InkWell(
|
||||
onTap: () => controller.dashBoardController.logoutAction(),
|
||||
child: Row(children: [
|
||||
SvgPicture.asset(_imagePaths.icLogout, fit: BoxFit.fill),
|
||||
SvgPicture.asset(_imagePaths.icSignOut, fit: BoxFit.fill),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(AppLocalizations.of(context).sign_out,
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
|
||||
+14
-19
@@ -25,31 +25,26 @@ class AccountMenuItemTileBuilder extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () => onSelectAccountMenuItemAction?.call(_menuItem),
|
||||
child: Theme(
|
||||
data: ThemeData(
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent),
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 6),
|
||||
child: InkWell(
|
||||
onTap: () => onSelectAccountMenuItemAction?.call(_menuItem),
|
||||
child: Container(
|
||||
key: const Key('account_menu_item_tile'),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: backgroundColorItem),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: MediaQuery(
|
||||
data: const MediaQueryData(padding: EdgeInsets.zero),
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
SvgPicture.asset(_menuItem.getIcon(_imagePaths), width: 28, height: 28, fit: BoxFit.fill),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(_menuItem.getName(context),
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
]),
|
||||
])
|
||||
)
|
||||
)
|
||||
));
|
||||
child: Column(children: [
|
||||
Row(children: [
|
||||
SvgPicture.asset(_menuItem.getIcon(_imagePaths)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: Text(_menuItem.getName(context),
|
||||
style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 15, color: Colors.black)))
|
||||
]),
|
||||
])
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Color get backgroundColorItem {
|
||||
|
||||
@@ -8,9 +8,7 @@ enum AccountMenuItem {
|
||||
languageAndRegion,
|
||||
emailRules,
|
||||
forward,
|
||||
}
|
||||
|
||||
extension AccountMenuItemExtension on AccountMenuItem {
|
||||
vacation;
|
||||
|
||||
String getIcon(ImagePaths imagePaths) {
|
||||
switch(this) {
|
||||
@@ -22,6 +20,8 @@ extension AccountMenuItemExtension on AccountMenuItem {
|
||||
return imagePaths.icEmailRules;
|
||||
case AccountMenuItem.forward:
|
||||
return imagePaths.icForward;
|
||||
case AccountMenuItem.configuration:
|
||||
return imagePaths.icConfiguration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ extension AccountMenuItemExtension on AccountMenuItem {
|
||||
return AppLocalizations.of(context).emailRules;
|
||||
case AccountMenuItem.forward:
|
||||
return AppLocalizations.of(context).forwarding;
|
||||
case AccountMenuItem.configuration:
|
||||
return AppLocalizations.of(context).configuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum ConfigurationTabType {
|
||||
vacation;
|
||||
|
||||
String getTitle(BuildContext context) {
|
||||
switch(this) {
|
||||
case ConfigurationTabType.vacation:
|
||||
return AppLocalizations.of(context).vacation;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum DateType {
|
||||
start,
|
||||
end;
|
||||
|
||||
String getTitle(BuildContext context) {
|
||||
switch(this) {
|
||||
case DateType.start:
|
||||
return AppLocalizations.of(context).startDate;
|
||||
case DateType.end:
|
||||
return AppLocalizations.of(context).endDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/vacation/vacation_responder_status.dart';
|
||||
|
||||
class VacationPresentation {
|
||||
final VacationResponderStatus status;
|
||||
final DateTime? startDate;
|
||||
final TimeOfDay? startTime;
|
||||
final DateTime? endDate;
|
||||
final TimeOfDay? endTime;
|
||||
final String? messageBody;
|
||||
final bool vacationStopEnabled;
|
||||
|
||||
VacationPresentation({
|
||||
this.status = VacationResponderStatus.deactivated,
|
||||
this.startDate,
|
||||
this.startTime,
|
||||
this.endDate,
|
||||
this.endTime,
|
||||
this.messageBody,
|
||||
this.vacationStopEnabled = false,
|
||||
});
|
||||
|
||||
factory VacationPresentation.initialize() {
|
||||
return VacationPresentation();
|
||||
}
|
||||
|
||||
VacationPresentation copyWidth({
|
||||
VacationResponderStatus? status,
|
||||
DateTime? startDate,
|
||||
TimeOfDay? startTime,
|
||||
DateTime? endDate,
|
||||
TimeOfDay? endTime,
|
||||
String? messageBody,
|
||||
bool? vacationStopEnabled,
|
||||
}) {
|
||||
return VacationPresentation(
|
||||
status: status ?? this.status,
|
||||
startDate: startDate ?? this.startDate,
|
||||
startTime: startTime ?? this.startTime,
|
||||
endDate: endDate ?? this.endDate,
|
||||
endTime: endTime ?? this.endTime,
|
||||
messageBody: messageBody ?? this.messageBody,
|
||||
vacationStopEnabled: vacationStopEnabled ?? this.vacationStopEnabled
|
||||
);
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum VacationResponderStatus {
|
||||
activated,
|
||||
deactivated;
|
||||
|
||||
String getTitle(BuildContext context) {
|
||||
switch(this) {
|
||||
case VacationResponderStatus.activated:
|
||||
return AppLocalizations.of(context).activated;
|
||||
case VacationResponderStatus.deactivated:
|
||||
return AppLocalizations.of(context).deactivated;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,10 @@ class IdentitiesView extends GetWidget<IdentitiesController> with PopupMenuWidge
|
||||
responsiveUtils: _responsiveUtils,
|
||||
mobile: Scaffold(
|
||||
body: Container(
|
||||
margin: const EdgeInsets.only(top: 16, bottom: 16, right: 24),
|
||||
margin: const EdgeInsets.only(
|
||||
top: 16,
|
||||
bottom: 16,
|
||||
right: BuildUtils.isWeb ? 24 : 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/base_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/email_rules/email_rules_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/identities/identities_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_controller.dart';
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class ProfilesView extends GetWidget<ProfilesController> {
|
||||
: Colors.white,
|
||||
body: Container(
|
||||
margin: _responsiveUtils.isWebDesktop(context)
|
||||
? const EdgeInsets.only(left: 48, right: 24, top: 24, bottom: 24)
|
||||
? const EdgeInsets.all(24)
|
||||
: EdgeInsets.zero,
|
||||
color: _responsiveUtils.isWebDesktop(context) ? null : Colors.white,
|
||||
decoration: _responsiveUtils.isWebDesktop(context)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"@@last_modified": "2022-08-18T10:12:35.405050",
|
||||
"@@last_modified": "2022-08-17T17:27:40.386002",
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -1903,5 +1903,83 @@
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"vacation": "Vacation",
|
||||
"@vacation": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"configuration": "Configuration",
|
||||
"@configuration": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"vacationResponder": "Vacation responder",
|
||||
"@vacationResponder": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"activated": "Activated",
|
||||
"@activated": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"deactivated": "Deactivated",
|
||||
"@deactivated": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"startDate": "Start date",
|
||||
"@startDate": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"endDate": "End date",
|
||||
"@endDate": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"vacationStopsAt": "Vacation stops at",
|
||||
"@vacationStopsAt": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"messageBody": "Message body",
|
||||
"@messageBody": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"hintMessageBodyVacation": "Start writing your vacation message here",
|
||||
"@hintMessageBodyVacation": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"noStartTime": "No start time",
|
||||
"@noStartTime": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"noEndTime": "No end time",
|
||||
"@noEndTime": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"noEndDate": "No end date",
|
||||
"@noEndDate": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -1959,4 +1959,95 @@ class AppLocalizations {
|
||||
name: 'forwarding',
|
||||
);
|
||||
}
|
||||
|
||||
String get vacation {
|
||||
return Intl.message(
|
||||
'Vacation',
|
||||
name: 'vacation',
|
||||
);
|
||||
}
|
||||
|
||||
String get configuration {
|
||||
return Intl.message(
|
||||
'Configuration',
|
||||
name: 'configuration',
|
||||
);
|
||||
}
|
||||
|
||||
String get vacationResponder {
|
||||
return Intl.message(
|
||||
'Vacation responder',
|
||||
name: 'vacationResponder',
|
||||
);
|
||||
}
|
||||
|
||||
String get activated {
|
||||
return Intl.message(
|
||||
'Activated',
|
||||
name: 'activated',
|
||||
);
|
||||
}
|
||||
|
||||
String get deactivated {
|
||||
return Intl.message(
|
||||
'Deactivated',
|
||||
name: 'deactivated',
|
||||
);
|
||||
}
|
||||
|
||||
String get startDate {
|
||||
return Intl.message(
|
||||
'Start date',
|
||||
name: 'startDate',
|
||||
);
|
||||
}
|
||||
|
||||
String get endDate {
|
||||
return Intl.message(
|
||||
'End date',
|
||||
name: 'endDate',
|
||||
);
|
||||
}
|
||||
|
||||
String get vacationStopsAt {
|
||||
return Intl.message(
|
||||
'Vacation stops at',
|
||||
name: 'vacationStopsAt',
|
||||
);
|
||||
}
|
||||
|
||||
String get messageBody {
|
||||
return Intl.message(
|
||||
'Message body',
|
||||
name: 'messageBody',
|
||||
);
|
||||
}
|
||||
|
||||
String get hintMessageBodyVacation {
|
||||
return Intl.message(
|
||||
'Start writing your vacation message here',
|
||||
name: 'hintMessageBodyVacation',
|
||||
);
|
||||
}
|
||||
|
||||
String get noStartTime {
|
||||
return Intl.message(
|
||||
'No start time',
|
||||
name: 'noStartTime',
|
||||
);
|
||||
}
|
||||
|
||||
String get noEndTime {
|
||||
return Intl.message(
|
||||
'No end time',
|
||||
name: 'noEndTime',
|
||||
);
|
||||
}
|
||||
|
||||
String get noEndDate {
|
||||
return Intl.message(
|
||||
'No end date',
|
||||
name: 'noEndDate',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user