opt gesture

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-01-28 18:51:58 +08:00
parent bce73d9f16
commit d1713504a0
13 changed files with 2499 additions and 52 deletions

View File

@@ -0,0 +1,42 @@
import 'package:PiliPlus/common/widgets/flutter/selectable_text/selectable_text.dart';
import 'package:PiliPlus/common/widgets/flutter/selectable_text/selection_area.dart';
import 'package:PiliPlus/utils/platform_utils.dart';
import 'package:flutter/material.dart' hide SelectableText, SelectionArea;
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(),
);
}