text selection patch

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-21 10:48:31 +08:00
parent 26a5d00718
commit dd5ccd11b8
13 changed files with 30 additions and 4869 deletions

View File

@@ -0,0 +1,40 @@
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:flutter/material.dart';
Widget selectableText(
String text, {
TextStyle? style,
}) {
if (PlatformUtils.isDesktop) {
return SelectionArea(
child: Text(
style: style,
text,
),
);
}
return SelectableText(
style: style,
text,
scrollPhysics: const NeverScrollableScrollPhysics(),
);
}
Widget selectableRichText(
TextSpan textSpan, {
TextStyle? style,
}) {
if (PlatformUtils.isDesktop) {
return SelectionArea(
child: Text.rich(
style: style,
textSpan,
),
);
}
return SelectableText.rich(
style: style,
textSpan,
scrollPhysics: const NeverScrollableScrollPhysics(),
);
}