mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-02 09:08:17 +08:00
@@ -78,7 +78,10 @@ class RenderParagraph extends RenderBox
|
|||||||
SelectionRegistrar? registrar,
|
SelectionRegistrar? registrar,
|
||||||
required Color primary,
|
required Color primary,
|
||||||
}) : assert(text.debugAssertIsValid()),
|
}) : assert(text.debugAssertIsValid()),
|
||||||
assert(maxLines == null || maxLines > 0),
|
assert(maxLines == null ||
|
||||||
|
(maxLines > 0 &&
|
||||||
|
overflow != TextOverflow.ellipsis &&
|
||||||
|
overflow != TextOverflow.fade)),
|
||||||
assert(
|
assert(
|
||||||
identical(textScaler, TextScaler.noScaling) || textScaleFactor == 1.0,
|
identical(textScaler, TextScaler.noScaling) || textScaleFactor == 1.0,
|
||||||
'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
|
'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
|
||||||
@@ -673,6 +676,8 @@ class RenderParagraph extends RenderBox
|
|||||||
);
|
);
|
||||||
TextPainter? _morePainter;
|
TextPainter? _morePainter;
|
||||||
|
|
||||||
|
bool didOverflowHeight = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void performLayout() {
|
void performLayout() {
|
||||||
_lastSelectableFragments?.forEach(
|
_lastSelectableFragments?.forEach(
|
||||||
@@ -690,7 +695,7 @@ class RenderParagraph extends RenderBox
|
|||||||
final Size textSize = _textPainter.size;
|
final Size textSize = _textPainter.size;
|
||||||
size = constraints.constrain(textSize);
|
size = constraints.constrain(textSize);
|
||||||
|
|
||||||
final bool didOverflowHeight =
|
didOverflowHeight =
|
||||||
size.height < textSize.height || _textPainter.didExceedMaxLines;
|
size.height < textSize.height || _textPainter.didExceedMaxLines;
|
||||||
|
|
||||||
if (didOverflowHeight) {
|
if (didOverflowHeight) {
|
||||||
@@ -700,7 +705,10 @@ class RenderParagraph extends RenderBox
|
|||||||
textScaler: textScaler,
|
textScaler: textScaler,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
)..layout(maxWidth: constraints.maxWidth);
|
)..layout(maxWidth: constraints.maxWidth);
|
||||||
size = Size(size.width, size.height + _morePainter!.height);
|
size = Size(
|
||||||
|
size.width,
|
||||||
|
constraints.constrainHeight(size.height + _morePainter!.height),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool didOverflowWidth = size.width < textSize.width;
|
final bool didOverflowWidth = size.width < textSize.width;
|
||||||
@@ -764,10 +772,6 @@ class RenderParagraph extends RenderBox
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(PaintingContext context, Offset offset) {
|
void paint(PaintingContext context, Offset offset) {
|
||||||
if (_needsClipping) {
|
|
||||||
_morePainter?.paint(
|
|
||||||
context.canvas, offset + Offset(0, _textPainter.height));
|
|
||||||
}
|
|
||||||
// Text alignment only triggers repaint so it's possible the text layout has
|
// Text alignment only triggers repaint so it's possible the text layout has
|
||||||
// been invalidated but performLayout wasn't called at this point. Make sure
|
// been invalidated but performLayout wasn't called at this point. Make sure
|
||||||
// the TextPainter has a valid layout.
|
// the TextPainter has a valid layout.
|
||||||
@@ -812,6 +816,13 @@ class RenderParagraph extends RenderBox
|
|||||||
}
|
}
|
||||||
context.canvas.restore();
|
context.canvas.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (didOverflowHeight) {
|
||||||
|
_morePainter?.paint(
|
||||||
|
context.canvas,
|
||||||
|
offset + Offset(0, _textPainter.height),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the offset at which to paint the caret.
|
/// Returns the offset at which to paint the caret.
|
||||||
|
|||||||
@@ -283,12 +283,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const TextSpan(text: ' '),
|
const TextSpan(text: ' '),
|
||||||
],
|
],
|
||||||
buildContent(
|
buildContent(context, theme, replyItem),
|
||||||
context,
|
|
||||||
theme,
|
|
||||||
replyItem,
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -519,12 +514,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
? ''
|
? ''
|
||||||
: ' ',
|
: ' ',
|
||||||
),
|
),
|
||||||
buildContent(
|
buildContent(context, theme, childReply),
|
||||||
context,
|
|
||||||
theme,
|
|
||||||
childReply,
|
|
||||||
replyItem,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -575,11 +565,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
BuildContext context,
|
BuildContext context,
|
||||||
ThemeData theme,
|
ThemeData theme,
|
||||||
ReplyInfo replyItem,
|
ReplyInfo replyItem,
|
||||||
ReplyInfo? fReplyItem,
|
|
||||||
) {
|
) {
|
||||||
// replyItem 当前回复内容
|
|
||||||
// replyReply 查看二楼回复(回复详情)回调
|
|
||||||
// fReplyItem 父级回复内容,用作二楼回复(回复详情)展示
|
|
||||||
final Content content = replyItem.content;
|
final Content content = replyItem.content;
|
||||||
final List<InlineSpan> spanChildren = <InlineSpan>[];
|
final List<InlineSpan> spanChildren = <InlineSpan>[];
|
||||||
|
|
||||||
@@ -625,7 +611,7 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
String matchStr = match[0]!;
|
String matchStr = match[0]!;
|
||||||
if (content.emotes.containsKey(matchStr)) {
|
if (content.emotes.containsKey(matchStr)) {
|
||||||
// 处理表情
|
// 处理表情
|
||||||
final int size = content.emotes[matchStr]!.size.toInt();
|
final size = content.emotes[matchStr]!.size.toInt() * 20.0;
|
||||||
spanChildren.add(
|
spanChildren.add(
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: NetworkImgLayer(
|
child: NetworkImgLayer(
|
||||||
@@ -633,8 +619,8 @@ class ReplyItemGrpc extends StatelessWidget {
|
|||||||
? content.emotes[matchStr]?.gifUrl
|
? content.emotes[matchStr]?.gifUrl
|
||||||
: content.emotes[matchStr]?.url,
|
: content.emotes[matchStr]?.url,
|
||||||
type: ImageType.emote,
|
type: ImageType.emote,
|
||||||
width: size * 20,
|
width: size,
|
||||||
height: size * 20,
|
height: size,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user