diff --git a/lib/widgets/twake_components/twake_preview_link/twake_link_preview.dart b/lib/widgets/twake_components/twake_preview_link/twake_link_preview.dart index 5524486d57..6ce48ef48c 100644 --- a/lib/widgets/twake_components/twake_preview_link/twake_link_preview.dart +++ b/lib/widgets/twake_components/twake_preview_link/twake_link_preview.dart @@ -15,30 +15,16 @@ class TwakeLinkPreview extends StatefulWidget { final Uri uri; final int? preferredPointInTime; final String text; - final Widget childWidget; - final TextStyle? textStyle; - final TextStyle? linkStyle; - final TextAlign? textAlign; - final LinkTapHandler? onLinkTap; - final int? maxLines; - final double? fontSize; + final Widget messageContentWidget; final bool ownMessage; - final TextSpanBuilder? textSpanBuilder; const TwakeLinkPreview({ super.key, required this.uri, this.preferredPointInTime, required this.text, - required this.childWidget, + required this.messageContentWidget, required this.ownMessage, - this.textStyle, - this.linkStyle, - this.textAlign, - this.onLinkTap, - this.maxLines, - this.fontSize, - this.textSpanBuilder, }); @override @@ -69,12 +55,8 @@ class TwakeLinkPreviewController extends State return TwakeLinkView( key: twakeLinkViewKey, text: widget.text, - textStyle: widget.textStyle, - linkStyle: widget.linkStyle, - childWidget: widget.childWidget, firstValidUrl: firstValidUrl, - onLinkTap: (url) => UrlLauncher(context, url: url.toString()).launchUrl(), - textSpanBuilder: widget.textSpanBuilder, + messageContentWidget: widget.messageContentWidget, previewItemWidget: ValueListenableBuilder( valueListenable: getPreviewUrlStateNotifier, builder: (context, state, child) { diff --git a/lib/widgets/twake_components/twake_preview_link/twake_link_view.dart b/lib/widgets/twake_components/twake_preview_link/twake_link_view.dart index 3540357196..156190984d 100644 --- a/lib/widgets/twake_components/twake_preview_link/twake_link_view.dart +++ b/lib/widgets/twake_components/twake_preview_link/twake_link_view.dart @@ -1,32 +1,18 @@ -import 'package:fluffychat/widgets/clean_rich_text.dart'; import 'package:fluffychat/widgets/twake_components/twake_preview_link/twake_link_view_style.dart'; import 'package:flutter/material.dart'; -import 'package:matrix_link_text/link_text.dart'; class TwakeLinkView extends StatelessWidget { final String text; - final Widget childWidget; + final Widget messageContentWidget; final Widget previewItemWidget; - final TextStyle? textStyle; - final TextStyle? linkStyle; - final TextAlign? textAlign; - final LinkTapHandler? onLinkTap; - final int? maxLines; final String? firstValidUrl; - final TextSpanBuilder? textSpanBuilder; const TwakeLinkView({ Key? key, required this.text, - required this.childWidget, + required this.messageContentWidget, required this.previewItemWidget, - this.textStyle, - this.linkStyle, - this.textAlign = TextAlign.start, - this.onLinkTap, - this.maxLines, this.firstValidUrl, - this.textSpanBuilder, }) : super(key: key); @override @@ -47,7 +33,7 @@ class TwakeLinkView extends StatelessWidget { const SizedBox(height: 2), Padding( padding: TwakeLinkViewStyle.paddingWidgetNoPreview, - child: _buildCleanRichText(context), + child: messageContentWidget, ), ], ); @@ -56,20 +42,7 @@ class TwakeLinkView extends StatelessWidget { Widget _buildWidgetNoPreview(BuildContext context) { return Padding( padding: TwakeLinkViewStyle.paddingWidgetNoPreview, - child: _buildCleanRichText(context), - ); - } - - Widget _buildCleanRichText(BuildContext context) { - return TwakeCleanRichText( - text: text, - childWidget: childWidget, - textStyle: textStyle, - linkStyle: linkStyle, - textAlign: textAlign ?? TextAlign.start, - onLinkTap: onLinkTap, - maxLines: maxLines, - textSpanBuilder: textSpanBuilder, + child: messageContentWidget, ); } }