This commit is contained in:
1 parent
2ddf9ee1c6
commit
a47af8c3ad
7 files changed
+29
-10
No files matched your search
@@ -12,7 +12,6 @@ const double _synopsisToggleWidthFraction = 0.55;
|
||||
const double _synopsisToggleGap = 6;
|
||||
const _synopsisMotion = Duration(milliseconds: 240);
|
||||
const _synopsisStyle = TextStyle(
|
||||
color: AppColors.overlaySecondary,
|
||||
fontSize: _synopsisFont,
|
||||
fontWeight: FontWeight.w400,
|
||||
height: _synopsisLineHeight,
|
||||
@@ -32,6 +31,7 @@ class ExpandableSynopsis extends StatefulWidget {
|
||||
required this.synopsis,
|
||||
this.keyPrefix = 'home-feed',
|
||||
this.expandedFooter,
|
||||
this.textColor = AppColors.homeFeedVideoCopy,
|
||||
});
|
||||
|
||||
/// 按当前语言获取的简介正文。
|
||||
@@ -43,6 +43,9 @@ class ExpandableSynopsis extends StatefulWidget {
|
||||
/// 展开后附加的声明等内容。
|
||||
final Widget? expandedFooter;
|
||||
|
||||
/// 简介正文颜色;默认使用视频信息区统一的半透明浅灰白。
|
||||
final Color textColor;
|
||||
|
||||
@override
|
||||
State<ExpandableSynopsis> createState() => _ExpandableSynopsisState();
|
||||
}
|
||||
@@ -88,7 +91,7 @@ class _ExpandableSynopsisState extends State<ExpandableSynopsis> {
|
||||
}
|
||||
|
||||
bool _needsToggle(double maxWidth) {
|
||||
final painter = _painter(widget.synopsis, _synopsisStyle);
|
||||
final painter = _painter(widget.synopsis, _bodyStyle);
|
||||
painter.layout(maxWidth: maxWidth);
|
||||
final overflows = painter.didExceedMaxLines;
|
||||
painter.dispose();
|
||||
@@ -120,11 +123,14 @@ class _ExpandableSynopsisState extends State<ExpandableSynopsis> {
|
||||
|
||||
Key _key(String suffix) => Key('${widget.keyPrefix}-synopsis-$suffix');
|
||||
|
||||
TextStyle get _bodyStyle => _synopsisStyle.copyWith(color: widget.textColor);
|
||||
|
||||
Widget _body() {
|
||||
final style = _bodyStyle;
|
||||
final text = Text.rich(
|
||||
TextSpan(text: widget.synopsis, style: _synopsisStyle),
|
||||
TextSpan(text: widget.synopsis, style: style),
|
||||
key: _expanded ? _key('expanded') : Key('${widget.keyPrefix}-synopsis'),
|
||||
style: _synopsisStyle,
|
||||
style: style,
|
||||
maxLines: _expanded ? null : _collapsedSynopsisLines,
|
||||
overflow: _expanded ? TextOverflow.clip : TextOverflow.ellipsis,
|
||||
);
|
||||
|
||||
@@ -101,7 +101,7 @@ class _TagChip extends StatelessWidget {
|
||||
maxLines: 1,
|
||||
strutStyle: _metadataStrutStyle,
|
||||
style: const TextStyle(
|
||||
color: AppColors.overlaySecondary,
|
||||
color: AppColors.homeFeedVideoCopy,
|
||||
fontSize: _tagFont,
|
||||
fontWeight: FontWeight.w500,
|
||||
height: _metadataLineHeight,
|
||||
|
||||
@@ -103,6 +103,7 @@ class _HomeFeedInfoPanelState extends State<HomeFeedInfoPanel> {
|
||||
ExpandableSynopsis(
|
||||
key: ValueKey(widget.drama.id),
|
||||
synopsis: synopsis,
|
||||
textColor: AppColors.homeFeedVideoCopy,
|
||||
),
|
||||
],
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user