Basic article rendering (overview)

This commit is contained in:
2024-07-10 00:44:10 +08:00
parent 065cda27e9
commit 505290b2ae
9 changed files with 640 additions and 12 deletions

View File

@ -33,7 +33,7 @@ class _PostQuickActionState extends State<PostQuickAction> {
useRootNavigator: true,
context: context,
builder: (context) => PostReactionPopup(
item: widget.item,
reactionList: widget.item.reactionList,
onReact: (key, value) {
doWidgetReact(key, value.attitude);
},
@ -109,8 +109,11 @@ class _PostQuickActionState extends State<PostQuickAction> {
),
if (widget.isReactable && widget.isShowReply)
const VerticalDivider(
thickness: 0.3, width: 0.3, indent: 8, endIndent: 8)
.paddingSymmetric(horizontal: 8),
thickness: 0.3,
width: 0.3,
indent: 8,
endIndent: 8,
).paddingSymmetric(horizontal: 8),
Expanded(
child: ListView(
shrinkWrap: true,

View File

@ -1,13 +1,16 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:solian/models/post.dart';
import 'package:solian/models/reaction.dart';
class PostReactionPopup extends StatelessWidget {
final Post item;
final Map<String, int> reactionList;
final void Function(String key, ReactInfo info) onReact;
const PostReactionPopup({super.key, required this.item, required this.onReact});
const PostReactionPopup({
super.key,
required this.reactionList,
required this.onReact,
});
@override
Widget build(BuildContext context) {
@ -30,10 +33,12 @@ class PostReactionPopup extends StatelessWidget {
label: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(e.key, style: const TextStyle(fontFamily: 'monospace')),
Text(e.key,
style: const TextStyle(fontFamily: 'monospace')),
const SizedBox(width: 6),
Text('x${item.reactionList[e.key]?.toString() ?? '0'}',
style: const TextStyle(fontWeight: FontWeight.bold)),
Text('x${reactionList[e.key]?.toString() ?? '0'}',
style:
const TextStyle(fontWeight: FontWeight.bold)),
],
),
onPressed: () {