TF-1014: add quotas out of storage
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.8613 2.28571C20.619 2.28571 21.3458 2.58673 21.8816 3.12254L28.8774 10.1183C29.4132 10.6542 29.7142 11.3809 29.7142 12.1386V19.8613C29.7142 20.6191 29.4132 21.3458 28.8774 21.8816L21.8816 28.8774C21.3458 29.4133 20.619 29.7143 19.8613 29.7143H12.1386C11.3808 29.7143 10.6541 29.4133 10.1183 28.8774L3.12248 21.8816C2.58666 21.3458 2.28564 20.6191 2.28564 19.8613V12.1386C2.28564 11.3809 2.58666 10.6542 3.12248 10.1183L10.1183 3.12254C10.6541 2.58673 11.3808 2.28571 12.1386 2.28571H19.8613ZM19.8613 4.57142H12.1386C11.987 4.57142 11.8417 4.63162 11.7345 4.73879L4.73873 11.7346C4.63156 11.8417 4.57136 11.9871 4.57136 12.1386V19.8613C4.57136 20.0129 4.63156 20.1582 4.73873 20.2654L11.7345 27.2612C11.8417 27.3684 11.987 27.4286 12.1386 27.4286H19.8613C20.0128 27.4286 20.1582 27.3684 20.2653 27.2612L27.2611 20.2654C27.3683 20.1582 27.4285 20.0129 27.4285 19.8613V12.1386C27.4285 11.9871 27.3683 11.8417 27.2611 11.7346L20.2653 4.73879C20.1582 4.63162 20.0128 4.57142 19.8613 4.57142ZM15.9999 19.2001L16.1403 19.2072C16.8317 19.2774 17.3714 19.8614 17.3714 20.5714C17.3714 21.3288 16.7574 21.9427 16 21.9427L15.8597 21.9356C15.1682 21.8654 14.6286 21.2814 14.6286 20.5714C14.6286 19.8141 15.2426 19.2001 15.9999 19.2001ZM15.9999 9.14285C16.6311 9.14285 17.1428 9.65452 17.1428 10.2857V16C17.1428 16.6312 16.6311 17.1428 15.9999 17.1428C15.3687 17.1428 14.8571 16.6312 14.8571 16V10.2857C14.8571 9.65452 15.3687 9.14285 15.9999 9.14285Z" fill="#007AFF"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -166,6 +166,7 @@ extension AppColor on Color {
|
||||
static const colorBackgroundQuotasWarning = Color(0xFFFFC107);
|
||||
static const colorTitleQuotasWarning = Color(0xFFF05C44);
|
||||
static const colorProgressQuotasWarning = Color(0xFFFFA000);
|
||||
static const colorOutOfStorageQuotasWarning = Color(0xffE64646);
|
||||
|
||||
static const mapGradientColor = [
|
||||
[Color(0xFF21D4FD), Color(0xFFB721FF)],
|
||||
|
||||
@@ -174,6 +174,7 @@ class ImagePaths {
|
||||
String get icDeleteRecipient => _getImagePath('ic_delete_recipient.svg');
|
||||
String get icQuotas => _getImagePath('ic_quotas.svg');
|
||||
String get icQuotasWarning => _getImagePath('ic_quotas_warning.svg');
|
||||
String get icQuotasOutOfStorage => _getImagePath('ic_quotas_out_of_storage.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
@@ -15,7 +15,6 @@ import 'package:tmail_ui_user/features/email/presentation/widgets/bottom_bar_mai
|
||||
import 'package:tmail_ui_user/features/email/presentation/widgets/email_action_cupertino_action_sheet_action_builder.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/main/localizations/app_localizations.dart';
|
||||
|
||||
class EmailView extends GetWidget<SingleEmailController> {
|
||||
@@ -89,7 +88,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
Widget _buildEmailView(BuildContext context, PresentationEmail email) {
|
||||
return Column(children: [
|
||||
_buildAppBar(context, email),
|
||||
const QuotasWarningBannerWidget(),
|
||||
_buildVacationNotificationMessage(context),
|
||||
const Divider(color: AppColor.colorDividerHorizontal, height: 1),
|
||||
Expanded(
|
||||
|
||||
@@ -41,36 +41,44 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
child: Drawer(
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Stack(children: [
|
||||
Column(children: [
|
||||
_buildHeaderMailbox(context),
|
||||
Obx(() => controller.isSearchActive()
|
||||
? SafeArea(bottom: false, top: false, right: false,
|
||||
child: _buildInputSearchFormWidget(context))
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Obx(() => Container(
|
||||
color: controller.isSearchActive()
|
||||
? Colors.white
|
||||
: AppColor.colorBgMailbox,
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
child: SafeArea(top: false, right: false,
|
||||
bottom: !controller.isSelectionEnabled(),
|
||||
child: controller.isSearchActive()
|
||||
? _buildListMailboxSearched(context)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: _responsiveUtils.isLandscapeMobile(context)
|
||||
|| controller.isSelectionEnabled() ? 0 : 55),
|
||||
child: _buildListMailbox(context))
|
||||
)
|
||||
),
|
||||
))),
|
||||
Obx(() => controller.isSelectionEnabled()
|
||||
? _buildOptionSelectionMailbox(context)
|
||||
: const SizedBox.shrink()),
|
||||
]),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(children: [
|
||||
_buildHeaderMailbox(context),
|
||||
Obx(() => controller.isSearchActive()
|
||||
? SafeArea(bottom: false, top: false, right: false,
|
||||
child: _buildInputSearchFormWidget(context))
|
||||
: const SizedBox.shrink()),
|
||||
Expanded(child: Obx(() => Container(
|
||||
color: controller.isSearchActive()
|
||||
? Colors.white
|
||||
: AppColor.colorBgMailbox,
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.primaryColor,
|
||||
onRefresh: () async => controller.refreshAllMailbox(),
|
||||
child: SafeArea(top: false, right: false,
|
||||
bottom: !controller.isSelectionEnabled(),
|
||||
child: controller.isSearchActive()
|
||||
? _buildListMailboxSearched(context)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: _responsiveUtils.isLandscapeMobile(context)
|
||||
|| controller.isSelectionEnabled() ? 0 : 24),
|
||||
child: _buildListMailbox(context))
|
||||
)
|
||||
),
|
||||
))),
|
||||
Obx(() => controller.isSelectionEnabled()
|
||||
? _buildOptionSelectionMailbox(context)
|
||||
: const SizedBox.shrink()),
|
||||
]),
|
||||
),
|
||||
Obx(() => controller.isSelectionEnabled()
|
||||
? const SizedBox.shrink()
|
||||
: const QuotasFooterWidget(padding: EdgeInsets.only(left: 24, right: 24, bottom: 8)),
|
||||
),
|
||||
Obx(() {
|
||||
final appInformation = controller.mailboxDashBoardController.appInformation.value;
|
||||
if (appInformation != null
|
||||
@@ -85,7 +93,7 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
})
|
||||
]),
|
||||
)
|
||||
)
|
||||
@@ -229,7 +237,6 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
Obx(() => controller.folderMailboxTree.value.root.childrenItems?.isNotEmpty ?? false
|
||||
? _buildMailboxCategory(context, MailboxCategories.folders, controller.folderMailboxTree.value.root)
|
||||
: const SizedBox.shrink()),
|
||||
const QuotasFooterWidget(),
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -390,13 +397,18 @@ class MailboxView extends GetWidget<MailboxController> {
|
||||
}
|
||||
|
||||
Widget _buildVersionInformation(BuildContext context, PackageInfo packageInfo) {
|
||||
return SafeArea(child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: Text(
|
||||
'${AppLocalizations.of(context).version} ${packageInfo.version}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 16, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500),
|
||||
return SafeArea(
|
||||
top: false,
|
||||
child: Container(
|
||||
color: AppColor.colorBgMailbox,
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: Text(
|
||||
'${AppLocalizations.of(context).version} ${packageInfo.version}',
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(fontSize: 16, color: AppColor.colorContentEmail, fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class StorageWidgetBuilder {
|
||||
final BuildContext _context;
|
||||
|
||||
StorageWidgetBuilder(this._context);
|
||||
|
||||
Widget build() {
|
||||
return Container(
|
||||
key: const Key('storage_widget'),
|
||||
padding: const EdgeInsets.only(left: 40, top: 16, bottom: 20, right: 40),
|
||||
color: AppColor.storageBackgroundColor,
|
||||
alignment: Alignment.bottomLeft,
|
||||
height: 100,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(_context).storage,
|
||||
maxLines: 1,
|
||||
style: const TextStyle(fontSize: 12, color: AppColor.storageTitleColor, fontWeight: FontWeight.w500)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: RichText(
|
||||
text: const TextSpan(
|
||||
style: TextStyle(fontSize: 16, color: AppColor.storageMaxSizeColor, fontWeight: FontWeight.w700),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '299.6MB',
|
||||
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16, color: AppColor.storageUseSizeColor)),
|
||||
TextSpan(
|
||||
text: ' / unlimited',
|
||||
style: TextStyle(fontWeight: FontWeight.w700, fontSize: 16, color: AppColor.storageMaxSizeColor))
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,9 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||
SizedBox(child: MailboxView(), width: responsiveUtils.defaultSizeMenu),
|
||||
Expanded(child: Column(children: [
|
||||
_buildEmptyTrashButton(context),
|
||||
const QuotasWarningBannerWidget(),
|
||||
const QuotasWarningBannerWidget(
|
||||
margin: EdgeInsets.only(right: 16, top: 8),
|
||||
),
|
||||
_buildVacationNotificationMessage(context),
|
||||
_buildListButtonQuickSearchFilter(context),
|
||||
_buildMarkAsMailboxReadLoading(context),
|
||||
|
||||
@@ -20,7 +20,6 @@ import 'package:tmail_ui_user/features/manage_account/presentation/menu/settings
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/model/account_menu_item.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/profiles/profiles_view.dart';
|
||||
import 'package:tmail_ui_user/features/manage_account/presentation/vacation/vacation_view.dart';
|
||||
import 'package:tmail_ui_user/features/quotas/presentation/widget/quotas_warning_banner_widget.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
@@ -86,7 +85,6 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
|
||||
Expanded(child: Container(
|
||||
color: AppColor.colorBgDesktop,
|
||||
child: Column(children: [
|
||||
const QuotasWarningBannerWidget(),
|
||||
Obx(() {
|
||||
if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
|
||||
return VacationNotificationMessageWidget(
|
||||
|
||||
@@ -22,7 +22,9 @@ class QuotasAPI {
|
||||
.execute();
|
||||
|
||||
final getQuotaResponse = response.parse<GetQuotaResponse>(
|
||||
getQuotaInvocation.methodCallId, GetQuotaResponse.deserialize);
|
||||
getQuotaInvocation.methodCallId,
|
||||
GetQuotaResponse.deserialize,
|
||||
);
|
||||
|
||||
if(getQuotaResponse != null) {
|
||||
return QuotasResponse(
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
enum QuotasState {
|
||||
normal,
|
||||
runningOutOfStorage,
|
||||
runOutOfStorage;
|
||||
|
||||
Color getColorProgress() {
|
||||
switch(this) {
|
||||
case QuotasState.normal:
|
||||
return AppColor.primaryColor;
|
||||
case QuotasState.runningOutOfStorage:
|
||||
return AppColor.colorProgressQuotasWarning;
|
||||
case QuotasState.runOutOfStorage:
|
||||
return AppColor.colorOutOfStorageQuotasWarning;
|
||||
}
|
||||
}
|
||||
|
||||
Color getColorQuotasFooterText() {
|
||||
switch(this) {
|
||||
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.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.normal:
|
||||
case QuotasState.runningOutOfStorage:
|
||||
return imagePaths.icQuotasWarning;
|
||||
case QuotasState.runOutOfStorage:
|
||||
return imagePaths.icQuotasOutOfStorage;
|
||||
}
|
||||
}
|
||||
|
||||
Color getBackgroundColorWarningBanner() {
|
||||
switch(this) {
|
||||
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.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.normal:
|
||||
case QuotasState.runningOutOfStorage:
|
||||
return AppLocalizations.of(context).textQuotasRunningOutOfStorageContent;
|
||||
case QuotasState.runOutOfStorage:
|
||||
return AppLocalizations.of(context).textQuotasRunOutOfStorageContent;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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/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';
|
||||
|
||||
class QuotasController extends BaseController {
|
||||
final MailboxDashBoardController mailboxDashBoardController = Get.find<MailboxDashBoardController>();
|
||||
@@ -15,6 +16,7 @@ class QuotasController extends BaseController {
|
||||
final softLimitCapacity = Rx<num>(0);
|
||||
final warningLimitCapacity = Rx<num>(0);
|
||||
final enableShowQuotas = false.obs;
|
||||
final quotasState = QuotasState.normal.obs;
|
||||
late Worker accountIdWorker;
|
||||
|
||||
double get progressUsedCapacity => softLimitCapacity.value != 0
|
||||
@@ -22,7 +24,9 @@ class QuotasController extends BaseController {
|
||||
: 0;
|
||||
|
||||
bool get enableShowWarningQuotas =>
|
||||
enableShowQuotas.value && usedCapacity.value >= warningLimitCapacity.value;
|
||||
enableShowQuotas.isTrue &&
|
||||
(quotasState.value == QuotasState.runningOutOfStorage
|
||||
|| quotasState.value == QuotasState.runOutOfStorage);
|
||||
|
||||
final ImagePaths imagePaths = Get.find<ImagePaths>();
|
||||
final ResponsiveUtils responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
@@ -32,27 +36,33 @@ class QuotasController extends BaseController {
|
||||
void _initWorker() {
|
||||
accountIdWorker = ever(mailboxDashBoardController.accountId, (accountId) {
|
||||
if (accountId is AccountId) {
|
||||
enableShowQuotas.value = mailboxDashBoardController.sessionCurrent != null &&
|
||||
mailboxDashBoardController.sessionCurrent!.capabilities.containsValue(CapabilityIdentifier.jmapQuota);
|
||||
consumeState(_getQuotasInteractor.execute(mailboxDashBoardController.accountId.value!));
|
||||
_getQuotasAction(accountId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _getQuotasAction(AccountId accountId) {
|
||||
enableShowQuotas.value = mailboxDashBoardController.sessionCurrent != null &&
|
||||
mailboxDashBoardController.sessionCurrent!.capabilities.containsValue(CapabilityIdentifier.jmapQuota);
|
||||
|
||||
if(enableShowQuotas.isTrue) {
|
||||
consumeState(_getQuotasInteractor.execute(mailboxDashBoardController.accountId.value!));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onDone() {
|
||||
viewState.value.fold(
|
||||
(failure) {
|
||||
if (failure is GetQuotasFailure) {
|
||||
logError('QuotasController::onDone():[GetQuotasFailure]: ${failure.exception}');
|
||||
}
|
||||
},
|
||||
(success) {
|
||||
if (success is GetQuotasSuccess) {
|
||||
_handleGetQuotasSuccess(success);
|
||||
}
|
||||
(failure) {
|
||||
if (failure is GetQuotasFailure) {
|
||||
logError('QuotasController::onDone():[GetQuotasFailure]: ${failure.exception}');
|
||||
}
|
||||
},
|
||||
(success) {
|
||||
if (success is GetQuotasSuccess) {
|
||||
_handleGetQuotasSuccess(success);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -62,10 +72,16 @@ class QuotasController extends BaseController {
|
||||
usedCapacity.value = quotas.used.value;
|
||||
warningLimitCapacity.value = quotas.warnLimit?.value ?? 0;
|
||||
softLimitCapacity.value = quotas.softLimit?.value ?? 0;
|
||||
if(usedCapacity.value >= softLimitCapacity.value) {
|
||||
quotasState.value = QuotasState.runOutOfStorage;
|
||||
} else if (usedCapacity.value >= warningLimitCapacity.value) {
|
||||
quotasState.value = QuotasState.runningOutOfStorage;
|
||||
} else {
|
||||
quotasState.value = QuotasState.normal;
|
||||
}
|
||||
} catch (e) {
|
||||
logError('QuotasController::_handleGetQuotasSuccess():[NotFoundException]: $e');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -6,15 +6,15 @@ import 'package:tmail_ui_user/features/quotas/presentation/quotas_controller.dar
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class QuotasFooterWidget extends GetWidget<QuotasController> {
|
||||
const QuotasFooterWidget({Key? key}) : super(key: key);
|
||||
|
||||
const QuotasFooterWidget({Key? key, this.padding}) : super(key: key);
|
||||
final EdgeInsetsGeometry? padding;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() => controller.enableShowQuotas.value
|
||||
? Container(
|
||||
color: AppColor.colorBgDesktop,
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: padding ?? const EdgeInsets.all(24),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: IntrinsicWidth(
|
||||
child: Column(
|
||||
@@ -36,21 +36,23 @@ class QuotasFooterWidget extends GetWidget<QuotasController> {
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
LinearProgressIndicator(
|
||||
color: controller.enableShowWarningQuotas ? AppColor.colorProgressQuotasWarning: AppColor.primaryColor,
|
||||
color: controller.quotasState.value.getColorProgress(),
|
||||
minHeight: 3,
|
||||
backgroundColor: AppColor.colorDivider,
|
||||
value: controller.progressUsedCapacity,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
AppLocalizations.of(context).textQuotasUsed(
|
||||
controller.quotasState.value.getQuotasFooterText(
|
||||
context,
|
||||
controller.usedCapacity.value,
|
||||
controller.softLimitCapacity.value,
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColor.loginTextFieldHintColor),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: controller.quotasState.value.getColorQuotasFooterText(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,10 +3,10 @@ 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';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
class QuotasWarningBannerWidget extends GetWidget<QuotasController> {
|
||||
const QuotasWarningBannerWidget({Key? key}) : super(key: key);
|
||||
const QuotasWarningBannerWidget({this.margin ,Key? key}) : super(key: key);
|
||||
final EdgeInsetsGeometry? margin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -14,36 +14,38 @@ class QuotasWarningBannerWidget extends GetWidget<QuotasController> {
|
||||
() => controller.enableShowWarningQuotas
|
||||
? Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
margin: const EdgeInsets.only(left: 12, right: 12, top: 8),
|
||||
margin: margin ?? const EdgeInsets.only(left: 12, right: 12, top: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.colorBackgroundQuotasWarning.withOpacity(0.12),
|
||||
color: controller.quotasState.value.getBackgroundColorWarningBanner(),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(10)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SvgPicture.asset(controller.imagePaths.icQuotasWarning),
|
||||
SvgPicture.asset(controller.quotasState.value.getIconWarningBanner(controller.imagePaths)),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.textQuotasWarningTitle(controller.progressUsedCapacity *100),
|
||||
controller.quotasState.value.getTitleWarningBanner(
|
||||
context,
|
||||
controller.progressUsedCapacity,
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColor.colorTitleQuotasWarning,
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColor.colorTitleQuotasWarning,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.textQuotasWarningContent,
|
||||
controller.quotasState.value.getContentWarningBanner(context),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColor.loginTextFieldHintColor),
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: AppColor.loginTextFieldHintColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
"@@last_modified": "2022-11-08T16:55:51.988372",
|
||||
=======
|
||||
"@@last_modified": "2022-11-09T17:10:23.172672",
|
||||
>>>>>>> 24967b2c (TF-1014: [Dev] Show quota at the bottom of mailbox)
|
||||
=======
|
||||
"@@last_modified": "2022-11-10T10:33:41.637215",
|
||||
>>>>>>> 1ad5dd5c (TF-1014: add quotas out of storage)
|
||||
"initializing_data": "Initializing data...",
|
||||
"@initializing_data": {
|
||||
"type": "text",
|
||||
@@ -124,12 +128,6 @@
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"storage": "STORAGE",
|
||||
"@storage": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"myFolders": "My Folders",
|
||||
"@myFolders": {
|
||||
"type": "text",
|
||||
@@ -2473,8 +2471,8 @@
|
||||
"softLimit": {}
|
||||
}
|
||||
},
|
||||
"textQuotasWarningTitle": "You are running out of storage ({progress}%).",
|
||||
"@textQuotasWarningTitle": {
|
||||
"textQuotasRunningOutOfStorageTitle": "You are running out of storage ({progress}%).",
|
||||
"@textQuotasRunningOutOfStorageTitle": {
|
||||
"type": "text",
|
||||
"placeholders_order": [
|
||||
"progress"
|
||||
@@ -2483,5 +2481,29 @@
|
||||
"progress": {}
|
||||
>>>>>>> 24967b2c (TF-1014: [Dev] Show quota at the bottom of mailbox)
|
||||
}
|
||||
},
|
||||
"textQuotasRunningOutOfStorageContent": "Soon you won't be able to email in Team Mail. Please clean your storage or upgrade your storage to get full features in Team Mail.",
|
||||
"@textQuotasRunningOutOfStorageContent": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"textQuotasOutOfStorage": "Out of storage",
|
||||
"@textQuotasOutOfStorage": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"textQuotasRunOutOfStorageTitle": "You have run out of storage space",
|
||||
"@textQuotasRunOutOfStorageTitle": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
},
|
||||
"textQuotasRunOutOfStorageContent": "Now you temporarily can't send or get an email. Please free up or upgrade your storage to get the full features of Team Mail.",
|
||||
"@textQuotasRunOutOfStorageContent": {
|
||||
"type": "text",
|
||||
"placeholders_order": [],
|
||||
"placeholders": {}
|
||||
}
|
||||
}
|
||||
@@ -117,13 +117,6 @@ class AppLocalizations {
|
||||
);
|
||||
}
|
||||
|
||||
String get storage {
|
||||
return Intl.message(
|
||||
'STORAGE',
|
||||
name: 'storage',
|
||||
);
|
||||
}
|
||||
|
||||
String get myFolders {
|
||||
return Intl.message(
|
||||
'My Folders',
|
||||
@@ -2527,7 +2520,7 @@ class AppLocalizations {
|
||||
);
|
||||
}
|
||||
|
||||
String textQuotasUsed(num used, num softLimit) {
|
||||
String textQuotasUsed(double used, double softLimit) {
|
||||
return Intl.message(
|
||||
'$used GB of $softLimit GB Used',
|
||||
name: 'textQuotasUsed',
|
||||
@@ -2535,18 +2528,39 @@ class AppLocalizations {
|
||||
);
|
||||
}
|
||||
|
||||
String textQuotasWarningTitle(num progress) {
|
||||
String textQuotasRunningOutOfStorageTitle(double progress) {
|
||||
return Intl.message(
|
||||
'You are running out of storage ($progress%).',
|
||||
name: 'textQuotasWarningTitle',
|
||||
name: 'textQuotasRunningOutOfStorageTitle',
|
||||
args: [progress],
|
||||
);
|
||||
}
|
||||
|
||||
String get textQuotasWarningContent {
|
||||
String get textQuotasRunningOutOfStorageContent {
|
||||
return Intl.message(
|
||||
"Soon you won't be able to email in Tmail. Please clean your storage or upgrade your storage to get full features in Tmail.",
|
||||
name: 'textQuotasWarningTitle',
|
||||
"Soon you won't be able to email in Team Mail. Please clean your storage or upgrade your storage to get full features in Team Mail.",
|
||||
name: 'textQuotasRunningOutOfStorageContent',
|
||||
);
|
||||
}
|
||||
|
||||
String get textQuotasOutOfStorage {
|
||||
return Intl.message(
|
||||
'Out of storage',
|
||||
name: 'textQuotasOutOfStorage',
|
||||
);
|
||||
}
|
||||
|
||||
String get textQuotasRunOutOfStorageTitle {
|
||||
return Intl.message(
|
||||
'You have run out of storage space',
|
||||
name: 'textQuotasRunOutOfStorageTitle',
|
||||
);
|
||||
}
|
||||
|
||||
String get textQuotasRunOutOfStorageContent {
|
||||
return Intl.message(
|
||||
"Now you temporarily can't send or get an email. Please free up or upgrade your storage to get the full features of Team Mail.",
|
||||
name: 'textQuotasRunOutOfStorageContent',
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user