Skip to content

Commit

Permalink
TF-2182 Enable hyperlink for event description
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 committed Oct 5, 2023
1 parent 3ca22fd commit 5b44a00
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class CalendarEventDetailWidget extends StatelessWidget {
if (calendarEvent.description?.isNotEmpty == true)
Padding(
padding: const EdgeInsets.only(top: CalendarEventDetailWidgetStyles.fieldTopPadding),
child: EventDescriptionDetailWidget(description: calendarEvent.description!)
child: EventDescriptionDetailWidget(
description: calendarEvent.description!,
onOpenComposerAction: onOpenComposerAction,
onOpenNewTabAction: onOpenNewTabAction,
)
),
if (calendarEvent.dateTimeEventAsString.isNotEmpty)
Padding(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@

import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/resources/image_paths.dart';
import 'package:core/utils/app_logger.dart';
import 'package:flutter/material.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:tmail_ui_user/features/email/presentation/styles/event_description_detail_widget_styles.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/calendar_event/event_location_detail_widget.dart';

class EventDescriptionDetailWidget extends StatelessWidget {

final String description;
final OnOpenNewTabAction? onOpenNewTabAction;
final OnOpenComposerAction? onOpenComposerAction;

const EventDescriptionDetailWidget({
super.key,
required this.description
required this.description,
this.onOpenNewTabAction,
this.onOpenComposerAction,
});

@override
Expand All @@ -28,13 +35,30 @@ class EventDescriptionDetailWidget extends StatelessWidget {
padding: const EdgeInsetsDirectional.all(EventDescriptionDetailWidgetStyles.contentPadding),
child: Stack(
children: [
Text(
description,
Linkify(
onOpen: (element) {
log('EventDescriptionDetailWidget::build:element: $element');
if (element is UrlElement) {
onOpenNewTabAction?.call(element.url);
} else if (element is EmailElement) {
onOpenComposerAction?.call(element.emailAddress);
}
},
text: description,
linkifiers: const [
EmailLinkifier(),
UrlLinkifier()
],
style: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: EventDescriptionDetailWidgetStyles.textSize,
color: EventDescriptionDetailWidgetStyles.valueColor
)
),
options: const LinkifyOptions(
removeWww: true,
looseUrl: true,
defaultToHttps: true
),
),
PositionedDirectional(
top: 0,
Expand Down

0 comments on commit 5b44a00

Please sign in to comment.