TF-2064 Handle limit storage to show warning banner

(cherry picked from commit 3e36cebd5cbe880f9832c62463e71979e15e1741)
This commit is contained in:
dab246
2023-08-04 21:43:33 +07:00
committed by Dat Vu
parent 3aa2b91a89
commit a2875ea921
17 changed files with 78 additions and 293 deletions
@@ -25,7 +25,7 @@ import 'package:tmail_ui_user/features/thread/presentation/widgets/spam_banner/s
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/top_bar_thread_selection.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
import 'package:tmail_ui_user/features/quotas/presentation/widget/quotas_warning_banner_widget.dart'; import 'package:tmail_ui_user/features/quotas/presentation/widget/quotas_banner_widget.dart';
import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart'; import 'package:tmail_ui_user/features/search/email/presentation/search_email_view.dart';
import 'package:tmail_ui_user/features/search/mailbox/presentation/search_mailbox_view.dart'; import 'package:tmail_ui_user/features/search/mailbox/presentation/search_mailbox_view.dart';
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart'; import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
@@ -118,6 +118,8 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
]), ]),
Expanded(child: Column(children: [ Expanded(child: Column(children: [
const SpamReportBannerWebWidget(), const SpamReportBannerWebWidget(),
const QuotasBannerWidget(),
_buildVacationNotificationMessage(context),
Obx(() { Obx(() {
if (controller.isEmptyTrashBannerEnabledOnWeb(context)) { if (controller.isEmptyTrashBannerEnabledOnWeb(context)) {
return Padding( return Padding(
@@ -148,14 +150,6 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
}), }),
QuotasWarningBannerWidget(
margin: EdgeInsets.only(
right: AppUtils.isDirectionRTL(context) ? 0 : 16,
left: AppUtils.isDirectionRTL(context) ? 16 : 0,
top: 8
),
),
_buildVacationNotificationMessage(context),
_buildListButtonQuickSearchFilter(context), _buildListButtonQuickSearchFilter(context),
_buildMarkAsMailboxReadLoading(context), _buildMarkAsMailboxReadLoading(context),
Expanded(child: Obx(() { Expanded(child: Obx(() {
@@ -1,6 +1,6 @@
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:tmail_ui_user/features/quotas/domain/model/quotas_response.dart'; import 'package:jmap_dart_client/jmap/quotas/quota.dart';
abstract class QuotasDataSource { abstract class QuotasDataSource {
Future<QuotasResponse> getQuotas(AccountId accountId); Future<List<Quota>> getQuotas(AccountId accountId);
} }
@@ -1,17 +1,17 @@
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
import 'package:tmail_ui_user/features/quotas/data/datasource/quotas_data_source.dart'; import 'package:tmail_ui_user/features/quotas/data/datasource/quotas_data_source.dart';
import 'package:tmail_ui_user/features/quotas/data/network/quotas_api.dart'; import 'package:tmail_ui_user/features/quotas/data/network/quotas_api.dart';
import 'package:tmail_ui_user/features/quotas/domain/model/quotas_response.dart';
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart'; import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
class QuotasDataSourceImpl extends QuotasDataSource{ class QuotasDataSourceImpl extends QuotasDataSource {
final QuotasAPI _quotasAPI; final QuotasAPI _quotasAPI;
final ExceptionThrower _exceptionThrower; final ExceptionThrower _exceptionThrower;
QuotasDataSourceImpl(this._quotasAPI, this._exceptionThrower); QuotasDataSourceImpl(this._quotasAPI, this._exceptionThrower);
@override @override
Future<QuotasResponse> getQuotas(AccountId accountId) { Future<List<Quota>> getQuotas(AccountId accountId) {
return Future.sync(() async { return Future.sync(() async {
return await _quotasAPI.getQuotas(accountId); return await _quotasAPI.getQuotas(accountId);
}).catchError(_exceptionThrower.throwException); }).catchError(_exceptionThrower.throwException);
@@ -3,36 +3,30 @@ import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/jmap_request.dart'; import 'package:jmap_dart_client/jmap/jmap_request.dart';
import 'package:jmap_dart_client/jmap/quotas/get/get_quota_method.dart'; import 'package:jmap_dart_client/jmap/quotas/get/get_quota_method.dart';
import 'package:jmap_dart_client/jmap/quotas/get/get_quota_response.dart'; import 'package:jmap_dart_client/jmap/quotas/get/get_quota_response.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
import 'package:tmail_ui_user/features/quotas/domain/exceptions/quotas_exception.dart'; import 'package:tmail_ui_user/features/quotas/domain/exceptions/quotas_exception.dart';
import 'package:tmail_ui_user/features/quotas/domain/model/quotas_response.dart';
class QuotasAPI { class QuotasAPI {
final HttpClient _httpClient; final HttpClient _httpClient;
QuotasAPI(this._httpClient); QuotasAPI(this._httpClient);
Future<QuotasResponse> getQuotas(AccountId accountId) async { Future<List<Quota>> getQuotas(AccountId accountId) async {
final requestBuilder = final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
JmapRequestBuilder(_httpClient, ProcessingInvocation());
final getQuotaMethod = GetQuotaMethod(accountId); final getQuotaMethod = GetQuotaMethod(accountId);
final getQuotaInvocation = requestBuilder.invocation(getQuotaMethod); final getQuotaInvocation = requestBuilder.invocation(getQuotaMethod);
final response = await (requestBuilder final response = await (requestBuilder
..usings(getQuotaMethod.requiredCapabilities)) ..usings(getQuotaMethod.requiredCapabilities))
.build() .build()
.execute(); .execute();
final getQuotaResponse = response.parse<GetQuotaResponse>( final getQuotaResponse = response.parse<GetQuotaResponse>(
getQuotaInvocation.methodCallId, getQuotaInvocation.methodCallId,
GetQuotaResponse.deserialize, GetQuotaResponse.deserialize,
); );
if(getQuotaResponse != null) { if (getQuotaResponse?.list.isNotEmpty == true) {
return QuotasResponse( return getQuotaResponse!.list;
accountId: getQuotaResponse.accountId,
notFound: getQuotaResponse.notFound,
quotas: getQuotaResponse.list,
state: getQuotaResponse.state,
);
} else { } else {
throw NotFoundQuotasException(); throw NotFoundQuotasException();
} }
@@ -1,6 +1,6 @@
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
import 'package:tmail_ui_user/features/quotas/data/datasource/quotas_data_source.dart'; import 'package:tmail_ui_user/features/quotas/data/datasource/quotas_data_source.dart';
import 'package:tmail_ui_user/features/quotas/domain/model/quotas_response.dart';
import 'package:tmail_ui_user/features/quotas/domain/repository/quotas_repository.dart'; import 'package:tmail_ui_user/features/quotas/domain/repository/quotas_repository.dart';
class QuotasRepositoryImpl extends QuotasRepository { class QuotasRepositoryImpl extends QuotasRepository {
@@ -9,7 +9,7 @@ class QuotasRepositoryImpl extends QuotasRepository {
QuotasRepositoryImpl(this._dataSource); QuotasRepositoryImpl(this._dataSource);
@override @override
Future<QuotasResponse> getQuotas(AccountId accountId) { Future<List<Quota>> getQuotas(AccountId accountId) {
return _dataSource.getQuotas(accountId); return _dataSource.getQuotas(accountId);
} }
} }
@@ -0,0 +1,16 @@
import 'package:core/utils/app_logger.dart';
import 'package:jmap_dart_client/jmap/quotas/data_types.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
extension ListQuotasExtensions on List<Quota> {
Quota? get octetsQuota {
try {
return firstWhere((quota) => quota.resourceType == ResourceType.octets);
} catch(e) {
logError('ListQuotasExtensions::octetsQuota: Not found octets quota');
return null;
}
}
}
@@ -1,30 +0,0 @@
import 'package:equatable/equatable.dart';
import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:jmap_dart_client/jmap/core/state.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
class QuotasResponse with EquatableMixin {
final AccountId accountId;
final State state;
final List<Quota> quotas;
final List<Id>? notFound;
QuotasResponse({
required this.accountId,
required this.state,
required this.quotas,
this.notFound,
});
bool hasData() {
return quotas.isNotEmpty;
}
@override
List<Object?> get props => [
quotas,
state,
notFound,
];
}
@@ -1,6 +1,6 @@
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:tmail_ui_user/features/quotas/domain/model/quotas_response.dart'; import 'package:jmap_dart_client/jmap/quotas/quota.dart';
abstract class QuotasRepository { abstract class QuotasRepository {
Future<QuotasResponse> getQuotas(AccountId accountId); Future<List<Quota>> getQuotas(AccountId accountId);
} }
@@ -1,18 +1,16 @@
import 'package:core/core.dart'; import 'package:core/presentation/state/failure.dart';
import 'package:jmap_dart_client/jmap/core/state.dart'; import 'package:core/presentation/state/success.dart';
import 'package:jmap_dart_client/jmap/quotas/quota.dart'; import 'package:jmap_dart_client/jmap/quotas/quota.dart';
class GetQuotasLoading extends LoadingState {}
class GetQuotasSuccess extends UIState { class GetQuotasSuccess extends UIState {
final List<Quota> quotas; final List<Quota> quotas;
final State? state;
GetQuotasSuccess(this.quotas, this.state); GetQuotasSuccess(this.quotas);
@override @override
List<Object?> get props => [ List<Object?> get props => [quotas];
quotas,
state,
];
} }
class GetQuotasFailure extends FeatureFailure { class GetQuotasFailure extends FeatureFailure {
@@ -1,6 +1,5 @@
import 'dart:core'; import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:core/core.dart';
import 'package:dartz/dartz.dart'; import 'package:dartz/dartz.dart';
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:tmail_ui_user/features/quotas/domain/repository/quotas_repository.dart'; import 'package:tmail_ui_user/features/quotas/domain/repository/quotas_repository.dart';
@@ -13,9 +12,9 @@ class GetQuotasInteractor {
Stream<Either<Failure, Success>> execute(AccountId accountId) async* { Stream<Either<Failure, Success>> execute(AccountId accountId) async* {
try { try {
yield Right<Failure, Success>(LoadingState()); yield Right<Failure, Success>(GetQuotasLoading());
final response = await quotasRepository.getQuotas(accountId); final listQuotas = await quotasRepository.getQuotas(accountId);
yield Right(GetQuotasSuccess(response.quotas, response.state)); yield Right(GetQuotasSuccess(listQuotas));
} catch (exception) { } catch (exception) {
yield Left(GetQuotasFailure(exception)); yield Left(GetQuotasFailure(exception));
} }
@@ -1,91 +0,0 @@
import 'package:core/core.dart';
import 'package:flutter/widgets.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
enum QuotasState {
notAvailable,
normal,
runningOutOfStorage,
runOutOfStorage;
Color getColorProgress() {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
return AppColor.primaryColor;
case QuotasState.runningOutOfStorage:
return AppColor.colorProgressQuotasWarning;
case QuotasState.runOutOfStorage:
return AppColor.colorOutOfStorageQuotasWarning;
}
}
Color getColorQuotasFooterText() {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return AppColor.loginTextFieldHintColor;
case QuotasState.runOutOfStorage:
return AppColor.colorOutOfStorageQuotasWarning;
}
}
String getQuotasFooterText(BuildContext context, num usedCapacity, num softLimitCapacity) {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return AppLocalizations.of(context).textQuotasUsed(
usedCapacity.toDouble(),
softLimitCapacity.toDouble(),
);
case QuotasState.runOutOfStorage:
return AppLocalizations.of(context).textQuotasOutOfStorage;
}
}
String getIconWarningBanner(ImagePaths imagePaths) {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return imagePaths.icQuotasWarning;
case QuotasState.runOutOfStorage:
return imagePaths.icQuotasOutOfStorage;
}
}
Color getBackgroundColorWarningBanner() {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return AppColor.colorBackgroundQuotasWarning.withOpacity(0.12);
case QuotasState.runOutOfStorage:
return AppColor.colorOutOfStorageQuotasWarning.withOpacity(0.12);
}
}
String getTitleWarningBanner(BuildContext context, num progress) {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return AppLocalizations.of(context).textQuotasRunningOutOfStorageTitle(progress.toDouble() * 100);
case QuotasState.runOutOfStorage:
return AppLocalizations.of(context).textQuotasRunOutOfStorageTitle;
}
}
String getContentWarningBanner(BuildContext context) {
switch(this) {
case QuotasState.notAvailable:
case QuotasState.normal:
case QuotasState.runningOutOfStorage:
return AppLocalizations.of(context).textQuotasRunningOutOfStorageContent;
case QuotasState.runOutOfStorage:
return AppLocalizations.of(context).textQuotasRunOutOfStorageContent;
}
}
}
@@ -1,15 +1,15 @@
import 'package:core/core.dart'; import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/utils/double_convert.dart'; import 'package:core/presentation/state/success.dart';
import 'package:core/presentation/utils/responsive_utils.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:jmap_dart_client/jmap/account_id.dart'; import 'package:jmap_dart_client/jmap/account_id.dart';
import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart'; import 'package:jmap_dart_client/jmap/core/capability/capability_identifier.dart';
import 'package:jmap_dart_client/jmap/core/session/session.dart'; import 'package:jmap_dart_client/jmap/quotas/quota.dart';
import 'package:jmap_dart_client/jmap/quotas/data_types.dart';
import 'package:tmail_ui_user/features/base/base_controller.dart'; import 'package:tmail_ui_user/features/base/base_controller.dart';
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart'; import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/mailbox_dashboard_controller.dart';
import 'package:tmail_ui_user/features/quotas/domain/extensions/list_quotas_extensions.dart';
import 'package:tmail_ui_user/features/quotas/domain/state/get_quotas_state.dart'; import 'package:tmail_ui_user/features/quotas/domain/state/get_quotas_state.dart';
import 'package:tmail_ui_user/features/quotas/domain/use_case/get_quotas_interactor.dart'; import 'package:tmail_ui_user/features/quotas/domain/use_case/get_quotas_interactor.dart';
import 'package:tmail_ui_user/features/quotas/presentation/model/quotas_state.dart';
import 'package:tmail_ui_user/main/error/capability_validator.dart'; import 'package:tmail_ui_user/main/error/capability_validator.dart';
class QuotasController extends BaseController { class QuotasController extends BaseController {
@@ -20,61 +20,28 @@ class QuotasController extends BaseController {
final GetQuotasInteractor _getQuotasInteractor; final GetQuotasInteractor _getQuotasInteractor;
final usedCapacity = Rx<num>(0); final octetsQuota = Rxn<Quota>();
final limitCapacity = Rx<num>(0);
final warningLimitCapacity = Rx<num>(0);
final quotasState = QuotasState.notAvailable.obs;
final warningProgressConstant = 0.9;
late Worker accountIdWorker;
double get progressUsedCapacity => limitCapacity.value != 0 late Worker accountIdListener;
? (usedCapacity.value / limitCapacity.value)
: 0;
bool get enableShowWarningQuotas =>
quotasState.value != QuotasState.notAvailable &&
(quotasState.value == QuotasState.runningOutOfStorage
|| quotasState.value == QuotasState.runOutOfStorage);
QuotasController(this._getQuotasInteractor); QuotasController(this._getQuotasInteractor);
void _getQuotasAction(AccountId accountId, Session session) { void _getQuotasAction(AccountId accountId) {
try { consumeState(_getQuotasInteractor.execute(accountId));
requireCapability(session, accountId, [CapabilityIdentifier.jmapQuota]);
consumeState(_getQuotasInteractor.execute(mailboxDashBoardController.accountId.value!));
} catch (e) {
logError('QuotasController::_getQuotasAction():$e');
}
} }
void _handleGetQuotasSuccess(GetQuotasSuccess success) { void _handleGetQuotasSuccess(GetQuotasSuccess success) {
try { octetsQuota.value = success.quotas.octetsQuota;
final quotas = success.quotas.firstWhere((e) => e.resourceType == ResourceType.octets);
if (quotas.used != null) {
usedCapacity.value = DoubleConvert.bytesToGigaBytes(quotas.used!.value);
}
if (quotas.limit != null) {
warningLimitCapacity.value = DoubleConvert.bytesToGigaBytes(quotas.limit!.value * warningProgressConstant);
limitCapacity.value = DoubleConvert.bytesToGigaBytes(quotas.limit!.value);
}
if(usedCapacity.value >= limitCapacity.value) {
quotasState.value = QuotasState.runOutOfStorage;
} else if (usedCapacity.value >= warningLimitCapacity.value) {
quotasState.value = QuotasState.runningOutOfStorage;
} else {
quotasState.value = QuotasState.normal;
}
} catch (e) {
quotasState.value = QuotasState.notAvailable;
logError('QuotasController::_handleGetQuotasSuccess():[NotFoundException]: $e');
}
} }
void _initWorker() { void _initWorker() {
accountIdWorker = ever(mailboxDashBoardController.accountId, (accountId) { accountIdListener = ever(mailboxDashBoardController.accountId, (accountId) {
if (accountId is AccountId && mailboxDashBoardController.sessionCurrent!= null) { final session = mailboxDashBoardController.sessionCurrent;
_getQuotasAction(accountId, mailboxDashBoardController.sessionCurrent!); if (accountId is AccountId &&
session != null &&
CapabilityIdentifier.jmapQuota.isSupported(session, accountId)
) {
_getQuotasAction(accountId);
} }
}); });
} }
@@ -87,7 +54,7 @@ class QuotasController extends BaseController {
@override @override
void onClose() { void onClose() {
accountIdWorker.call(); accountIdListener.dispose();
super.onClose(); super.onClose();
} }
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:tmail_ui_user/features/quotas/presentation/model/quotas_state.dart'; import 'package:tmail_ui_user/features/quotas/domain/extensions/quota_extensions.dart';
import 'package:tmail_ui_user/features/quotas/presentation/quotas_controller.dart'; import 'package:tmail_ui_user/features/quotas/presentation/quotas_controller.dart';
import 'package:tmail_ui_user/features/quotas/presentation/styles/quotas_view_styles.dart'; import 'package:tmail_ui_user/features/quotas/presentation/styles/quotas_view_styles.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart'; import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
@@ -13,7 +13,8 @@ class QuotasView extends GetWidget<QuotasController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Obx(() { return Obx(() {
if (controller.quotasState.value != QuotasState.notAvailable) { if (controller.octetsQuota.value != null && controller.octetsQuota.value!.storageAvailable) {
final octetQuota = controller.octetsQuota.value!;
return LayoutBuilder(builder: (context, constraints) { return LayoutBuilder(builder: (context, constraints) {
return Container( return Container(
padding: const EdgeInsetsDirectional.only( padding: const EdgeInsetsDirectional.only(
@@ -63,23 +64,19 @@ class QuotasView extends GetWidget<QuotasController> {
SizedBox( SizedBox(
width: _getProgressBarMaxWith(constraints.maxWidth), width: _getProgressBarMaxWith(constraints.maxWidth),
child: LinearProgressIndicator( child: LinearProgressIndicator(
color: controller.quotasState.value.getColorProgress(), color: octetQuota.getQuotasStateProgressBarColor(),
minHeight: QuotasViewStyles.progressBarHeight, minHeight: QuotasViewStyles.progressBarHeight,
backgroundColor: QuotasViewStyles.progressBarBackgroundColor, backgroundColor: QuotasViewStyles.progressBarBackgroundColor,
value: controller.progressUsedCapacity, value: octetQuota.usedStoragePercent,
), ),
), ),
const SizedBox(height: QuotasViewStyles.space), const SizedBox(height: QuotasViewStyles.space),
Text( Text(
controller.quotasState.value.getQuotasFooterText( octetQuota.getQuotasStateTitle(context),
context,
controller.usedCapacity.value,
controller.limitCapacity.value,
),
style: TextStyle( style: TextStyle(
fontSize: QuotasViewStyles.progressStateTextSize, fontSize: QuotasViewStyles.progressStateTextSize,
fontWeight: QuotasViewStyles.progressStateFontWeight, fontWeight: QuotasViewStyles.progressStateFontWeight,
color: controller.quotasState.value.getColorQuotasFooterText(), color: octetQuota.getQuotasStateTitleColor()
), ),
) )
], ],
@@ -1,59 +0,0 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/quotas/presentation/quotas_controller.dart';
class QuotasWarningBannerWidget extends GetWidget<QuotasController> {
const QuotasWarningBannerWidget({this.margin ,Key? key}) : super(key: key);
final EdgeInsets? margin;
@override
Widget build(BuildContext context) {
return Obx(
() => controller.enableShowWarningQuotas
? Container(
padding: const EdgeInsets.all(16),
margin: margin ?? const EdgeInsets.only(left: 12, right: 12, bottom: 12),
decoration: BoxDecoration(
color: controller.quotasState.value.getBackgroundColorWarningBanner(),
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
child: Row(
children: [
SvgPicture.asset(controller.quotasState.value.getIconWarningBanner(controller.imagePaths)),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
controller.quotasState.value.getTitleWarningBanner(
context,
controller.progressUsedCapacity,
),
style: const TextStyle(
fontSize: 17,
fontWeight: FontWeight.w700,
color: AppColor.colorTitleQuotasWarning,
),
),
const SizedBox(height: 8),
Text(
controller.quotasState.value.getContentWarningBanner(context),
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: AppColor.loginTextFieldHintColor,
),
),
],
),
),
],
),
)
: const SizedBox.shrink(),
);
}
}
@@ -15,7 +15,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/mixin/filt
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart'; import 'package:tmail_ui_user/features/manage_account/presentation/vacation/widgets/vacation_notification_message_widget.dart';
import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_banner_widget.dart'; import 'package:tmail_ui_user/features/network_connection/presentation/network_connection_banner_widget.dart';
import 'package:tmail_ui_user/features/quotas/presentation/widget/quotas_warning_banner_widget.dart'; import 'package:tmail_ui_user/features/quotas/presentation/widget/quotas_banner_widget.dart';
import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart'; import 'package:tmail_ui_user/features/thread/domain/model/filter_message_option.dart';
import 'package:tmail_ui_user/features/thread/domain/state/search_email_state.dart'; import 'package:tmail_ui_user/features/thread/domain/state/search_email_state.dart';
import 'package:tmail_ui_user/features/thread/domain/state/search_more_email_state.dart'; import 'package:tmail_ui_user/features/thread/domain/state/search_more_email_state.dart';
@@ -76,7 +76,7 @@ class ThreadView extends GetWidget<ThreadController>
}), }),
_buildSearchBarView(context), _buildSearchBarView(context),
const SpamReportBannerWidget(), const SpamReportBannerWidget(),
const QuotasWarningBannerWidget(), const QuotasBannerWidget(),
_buildVacationNotificationMessage(context), _buildVacationNotificationMessage(context),
], ],
Obx(() { Obx(() {
@@ -139,7 +139,7 @@ class ThreadView extends GetWidget<ThreadController>
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 16, horizontal: 16,
vertical: _responsiveUtils.isWebNotDesktop(context) ? 8 : 0), vertical: _responsiveUtils.isWebNotDesktop(context) ? 8 : 0),
margin: EdgeInsets.only(bottom: PlatformInfo.isMobile ? 16 : 0), margin: EdgeInsets.only(bottom: PlatformInfo.isMobile ? 8 : 0),
child: SearchBarView(_imagePaths, child: SearchBarView(_imagePaths,
hintTextSearch: AppLocalizations.of(context).search_emails, hintTextSearch: AppLocalizations.of(context).search_emails,
onOpenSearchViewAction: controller.goToSearchView)); onOpenSearchViewAction: controller.goToSearchView));
@@ -503,7 +503,7 @@ class ThreadView extends GetWidget<ThreadController>
double? _getItemExtent(BuildContext context) { double? _getItemExtent(BuildContext context) {
if (PlatformInfo.isWeb) { if (PlatformInfo.isWeb) {
return _responsiveUtils.isDesktop(context) ? 52 : 95; return _responsiveUtils.isDesktop(context) ? 52 : 98;
} else { } else {
return null; return null;
} }
+1 -1
View File
@@ -3110,7 +3110,7 @@
"placeholders_order": [], "placeholders_order": [],
"placeholders": {} "placeholders": {}
}, },
"quotaWarningBannerTitle": "You are running out of storage (99%).", "quotaWarningBannerTitle": "You are running out of storage (90%).",
"@quotaWarningBannerTitle": { "@quotaWarningBannerTitle": {
"type": "text", "type": "text",
"placeholders_order": [], "placeholders_order": [],
@@ -3215,7 +3215,7 @@ class AppLocalizations {
String get quotaWarningBannerTitle { String get quotaWarningBannerTitle {
return Intl.message( return Intl.message(
'You are running out of storage (99%).', 'You are running out of storage (90%).',
name: 'quotaWarningBannerTitle' name: 'quotaWarningBannerTitle'
); );
} }