TF-1018 Add AppGridDashboardOverlay into MailboxDashboardView in web
This commit is contained in:
committed by
Dat H. Pham
parent
0104e38431
commit
c11df2fe8b
@@ -0,0 +1,3 @@
|
||||
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9.11563 15C10.181 15 10.7392 15.1078 11.3205 15.4187C11.8615 15.708 12.292 16.1385 12.5813 16.6795C12.8922 17.2608 13 17.819 13 18.8844V21.1156C13 22.181 12.8922 22.7392 12.5813 23.3206C12.292 23.8615 11.8615 24.292 11.3205 24.5813C10.7392 24.8922 10.181 25 9.11563 25H6.88437C5.81899 25 5.26083 24.8922 4.67945 24.5813C4.13851 24.292 3.70801 23.8615 3.41871 23.3206C3.10779 22.7392 3 22.181 3 21.1156V18.8844C3 17.819 3.10779 17.2608 3.41871 16.6795C3.70801 16.1385 4.13851 15.708 4.67945 15.4187C5.26083 15.1078 5.81899 15 6.88437 15H9.11563ZM21.1156 15C22.181 15 22.7392 15.1078 23.3206 15.4187C23.8615 15.708 24.292 16.1385 24.5813 16.6795C24.8922 17.2608 25 17.819 25 18.8844V21.1156C25 22.181 24.8922 22.7392 24.5813 23.3206C24.292 23.8615 23.8615 24.292 23.3206 24.5813C22.7392 24.8922 22.181 25 21.1156 25H18.8844C17.819 25 17.2608 24.8922 16.6794 24.5813C16.1385 24.292 15.708 23.8615 15.4187 23.3206C15.1078 22.7392 15 22.181 15 21.1156V18.8844C15 17.819 15.1078 17.2608 15.4187 16.6795C15.708 16.1385 16.1385 15.708 16.6794 15.4187C17.2608 15.1078 17.819 15 18.8844 15H21.1156ZM9.11563 17H6.88437C6.12092 17 5.87468 17.0476 5.62265 17.1823C5.43025 17.2852 5.28523 17.4303 5.18234 17.6227C5.04755 17.8747 5 18.1209 5 18.8844V21.1156C5 21.8791 5.04755 22.1253 5.18234 22.3774C5.28523 22.5698 5.43025 22.7148 5.62265 22.8177C5.87468 22.9525 6.12092 23 6.88437 23H9.11563C9.87908 23 10.1253 22.9525 10.3774 22.8177C10.5698 22.7148 10.7148 22.5698 10.8177 22.3774C10.9524 22.1253 11 21.8791 11 21.1156V18.8844C11 18.1209 10.9524 17.8747 10.8177 17.6227C10.7148 17.4303 10.5698 17.2852 10.3774 17.1823C10.1253 17.0476 9.87908 17 9.11563 17ZM21.1156 17H18.8844C18.1209 17 17.8747 17.0476 17.6226 17.1823C17.4303 17.2852 17.2852 17.4303 17.1823 17.6227C17.0476 17.8747 17 18.1209 17 18.8844V21.1156C17 21.8791 17.0476 22.1253 17.1823 22.3774C17.2852 22.5698 17.4303 22.7148 17.6226 22.8177C17.8747 22.9525 18.1209 23 18.8844 23H21.1156C21.8791 23 22.1253 22.9525 22.3774 22.8177C22.5697 22.7148 22.7148 22.5698 22.8177 22.3774C22.9524 22.1253 23 21.8791 23 21.1156V18.8844C23 18.1209 22.9524 17.8747 22.8177 17.6227C22.7148 17.4303 22.5697 17.2852 22.3774 17.1823C22.1253 17.0476 21.8791 17 21.1156 17ZM20.8915 2.41257C21.5224 2.60381 21.9933 2.92227 22.7467 3.67561L24.3244 5.25335C25.0777 6.00668 25.3962 6.47758 25.5874 7.10853C25.7654 7.69559 25.7654 8.30443 25.5874 8.89149C25.3962 9.52244 25.0777 9.99334 24.3244 10.7467L22.7467 12.3244C21.9933 13.0778 21.5224 13.3962 20.8915 13.5875C20.3044 13.7654 19.6956 13.7654 19.1085 13.5875C18.4776 13.3962 18.0067 13.0778 17.2533 12.3244L15.6756 10.7467C14.9223 9.99334 14.6038 9.52244 14.4126 8.89149C14.2346 8.30443 14.2346 7.69559 14.4126 7.10853C14.6038 6.47758 14.9223 6.00668 15.6756 5.25335L17.2533 3.67561C18.0067 2.92227 18.4776 2.60381 19.1085 2.41257C19.6956 2.23463 20.3044 2.23463 20.8915 2.41257ZM9.11563 3.00001C10.181 3.00001 10.7392 3.1078 11.3205 3.41872C11.8615 3.70802 12.292 4.13852 12.5813 4.67946C12.8922 5.26084 13 5.819 13 6.88438V9.11564C13 10.181 12.8922 10.7392 12.5813 11.3206C12.292 11.8615 11.8615 12.292 11.3205 12.5813C10.7392 12.8922 10.181 13 9.11563 13H6.88437C5.81899 13 5.26083 12.8922 4.67945 12.5813C4.13851 12.292 3.70801 11.8615 3.41871 11.3206C3.10779 10.7392 3 10.181 3 9.11564V6.88438C3 5.819 3.10779 5.26084 3.41871 4.67946C3.70801 4.13852 4.13851 3.70802 4.67945 3.41872C5.26083 3.1078 5.81899 3.00001 6.88437 3.00001H9.11563ZM19.6887 4.32658C19.4151 4.40948 19.2074 4.54998 18.6675 5.08982L17.0898 6.66756C16.55 7.2074 16.4095 7.41514 16.3266 7.68866C16.2633 7.89747 16.2633 8.10255 16.3266 8.31136C16.4095 8.58488 16.55 8.79262 17.0898 9.33246L18.6675 10.9102C19.2074 11.45 19.4151 11.5905 19.6887 11.6734C19.8975 11.7367 20.1025 11.7367 20.3113 11.6734C20.5849 11.5905 20.7926 11.45 21.3325 10.9102L22.9102 9.33246C23.45 8.79262 23.5905 8.58488 23.6734 8.31136C23.7367 8.10255 23.7367 7.89747 23.6734 7.68866C23.5905 7.41514 23.45 7.2074 22.9102 6.66756L21.3325 5.08982C20.7926 4.54998 20.5849 4.40948 20.3113 4.32658C20.1025 4.26329 19.8975 4.26329 19.6887 4.32658ZM9.11563 5.00001H6.88437C6.12092 5.00001 5.87468 5.04756 5.62265 5.18235C5.43025 5.28524 5.28523 5.43026 5.18234 5.62266C5.04755 5.87469 5 6.12093 5 6.88438V9.11564C5 9.87909 5.04755 10.1253 5.18234 10.3774C5.28523 10.5698 5.43025 10.7148 5.62265 10.8177C5.87468 10.9525 6.12092 11 6.88437 11H9.11563C9.87908 11 10.1253 10.9525 10.3774 10.8177C10.5698 10.7148 10.7148 10.5698 10.8177 10.3774C10.9524 10.1253 11 9.87909 11 9.11564V6.88438C11 6.12093 10.9524 5.87469 10.8177 5.62266C10.7148 5.43026 10.5698 5.28524 10.3774 5.18235C10.1253 5.04756 9.87908 5.00001 9.11563 5.00001Z" fill="#007AFF"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
@@ -1,3 +1,4 @@
|
||||
SERVER_URL=http://localhost
|
||||
DOMAIN_REDIRECT_URL=http://localhost:3000
|
||||
WEB_OIDC_CLIENT_ID=teammail-web
|
||||
WEB_OIDC_CLIENT_ID=teammail-web
|
||||
APP_GRID_AVAILABLE=supported
|
||||
@@ -9,6 +9,7 @@ import 'package:tmail_ui_user/features/mailbox/domain/state/mark_as_mailbox_read
|
||||
import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view_web.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/action/dashboard_action.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/base_mailbox_dashboard_view.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/app_grid_dashboard_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/controller/search_controller.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/composer_overlay_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/email_receive_time_type.dart';
|
||||
@@ -26,12 +27,16 @@ import 'package:tmail_ui_user/features/thread/presentation/thread_view.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/routes/app_routes.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
import 'widgets/app_dashboard/app_grid_dashboard_overlay.dart';
|
||||
|
||||
class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||
|
||||
MailboxDashBoardView({Key? key}) : super(key: key);
|
||||
|
||||
final SearchController searchController = Get.find<SearchController>();
|
||||
final AppGridDashboardController appGridDashboardController = Get.find<AppGridDashboardController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -259,6 +264,35 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
|
||||
}
|
||||
})),
|
||||
const Spacer(),
|
||||
AppConfig.appGridDashboardAvailable
|
||||
? Obx(() => PortalTarget(
|
||||
visible: appGridDashboardController.isAppGridDashboardOverlayOpen.isTrue,
|
||||
portalFollower: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () => appGridDashboardController.toggleAppGridDashboard()),
|
||||
child: PortalTarget(
|
||||
child: InkWell(
|
||||
onTapDown: (tapDownDetails) => controller.showAppDashboardAction(),
|
||||
child: buildIconWeb(
|
||||
icon: SvgPicture.asset(imagePaths.icAppDashboard, width: 28, height: 28, fit: BoxFit.fill),
|
||||
)
|
||||
),
|
||||
anchor: const Aligned(
|
||||
follower: Alignment.topRight,
|
||||
target: Alignment.bottomRight
|
||||
),
|
||||
portalFollower: Obx(() {
|
||||
if (appGridDashboardController.linagoraApplications.value != null) {
|
||||
return AppDashboardOverlay(appGridDashboardController.linagoraApplications.value!);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}),
|
||||
visible: appGridDashboardController.isAppGridDashboardOverlayOpen.isTrue,
|
||||
)
|
||||
)
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
const SizedBox(width: 24),
|
||||
Obx(() => (AvatarBuilder()
|
||||
..text(controller.userProfile.value?.getAvatarText() ?? '')
|
||||
..backgroundColor(Colors.white)
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
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/mailbox_dashboard/domain/app_dashboard/linagora_app.dart';
|
||||
import 'package:url_launcher/url_launcher.dart' as launcher;
|
||||
|
||||
typedef OnTapCallback = void Function();
|
||||
|
||||
class AppGridDashboardItem extends StatelessWidget {
|
||||
final LinagoraApp app;
|
||||
|
||||
AppGridDashboardItem(this.app, {Key? key}) : super(key: key);
|
||||
|
||||
final ImagePaths _imagePaths = Get.find<ImagePaths>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: InkWell(
|
||||
onTap: _openApp,
|
||||
child: Column(children: [
|
||||
app.iconName.endsWith("svg")
|
||||
? SvgPicture.asset(
|
||||
_imagePaths.getConfigurationImagePath(app.iconName),
|
||||
width: 56,
|
||||
height: 56,
|
||||
fit: BoxFit.fill)
|
||||
: Image.asset(
|
||||
_imagePaths.getConfigurationImagePath(app.iconName),
|
||||
width: 56,
|
||||
height: 56,
|
||||
fit: BoxFit.fill),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Text(
|
||||
app.appName,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||
style: const TextStyle(
|
||||
color: AppColor.colorNameEmail,
|
||||
fontSize: 15
|
||||
),
|
||||
),
|
||||
),
|
||||
]),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
void _openApp() async {
|
||||
final url = app.appUri;
|
||||
if (await launcher.canLaunchUrl(url)) {
|
||||
await launcher.launchUrl(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/views/list/sliver_grid_delegate_fixed_height.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/domain/app_dashboard/linagora_applications.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/app_dashboard/app_grid_dashboard_item.dart';
|
||||
|
||||
class AppDashboardOverlay extends StatelessWidget {
|
||||
final LinagoraApplications _linagoraApplications;
|
||||
|
||||
const AppDashboardOverlay(this._linagoraApplications, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
child: Container(
|
||||
width: 342,
|
||||
height: 244,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: AppColor.colorShadowComposer,
|
||||
blurRadius: 32,
|
||||
offset: Offset.zero),
|
||||
BoxShadow(
|
||||
color: AppColor.colorDropShadow,
|
||||
blurRadius: 4,
|
||||
offset: Offset.zero),
|
||||
]
|
||||
),
|
||||
child: GridView.builder(
|
||||
padding: const EdgeInsets.all(24),
|
||||
itemBuilder: (context, i) {
|
||||
final app = _linagoraApplications.apps[i];
|
||||
return AppGridDashboardItem(app);
|
||||
},
|
||||
primary: true,
|
||||
itemCount: _linagoraApplications.apps.length,
|
||||
gridDelegate: const SliverGridDelegateFixedHeight(
|
||||
height: 98,
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,12 @@ class AppConfig {
|
||||
static String get baseUrl => dotenv.get('SERVER_URL', fallback: '');
|
||||
static String get domainRedirectUrl => dotenv.get('DOMAIN_REDIRECT_URL', fallback: '');
|
||||
static String get webOidcClientId => dotenv.get('WEB_OIDC_CLIENT_ID', fallback: '');
|
||||
static bool get appGridDashboardAvailable {
|
||||
final supported = dotenv.get('APP_GRID_AVAILABLE', fallback: 'unsupported');
|
||||
if (supported == 'supported') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
static String appDashboardConfigurationPath = "configurations/app_dashboard.json";
|
||||
}
|
||||
Reference in New Issue
Block a user