Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
027033ad9e |
|||
|
ece3d16318 |
|||
|
5738239da2 |
3 changed files with 143 additions and 120 deletions
|
|
@ -5,7 +5,7 @@ import "package:m3e_card_list/m3e_card_list.dart";
|
||||||
import "package:nexus/helpers/launch_helper.dart";
|
import "package:nexus/helpers/launch_helper.dart";
|
||||||
import "package:package_info_plus/package_info_plus.dart";
|
import "package:package_info_plus/package_info_plus.dart";
|
||||||
|
|
||||||
extension ShowContextMenu on BuildContext {
|
extension ShowAboutDialog on BuildContext {
|
||||||
Future<void> showAboutDialog(WidgetRef ref) async {
|
Future<void> showAboutDialog(WidgetRef ref) async {
|
||||||
final packageInfo = await PackageInfo.fromPlatform();
|
final packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
|
||||||
|
|
@ -50,8 +50,8 @@ extension ShowContextMenu on BuildContext {
|
||||||
M3ECardColumn(
|
M3ECardColumn(
|
||||||
onTap: (index) =>
|
onTap: (index) =>
|
||||||
ref.watch(LaunchHelper.provider).launchUrl(switch (index) {
|
ref.watch(LaunchHelper.provider).launchUrl(switch (index) {
|
||||||
0 => Uri.https("git.federated.nexus", "nexus/nexus"),
|
0 => .https("git.federated.nexus", "nexus/nexus"),
|
||||||
_ => Uri.https("liberapay.com", "QuadRadical"),
|
_ => .https("liberapay.com", "QuadRadical"),
|
||||||
}),
|
}),
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ extension ShowContextMenu on BuildContext {
|
||||||
|
|
||||||
showMenu(
|
showMenu(
|
||||||
context: this,
|
context: this,
|
||||||
constraints: .loose(Size.infinite),
|
constraints: .loose(.infinite),
|
||||||
position: .fromLTRB(
|
position: .fromLTRB(
|
||||||
globalPosition.dx,
|
globalPosition.dx,
|
||||||
globalPosition.dy,
|
globalPosition.dy,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
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";
|
||||||
|
|
@ -18,9 +21,9 @@ 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) {
|
||||||
// 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
|
||||||
MaterialUiCompatibilityBridge(
|
final htmlWidget = MaterialUiCompatibilityBridge(
|
||||||
child: HtmlWidget(
|
child: HtmlWidget(
|
||||||
html,
|
html,
|
||||||
buildAsync: false,
|
buildAsync: false,
|
||||||
|
|
@ -146,4 +149,24 @@ class const Html(
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue