Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f6f399e5f4 |
|||
|
4d0a4605d6 |
2 changed files with 7 additions and 27 deletions
|
|
@ -1,10 +1,7 @@
|
||||||
import "dart:io";
|
|
||||||
|
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:flutter_widget_from_html_core/flutter_widget_from_html_core.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/extensions/link_to_mention.dart";
|
||||||
import "package:nexus/helpers/launch_helper.dart";
|
import "package:nexus/helpers/launch_helper.dart";
|
||||||
import "package:nexus/helpers/mxc_image.dart";
|
import "package:nexus/helpers/mxc_image.dart";
|
||||||
|
|
@ -21,9 +18,10 @@ class const Html(
|
||||||
super.key,
|
super.key,
|
||||||
}) extends ConsumerWidget {
|
}) extends ConsumerWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) => SelectableRegion(
|
||||||
|
selectionControls: materialTextSelectionControls,
|
||||||
// needed until https://github.com/daohoangson/flutter_widget_from_html/issues/1618 is resolved
|
// needed until https://github.com/daohoangson/flutter_widget_from_html/issues/1618 is resolved
|
||||||
final htmlWidget = MaterialUiCompatibilityBridge(
|
child: MaterialUiCompatibilityBridge(
|
||||||
child: HtmlWidget(
|
child: HtmlWidget(
|
||||||
html,
|
html,
|
||||||
buildAsync: false,
|
buildAsync: false,
|
||||||
|
|
@ -148,25 +146,6 @@ class const Html(
|
||||||
onTapUrl: (url) =>
|
onTapUrl: (url) =>
|
||||||
ref.watch(LaunchHelper.provider).launchUrl(.parse(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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
|
import "package:flutter/gestures.dart";
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
import "package:flutter_hooks/flutter_hooks.dart";
|
import "package:flutter_hooks/flutter_hooks.dart";
|
||||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||||
|
|
@ -152,7 +153,7 @@ class const EventRenderer(
|
||||||
|
|
||||||
final contextMenuCallback = getEventOptions == null
|
final contextMenuCallback = getEventOptions == null
|
||||||
? null
|
? null
|
||||||
: (details) => context.showContextMenu(
|
: (PositionedGestureDetails details) => context.showContextMenu(
|
||||||
globalPosition: details.globalPosition,
|
globalPosition: details.globalPosition,
|
||||||
children: getEventOptions!(event).toList(),
|
children: getEventOptions!(event).toList(),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue