mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
* opt: sized * fix: self send * feat: ctrl enter to send * opt: checked * opt: download notifier * opt: Future.syncValue * mod: account * mod: loading state * opt: DebounceStreamMixin * opt: report * opt: enum map * opt: file handler * opt: dyn color * opt: Uint8List subview * opt: FileExt * opt: computeLuminance * opt: isNullOrEmpty * opt: Get context * update [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * opt dynamicColor [skip ci] Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * fixes [skip ci] * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> * update Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me> --------- Signed-off-by: My-Responsitories <107370289+My-Responsitories@users.noreply.github.com> Co-authored-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
75 lines
2.4 KiB
Dart
75 lines
2.4 KiB
Dart
import 'package:PiliPlus/common/constants.dart';
|
|
import 'package:PiliPlus/models_new/article/article_view/ops.dart';
|
|
import 'package:PiliPlus/pages/dynamics/widgets/vote.dart';
|
|
import 'package:PiliPlus/utils/app_scheme.dart';
|
|
import 'package:PiliPlus/utils/image_utils.dart';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class ArticleOpus extends StatelessWidget {
|
|
const ArticleOpus({super.key, required List<ArticleOps>? ops}) : _ops = ops;
|
|
|
|
final List<ArticleOps>? _ops;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if ((_ops == null || _ops.isEmpty)) {
|
|
return const SliverToBoxAdapter();
|
|
}
|
|
|
|
return SliverList.separated(
|
|
itemCount: _ops.length,
|
|
itemBuilder: (context, index) {
|
|
try {
|
|
final item = _ops[index];
|
|
if (item.insert is String) {
|
|
return SelectableText(item.insert);
|
|
}
|
|
|
|
if (item.insert is Insert) {
|
|
InsertCard card = item.insert.card;
|
|
if (card.url?.isNotEmpty == true) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
switch (item.attributes?.clazz) {
|
|
case 'article-card card':
|
|
if (card.id != null) {
|
|
Get.toNamed(
|
|
'/articlePage',
|
|
parameters: {
|
|
'id': card.id!.substring(2),
|
|
'type': 'read',
|
|
},
|
|
);
|
|
}
|
|
case 'video-card card':
|
|
if (card.id != null) {
|
|
PiliScheme.videoPush(null, card.id);
|
|
}
|
|
case 'vote-card card':
|
|
if (card.id != null) {
|
|
showVoteDialog(context, int.parse(card.id!));
|
|
}
|
|
}
|
|
},
|
|
child: ClipRRect(
|
|
borderRadius: StyleString.mdRadius,
|
|
child: CachedNetworkImage(
|
|
imageUrl: ImageUtils.thumbnailUrl(card.url, 60),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
return Text('${item.attributes}');
|
|
} catch (e) {
|
|
return Text(e.toString());
|
|
}
|
|
},
|
|
separatorBuilder: (context, index) => const SizedBox(height: 10),
|
|
);
|
|
}
|
|
}
|