Merge branch 'design'

This commit is contained in:
guozhigq
2024-10-24 00:49:30 +08:00
6 changed files with 102 additions and 90 deletions

View File

@ -15,4 +15,5 @@ class Constants {
// 59b43e04ad6965f34319062b478f83dd TV端
static const String appSec = '59b43e04ad6965f34319062b478f83dd';
static const String thirdSign = '04224646d1fea004e79606d3b038c84a';
static const List<int> publicFavFolder = <int>[0, 2, 22];
}

View File

@ -124,7 +124,7 @@ class _AboutPageState extends State<AboutPage> {
onTap: () => _aboutController.webSiteUrl(),
title: const Text('访问官网'),
trailing: Text(
'https://pilipalanet.mysxl.cn',
'https://pilipala.life',
style: subTitleStyle,
),
),

View File

@ -96,7 +96,9 @@ class VideoContent extends StatelessWidget {
),
const Spacer(),
Text(
[22, 0].contains(favFolderItem.attr) ? '公开' : '私密',
Constants.publicFavFolder.contains(favFolderItem.attr)
? '公开'
: '私密',
textAlign: TextAlign.start,
style: TextStyle(
fontSize: Theme.of(context).textTheme.labelMedium!.fontSize,

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive/hive.dart';
import 'package:pilipala/common/constants.dart';
import 'package:pilipala/common/widgets/http_error.dart';
import 'package:pilipala/utils/feed_back.dart';
import 'package:pilipala/utils/storage.dart';
@ -66,16 +67,14 @@ class _FavPanelState extends State<FavPanel> {
onTap: () =>
widget.ctr!.onChoose(item.favState != 1, index),
dense: true,
leading: Icon([22, 0].contains(item.attr)
? Icons.lock_outline
: Icons.folder_outlined),
leading: Icon(
Constants.publicFavFolder.contains(item.attr)
? Icons.folder_outlined
: Icons.lock_outline),
minLeadingWidth: 0,
title: Text(item.title!),
subtitle: Text(
'${item.mediaCount}个内容 - ${[
22,
0
].contains(item.attr) ? '公开' : '私密'}',
'${item.mediaCount}个内容 - ${Constants.publicFavFolder.contains(item.attr) ? '公开' : '私密'}',
),
trailing: Transform.scale(
scale: 0.9,

View File

@ -1,6 +1,5 @@
import 'dart:math';
import 'package:appscheme/appscheme.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -46,7 +45,7 @@ class ReplyItem extends StatelessWidget {
final bool? showReplyRow;
final Function? replyReply;
final ReplyType? replyType;
final bool? replySave;
final bool replySave;
@override
Widget build(BuildContext context) {
@ -56,7 +55,7 @@ class ReplyItem extends StatelessWidget {
child: InkWell(
// 点击整个评论区 评论详情/回复
onTap: () {
if (replySave!) {
if (replySave) {
return;
}
feedBack();
@ -65,7 +64,7 @@ class ReplyItem extends StatelessWidget {
}
},
onLongPress: () {
if (replySave!) {
if (replySave) {
return;
}
feedBack();
@ -238,53 +237,32 @@ class ReplyItem extends StatelessWidget {
// title
Container(
margin: const EdgeInsets.only(top: 10, left: 45, right: 6, bottom: 4),
child: LayoutBuilder(
builder: (BuildContext context, BoxConstraints boxConstraints) {
String text = replyItem?.content?.message ?? '';
bool didExceedMaxLines = false;
final double maxWidth = boxConstraints.maxWidth;
TextPainter? textPainter;
final int maxLines =
replyItem!.content!.isText! && replyLevel == '1' ? 6 : 999;
try {
textPainter = TextPainter(
text: TextSpan(text: text),
maxLines: maxLines,
textDirection: Directionality.of(context),
);
textPainter.layout(maxWidth: maxWidth);
didExceedMaxLines = textPainter.didExceedMaxLines;
} catch (e) {
debugPrint('Error while measuring text: $e');
didExceedMaxLines = false;
}
return Text.rich(
style: const TextStyle(height: 1.75),
TextSpan(
children: [
if (replyItem!.isTop!)
const WidgetSpan(
alignment: PlaceholderAlignment.top,
child: PBadge(
text: 'TOP',
size: 'small',
stack: 'normal',
type: 'line',
fs: 9,
),
),
buildContent(
context,
replyItem!,
replyReply,
null,
didExceedMaxLines,
textPainter,
),
],
),
);
}),
child: !replySave
? LayoutBuilder(builder:
(BuildContext context, BoxConstraints boxConstraints) {
String text = replyItem?.content?.message ?? '';
bool didExceedMaxLines = false;
final double maxWidth = boxConstraints.maxWidth;
TextPainter? textPainter;
final int maxLines =
replyItem!.content!.isText! && replyLevel == '1'
? 6
: 999;
try {
textPainter = TextPainter(
text: TextSpan(text: text),
maxLines: maxLines,
textDirection: Directionality.of(context),
);
textPainter.layout(maxWidth: maxWidth);
didExceedMaxLines = textPainter.didExceedMaxLines;
} catch (e) {
debugPrint('Error while measuring text: $e');
didExceedMaxLines = false;
}
return replyContent(context, didExceedMaxLines, textPainter);
})
: replyContent(context, false, null),
),
// 操作区域
bottonAction(context, replyItem!.replyControl, replySave),
@ -307,6 +285,36 @@ class ReplyItem extends StatelessWidget {
);
}
Widget replyContent(
BuildContext context, bool? didExceedMaxLines, TextPainter? textPainter) {
return Text.rich(
style: const TextStyle(height: 1.75),
TextSpan(
children: [
if (replyItem!.isTop!)
const WidgetSpan(
alignment: PlaceholderAlignment.top,
child: PBadge(
text: 'TOP',
size: 'small',
stack: 'normal',
type: 'line',
fs: 9,
),
),
buildContent(
context,
replyItem!,
replyReply,
null,
didExceedMaxLines ?? false,
textPainter,
),
],
),
);
}
// 感谢、回复、复制
Widget bottonAction(BuildContext context, replyControl, replySave) {
ColorScheme colorScheme = Theme.of(context).colorScheme;

View File

@ -153,6 +153,7 @@ class ChatItem extends StatelessWidget {
jsonDecode(content['content'])
.map((m) => m['text'] as String)
.join("\n"),
textAlign: TextAlign.center,
style: TextStyle(
letterSpacing: 0.6,
height: 5,
@ -359,39 +360,40 @@ class ChatItem extends StatelessWidget {
),
const SizedBox(width: 6),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
i['field1'],
maxLines: 2,
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context),
fontWeight: FontWeight.bold,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
i['field1'],
maxLines: 2,
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context),
fontWeight: FontWeight.bold,
),
),
),
Text(
i['field2'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
Text(
i['field2'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
),
),
Text(
i['field3'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
Text(
i['field3'],
style: TextStyle(
letterSpacing: 0.6,
height: 1.5,
color: textColor(context).withOpacity(0.6),
fontSize: 12,
),
),
),
],
)),
],
),
),
],
),
),