Compare commits
2 changed files with 26 additions and 15 deletions
|
|
@ -1,7 +1,10 @@
|
|||
import "dart:io";
|
||||
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart";
|
||||
import "package:nexus/controllers/settings.dart";
|
||||
import "package:nexus/helpers/extensions/link_to_mention.dart";
|
||||
import "package:nexus/helpers/launch_helper.dart";
|
||||
import "package:nexus/helpers/mxc_image.dart";
|
||||
|
|
@ -18,10 +21,9 @@ class const Html(
|
|||
super.key,
|
||||
}) extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) => SelectableRegion(
|
||||
selectionControls: materialTextSelectionControls,
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// needed until https://github.com/daohoangson/flutter_widget_from_html/issues/1618 is resolved
|
||||
child: MaterialUiCompatibilityBridge(
|
||||
final htmlWidget = MaterialUiCompatibilityBridge(
|
||||
child: HtmlWidget(
|
||||
html,
|
||||
buildAsync: false,
|
||||
|
|
@ -146,6 +148,25 @@ class const Html(
|
|||
onTapUrl: (url) =>
|
||||
ref.watch(LaunchHelper.provider).launchUrl(.parse(url)),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final shouldBeSelectable =
|
||||
ref
|
||||
.watch(SettingsController.provider)
|
||||
.when(
|
||||
data: (data) => !data.linuxMobileMode,
|
||||
error: (_, _) => false,
|
||||
loading: () => false,
|
||||
) ||
|
||||
Platform.isIOS ||
|
||||
Platform.isAndroid;
|
||||
return shouldBeSelectable
|
||||
? SelectableRegion(
|
||||
contextMenuBuilder: (context, selectableRegionState) =>
|
||||
Text("data"),
|
||||
selectionControls: materialTextSelectionControls,
|
||||
child: htmlWidget,
|
||||
)
|
||||
: htmlWidget;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,16 +331,6 @@ final class const RoomChat({
|
|||
},
|
||||
child: ListTile(leading: Icon(Icons.link), title: Text("Copy Link")),
|
||||
),
|
||||
if (event.content case MessageContent(:final body?))
|
||||
PopupMenuItem(
|
||||
onTap: () async {
|
||||
await Clipboard.setData(ClipboardData(text: body));
|
||||
},
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.copy),
|
||||
title: Text("Copy Text"),
|
||||
),
|
||||
),
|
||||
if (ref.watch(
|
||||
PowerLevelController.provider(
|
||||
.redaction(targetUser: event.sender, roomId: roomId),
|
||||
|
|
|
|||
Loading…
Reference in a new issue