TF-1018 Add AppGridDashboardOverlay into MailboxDashboardView in web
This commit is contained in:
committed by
Dat H. Pham
parent
0104e38431
commit
c11df2fe8b
+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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user