TF-1014: add quotas out of storage

This commit is contained in:
ManhNTX
2022-11-10 10:35:00 +07:00
committed by Dat H. Pham
parent 75495e7d1f
commit 181915f071
15 changed files with 262 additions and 152 deletions
@@ -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))
]
)
)
)
]
)
);
}
}