mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-30 23:40:13 +08:00
@@ -2,6 +2,7 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:PiliPlus/common/assets.dart';
|
||||
import 'package:PiliPlus/common/widgets/dialog/simple_dialog_option.dart';
|
||||
import 'package:PiliPlus/common/widgets/emote_span.dart';
|
||||
import 'package:PiliPlus/common/widgets/gesture/tap_gesture_recognizer.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/cached_network_svg_image.dart';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
@@ -35,28 +36,32 @@ class OpusContent extends StatelessWidget {
|
||||
final List<ArticleContentModel> opus;
|
||||
final ValueGetter<List<SourceModel>> images;
|
||||
final double maxWidth;
|
||||
final String opusId;
|
||||
|
||||
const OpusContent({
|
||||
super.key,
|
||||
required this.opus,
|
||||
required this.images,
|
||||
required this.maxWidth,
|
||||
required this.opusId,
|
||||
});
|
||||
|
||||
static InlineSpan _node2Widget({
|
||||
required Node item,
|
||||
required ColorScheme colorScheme,
|
||||
bool isQuote = false,
|
||||
required String opusId,
|
||||
required ColorScheme colorScheme,
|
||||
required ValueGetter<double> surfaceLuminance,
|
||||
}) {
|
||||
switch (item.type) {
|
||||
case 'TEXT_NODE_TYPE_RICH' when (item.rich != null):
|
||||
Rich rich = item.rich!;
|
||||
final rich = item.rich!;
|
||||
switch (rich.type) {
|
||||
case 'RICH_TEXT_NODE_TYPE_EMOJI':
|
||||
Emoji emoji = rich.emoji!;
|
||||
final size = 20.0 * emoji.size;
|
||||
return WidgetSpan(
|
||||
return EmoteSpan(
|
||||
rawText: rich.origText,
|
||||
child: NetworkImgLayer(
|
||||
width: size,
|
||||
height: size,
|
||||
@@ -64,6 +69,31 @@ class OpusContent extends StatelessWidget {
|
||||
type: ImageType.emote,
|
||||
),
|
||||
);
|
||||
case 'RICH_TEXT_NODE_TYPE_LOTTERY':
|
||||
return TextSpan(
|
||||
children: [
|
||||
WidgetSpan(
|
||||
alignment: .middle,
|
||||
child: Icon(
|
||||
Icons.redeem_rounded,
|
||||
size: 16,
|
||||
color: colorScheme.primary,
|
||||
),
|
||||
),
|
||||
TextSpan(
|
||||
text: '${rich.origText} ',
|
||||
style: TextStyle(color: colorScheme.primary),
|
||||
recognizer: NoDeadlineTapGestureRecognizer()
|
||||
..onTap = () => Get.toNamed(
|
||||
'/webview',
|
||||
parameters: {
|
||||
'url':
|
||||
'https://www.bilibili.com/h5/lottery/result?business_id=$opusId',
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
default:
|
||||
return TextSpan(
|
||||
text:
|
||||
@@ -186,6 +216,7 @@ class OpusContent extends StatelessWidget {
|
||||
?.map(
|
||||
(item) => _node2Widget(
|
||||
item: item,
|
||||
opusId: opusId,
|
||||
colorScheme: colorScheme,
|
||||
surfaceLuminance: getSurfaceLuminance,
|
||||
),
|
||||
@@ -683,6 +714,7 @@ class OpusContent extends StatelessWidget {
|
||||
.map(
|
||||
(e) => _node2Widget(
|
||||
item: e,
|
||||
opusId: opusId,
|
||||
colorScheme: colorScheme,
|
||||
surfaceLuminance: getSurfaceLuminance,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user