opt text selection

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-07-25 13:00:02 +08:00
parent 56ca0cade4
commit 10b723fa64
11 changed files with 648 additions and 390 deletions

View File

@@ -54,33 +54,34 @@ void _showEmoteDialog(ModuleDynamicModel? moduleDynamic) {
builder: (context) => Dialog(
child: Padding(
padding: const .symmetric(horizontal: 20, vertical: 16),
child: SingleChildScrollView(
child: SelectionText.rich(
TextSpan(
children: emotes!.entries.mapIndexed(
(i, e) {
final emoji = e.value;
final size = emoji.size * 25.0;
return TextSpan(
children: [
if (i != 0) const TextSpan(text: '\n\n'),
EmoteSpan(
rawText: Style.placeHolder,
child: NetworkImgLayer(
src: emoji.url,
type: .emote,
width: size,
height: size,
child: SelectionArea(
contextMenuBuilder: openUrlMenuBuilder,
child: SingleChildScrollView(
child: Text.rich(
TextSpan(
children: emotes!.entries.mapIndexed(
(i, e) {
final emoji = e.value;
final size = emoji.size * 25.0;
return TextSpan(
children: [
if (i != 0) const TextSpan(text: '\n\n'),
WidgetSpan(
child: NetworkImgLayer(
src: emoji.url,
type: .emote,
width: size,
height: size,
),
),
),
TextSpan(text: '\n${e.key}\n${emoji.url}'),
],
);
},
).toList(),
TextSpan(text: '\n${e.key}\n${emoji.url}'),
],
);
},
).toList(),
),
style: const TextStyle(fontSize: 15, height: 1.7),
),
contextMenuBuilder: openUrlMenuBuilder,
style: const TextStyle(fontSize: 15, height: 1.7),
),
),
),
@@ -94,11 +95,13 @@ void _showTextDialog(String text) {
builder: (context) => Dialog(
child: Padding(
padding: const .symmetric(horizontal: 20, vertical: 16),
child: SingleChildScrollView(
child: SelectionText(
text,
contextMenuBuilder: openUrlMenuBuilder,
style: const TextStyle(fontSize: 15, height: 1.7),
child: SelectionArea(
contextMenuBuilder: openUrlMenuBuilder,
child: SingleChildScrollView(
child: Text(
text,
style: const TextStyle(fontSize: 15, height: 1.7),
),
),
),
),