fix(player): 评论入口文字垂直居中

This commit is contained in:
Zhou Weidong committed 2026-10-21 13:16:34 +08:00
1 parent 146cd2a29e
commit f87b0d2689
2 files changed
+57 -12

No files matched your search

@@ -457,7 +457,11 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
),
);
InputDecoration _composerDecoration(String hint, {required bool focused}) {
InputDecoration _composerDecoration(
String hint, {
required bool focused,
required bool multiline,
}) {
final radius = BorderRadius.circular(
focused ? _expandedInputRadius : _composerRadius,
);
@@ -467,7 +471,11 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
);
return InputDecoration(
hintText: hint,
hintStyle: const TextStyle(color: AppColors.muted, fontSize: 14),
hintStyle: TextStyle(
color: AppColors.muted,
fontSize: 14,
height: multiline ? 1.4 : null,
),
counterText: '',
contentPadding: EdgeInsets.symmetric(
horizontal: 16,
@@ -525,7 +533,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
child: Container(
key: const Key('comment-input-placeholder'),
height: _composerHeight,
padding: const EdgeInsets.only(right: 3),
padding: const EdgeInsets.only(right: 6),
decoration: BoxDecoration(
color: AppColors.commentInput,
borderRadius: BorderRadius.circular(_composerRadius),
@@ -533,13 +541,21 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
child: Row(
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 16),
child: Text(
signedIn ? l10n.writeComment : l10n.commentLoginHint,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: AppColors.muted, fontSize: 14),
child: Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.only(left: 16),
child: Text(
signedIn ? l10n.writeComment : l10n.commentLoginHint,
key: const Key('comment-input-placeholder-label'),
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
color: AppColors.muted,
fontSize: 14,
height: 1,
),
),
),
),
),
@@ -566,6 +582,7 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
required bool hasContent,
required bool canPost,
}) {
final multiline = _input.text.contains('\n');
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -587,12 +604,19 @@ class _DramaCommentsSheetState extends State<DramaCommentsSheet> {
minLines: 1,
maxLines: 4,
maxLength: _maxCommentLength,
textAlignVertical: TextAlignVertical.top,
style: const TextStyle(color: AppColors.cream, fontSize: 15),
textAlignVertical: multiline
? TextAlignVertical.top
: TextAlignVertical.center,
style: TextStyle(
color: AppColors.cream,
fontSize: 15,
height: multiline ? 1.4 : null,
),
cursorColor: AppColors.blue,
decoration: _composerDecoration(
signedIn ? l10n.writeComment : l10n.commentLoginHint,
focused: true,
multiline: multiline,
),
onTap: signedIn ? null : _authenticateForComment,
),