TF-2064 Handle limit storage to show warning banner
(cherry picked from commit 3e36cebd5cbe880f9832c62463e71979e15e1741)
This commit is contained in:
@@ -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/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/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/mailbox/presentation/search_mailbox_view.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: [
|
||||
const SpamReportBannerWebWidget(),
|
||||
const QuotasBannerWidget(),
|
||||
_buildVacationNotificationMessage(context),
|
||||
Obx(() {
|
||||
if (controller.isEmptyTrashBannerEnabledOnWeb(context)) {
|
||||
return Padding(
|
||||
@@ -148,14 +150,6 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||
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),
|
||||
_buildMarkAsMailboxReadLoading(context),
|
||||
Expanded(child: Obx(() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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 {
|
||||
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/quotas/quota.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/domain/model/quotas_response.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
|
||||
|
||||
class QuotasDataSourceImpl extends QuotasDataSource{
|
||||
class QuotasDataSourceImpl extends QuotasDataSource {
|
||||
final QuotasAPI _quotasAPI;
|
||||
final ExceptionThrower _exceptionThrower;
|
||||
|
||||
QuotasDataSourceImpl(this._quotasAPI, this._exceptionThrower);
|
||||
|
||||
@override
|
||||
Future<QuotasResponse> getQuotas(AccountId accountId) {
|
||||
Future<List<Quota>> getQuotas(AccountId accountId) {
|
||||
return Future.sync(() async {
|
||||
return await _quotasAPI.getQuotas(accountId);
|
||||
}).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/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/quota.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 {
|
||||
final HttpClient _httpClient;
|
||||
|
||||
QuotasAPI(this._httpClient);
|
||||
|
||||
Future<QuotasResponse> getQuotas(AccountId accountId) async {
|
||||
final requestBuilder =
|
||||
JmapRequestBuilder(_httpClient, ProcessingInvocation());
|
||||
Future<List<Quota>> getQuotas(AccountId accountId) async {
|
||||
final requestBuilder = JmapRequestBuilder(_httpClient, ProcessingInvocation());
|
||||
final getQuotaMethod = GetQuotaMethod(accountId);
|
||||
final getQuotaInvocation = requestBuilder.invocation(getQuotaMethod);
|
||||
final response = await (requestBuilder
|
||||
..usings(getQuotaMethod.requiredCapabilities))
|
||||
.build()
|
||||
.execute();
|
||||
..usings(getQuotaMethod.requiredCapabilities))
|
||||
.build()
|
||||
.execute();
|
||||
|
||||
final getQuotaResponse = response.parse<GetQuotaResponse>(
|
||||
getQuotaInvocation.methodCallId,
|
||||
GetQuotaResponse.deserialize,
|
||||
);
|
||||
|
||||
if(getQuotaResponse != null) {
|
||||
return QuotasResponse(
|
||||
accountId: getQuotaResponse.accountId,
|
||||
notFound: getQuotaResponse.notFound,
|
||||
quotas: getQuotaResponse.list,
|
||||
state: getQuotaResponse.state,
|
||||
);
|
||||
if (getQuotaResponse?.list.isNotEmpty == true) {
|
||||
return getQuotaResponse!.list;
|
||||
} else {
|
||||
throw NotFoundQuotasException();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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/domain/model/quotas_response.dart';
|
||||
import 'package:tmail_ui_user/features/quotas/domain/repository/quotas_repository.dart';
|
||||
|
||||
class QuotasRepositoryImpl extends QuotasRepository {
|
||||
@@ -9,7 +9,7 @@ class QuotasRepositoryImpl extends QuotasRepository {
|
||||
QuotasRepositoryImpl(this._dataSource);
|
||||
|
||||
@override
|
||||
Future<QuotasResponse> getQuotas(AccountId accountId) {
|
||||
Future<List<Quota>> getQuotas(AccountId 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:tmail_ui_user/features/quotas/domain/model/quotas_response.dart';
|
||||
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
|
||||
|
||||
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:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/quotas/quota.dart';
|
||||
|
||||
class GetQuotasLoading extends LoadingState {}
|
||||
|
||||
class GetQuotasSuccess extends UIState {
|
||||
final List<Quota> quotas;
|
||||
final State? state;
|
||||
|
||||
GetQuotasSuccess(this.quotas, this.state);
|
||||
GetQuotasSuccess(this.quotas);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
quotas,
|
||||
state,
|
||||
];
|
||||
List<Object?> get props => [quotas];
|
||||
}
|
||||
|
||||
class GetQuotasFailure extends FeatureFailure {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:core';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.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* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingState());
|
||||
final response = await quotasRepository.getQuotas(accountId);
|
||||
yield Right(GetQuotasSuccess(response.quotas, response.state));
|
||||
yield Right<Failure, Success>(GetQuotasLoading());
|
||||
final listQuotas = await quotasRepository.getQuotas(accountId);
|
||||
yield Right(GetQuotasSuccess(listQuotas));
|
||||
} catch (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/utils/double_convert.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:get/get.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/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/quotas/data_types.dart';
|
||||
import 'package:jmap_dart_client/jmap/quotas/quota.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/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/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';
|
||||
|
||||
class QuotasController extends BaseController {
|
||||
@@ -20,61 +20,28 @@ class QuotasController extends BaseController {
|
||||
|
||||
final GetQuotasInteractor _getQuotasInteractor;
|
||||
|
||||
final usedCapacity = Rx<num>(0);
|
||||
final limitCapacity = Rx<num>(0);
|
||||
final warningLimitCapacity = Rx<num>(0);
|
||||
final quotasState = QuotasState.notAvailable.obs;
|
||||
final warningProgressConstant = 0.9;
|
||||
late Worker accountIdWorker;
|
||||
final octetsQuota = Rxn<Quota>();
|
||||
|
||||
double get progressUsedCapacity => limitCapacity.value != 0
|
||||
? (usedCapacity.value / limitCapacity.value)
|
||||
: 0;
|
||||
|
||||
bool get enableShowWarningQuotas =>
|
||||
quotasState.value != QuotasState.notAvailable &&
|
||||
(quotasState.value == QuotasState.runningOutOfStorage
|
||||
|| quotasState.value == QuotasState.runOutOfStorage);
|
||||
late Worker accountIdListener;
|
||||
|
||||
QuotasController(this._getQuotasInteractor);
|
||||
|
||||
void _getQuotasAction(AccountId accountId, Session session) {
|
||||
try {
|
||||
requireCapability(session, accountId, [CapabilityIdentifier.jmapQuota]);
|
||||
consumeState(_getQuotasInteractor.execute(mailboxDashBoardController.accountId.value!));
|
||||
} catch (e) {
|
||||
logError('QuotasController::_getQuotasAction():$e');
|
||||
}
|
||||
void _getQuotasAction(AccountId accountId) {
|
||||
consumeState(_getQuotasInteractor.execute(accountId));
|
||||
}
|
||||
|
||||
void _handleGetQuotasSuccess(GetQuotasSuccess success) {
|
||||
try {
|
||||
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');
|
||||
}
|
||||
octetsQuota.value = success.quotas.octetsQuota;
|
||||
}
|
||||
|
||||
void _initWorker() {
|
||||
accountIdWorker = ever(mailboxDashBoardController.accountId, (accountId) {
|
||||
if (accountId is AccountId && mailboxDashBoardController.sessionCurrent!= null) {
|
||||
_getQuotasAction(accountId, mailboxDashBoardController.sessionCurrent!);
|
||||
accountIdListener = ever(mailboxDashBoardController.accountId, (accountId) {
|
||||
final session = mailboxDashBoardController.sessionCurrent;
|
||||
if (accountId is AccountId &&
|
||||
session != null &&
|
||||
CapabilityIdentifier.jmapQuota.isSupported(session, accountId)
|
||||
) {
|
||||
_getQuotasAction(accountId);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -87,7 +54,7 @@ class QuotasController extends BaseController {
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
accountIdWorker.call();
|
||||
accountIdListener.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
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/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/styles/quotas_view_styles.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
@@ -13,7 +13,8 @@ class QuotasView extends GetWidget<QuotasController> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
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 Container(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
@@ -63,23 +64,19 @@ class QuotasView extends GetWidget<QuotasController> {
|
||||
SizedBox(
|
||||
width: _getProgressBarMaxWith(constraints.maxWidth),
|
||||
child: LinearProgressIndicator(
|
||||
color: controller.quotasState.value.getColorProgress(),
|
||||
color: octetQuota.getQuotasStateProgressBarColor(),
|
||||
minHeight: QuotasViewStyles.progressBarHeight,
|
||||
backgroundColor: QuotasViewStyles.progressBarBackgroundColor,
|
||||
value: controller.progressUsedCapacity,
|
||||
value: octetQuota.usedStoragePercent,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: QuotasViewStyles.space),
|
||||
Text(
|
||||
controller.quotasState.value.getQuotasFooterText(
|
||||
context,
|
||||
controller.usedCapacity.value,
|
||||
controller.limitCapacity.value,
|
||||
),
|
||||
octetQuota.getQuotasStateTitle(context),
|
||||
style: TextStyle(
|
||||
fontSize: QuotasViewStyles.progressStateTextSize,
|
||||
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/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/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/state/search_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),
|
||||
const SpamReportBannerWidget(),
|
||||
const QuotasWarningBannerWidget(),
|
||||
const QuotasBannerWidget(),
|
||||
_buildVacationNotificationMessage(context),
|
||||
],
|
||||
Obx(() {
|
||||
@@ -139,7 +139,7 @@ class ThreadView extends GetWidget<ThreadController>
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
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,
|
||||
hintTextSearch: AppLocalizations.of(context).search_emails,
|
||||
onOpenSearchViewAction: controller.goToSearchView));
|
||||
@@ -503,7 +503,7 @@ class ThreadView extends GetWidget<ThreadController>
|
||||
|
||||
double? _getItemExtent(BuildContext context) {
|
||||
if (PlatformInfo.isWeb) {
|
||||
return _responsiveUtils.isDesktop(context) ? 52 : 95;
|
||||
return _responsiveUtils.isDesktop(context) ? 52 : 98;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -3110,7 +3110,7 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"quotaWarningBannerTitle": "You are running out of storage (99%).",
|
||||
"quotaWarningBannerTitle": "You are running out of storage (90%).",
|
||||
"@quotaWarningBannerTitle": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
|
||||
@@ -3215,7 +3215,7 @@ class AppLocalizations {
|
||||
|
||||
String get quotaWarningBannerTitle {
|
||||
return Intl.message(
|
||||
'You are running out of storage (99%).',
|
||||
'You are running out of storage (90%).',
|
||||
name: 'quotaWarningBannerTitle'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user