This commit is contained in:
DelLevin-Home
2026-07-05 21:39:20 +08:00
parent 2f926dfdb5
commit 0ad3713382

View File

@@ -217,81 +217,89 @@ class _BookExcerptFormPageState extends State<BookExcerptFormPage> {
} }
Widget _buildContentInput(ColorScheme colors) { Widget _buildContentInput(ColorScheme colors) {
return GestureDetector( return Container(
onTap: _editContent, constraints: const BoxConstraints(minHeight: 140, maxHeight: 280),
child: Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
width: double.infinity, decoration: BoxDecoration(
constraints: const BoxConstraints(minHeight: 140), color: colors.surfaceContainerHigh,
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), borderRadius: BorderRadius.circular(10),
decoration: BoxDecoration( border: Border.all(color: colors.outlineVariant.withValues(alpha: 0.3), width: 1),
color: colors.surfaceContainerHigh, ),
borderRadius: BorderRadius.circular(10), child: Column(
border: Border.all(color: colors.outlineVariant.withValues(alpha: 0.3), width: 1), crossAxisAlignment: CrossAxisAlignment.start,
), children: [
child: Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: TextField(
children: [ controller: _contentController,
Text( maxLines: null,
_contentController.text.isEmpty ? '在这里粘贴或输入书中的原文段落…' : _contentController.text, expands: true,
style: TextStyle( textAlignVertical: TextAlignVertical.top,
fontSize: 15, style: TextStyle(fontSize: 15, height: 1.8, color: colors.onSurface),
height: 1.8, decoration: InputDecoration(
color: _contentController.text.isEmpty ? colors.onSurface.withValues(alpha: 0.25) : colors.onSurface, hintText: '在这里粘贴或输入书中的原文段落…',
hintStyle: TextStyle(fontSize: 15, color: colors.onSurface.withValues(alpha: 0.25)),
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
), ),
maxLines: 6,
overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 8), ),
Row( const SizedBox(height: 8),
mainAxisAlignment: MainAxisAlignment.end, Row(
children: [ mainAxisAlignment: MainAxisAlignment.end,
Text('$_contentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))), children: [
const SizedBox(width: 4), Text('$_contentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))),
Icon(Icons.edit_outlined, size: 14, color: colors.onSurface.withValues(alpha: 0.25)), const SizedBox(width: 8),
], GestureDetector(
), onTap: _editContent,
], child: Icon(Icons.open_in_full, size: 16, color: colors.onSurface.withValues(alpha: 0.3)),
), ),
],
),
],
), ),
); );
} }
Widget _buildCommentInput(ColorScheme colors) { Widget _buildCommentInput(ColorScheme colors) {
return GestureDetector( return Container(
onTap: _editComment, constraints: const BoxConstraints(minHeight: 80, maxHeight: 280),
child: Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
width: double.infinity, decoration: BoxDecoration(
constraints: const BoxConstraints(minHeight: 80), color: colors.surfaceContainerHigh,
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), borderRadius: BorderRadius.circular(10),
decoration: BoxDecoration( border: Border.all(color: colors.outlineVariant.withValues(alpha: 0.3), width: 1),
color: colors.surfaceContainerHigh, ),
borderRadius: BorderRadius.circular(10), child: Column(
border: Border.all(color: colors.outlineVariant.withValues(alpha: 0.3), width: 1), crossAxisAlignment: CrossAxisAlignment.start,
), children: [
child: Column( Expanded(
crossAxisAlignment: CrossAxisAlignment.start, child: TextField(
children: [ controller: _commentController,
Text( maxLines: null,
_commentController.text.isEmpty ? '记录思考、联想或评论…' : _commentController.text, expands: true,
style: TextStyle( textAlignVertical: TextAlignVertical.top,
fontSize: 15, style: TextStyle(fontSize: 15, height: 1.8, color: colors.onSurface),
height: 1.8, decoration: InputDecoration(
color: _commentController.text.isEmpty ? colors.onSurface.withValues(alpha: 0.25) : colors.onSurface, hintText: '记录思考、联想或评论…',
hintStyle: TextStyle(fontSize: 15, color: colors.onSurface.withValues(alpha: 0.25)),
border: InputBorder.none,
contentPadding: EdgeInsets.zero,
), ),
maxLines: 4,
overflow: TextOverflow.ellipsis,
), ),
const SizedBox(height: 8), ),
Row( const SizedBox(height: 8),
mainAxisAlignment: MainAxisAlignment.end, Row(
children: [ mainAxisAlignment: MainAxisAlignment.end,
Text('$_commentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))), children: [
const SizedBox(width: 4), Text('$_commentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))),
Icon(Icons.edit_outlined, size: 14, color: colors.onSurface.withValues(alpha: 0.25)), const SizedBox(width: 8),
], GestureDetector(
), onTap: _editComment,
], child: Icon(Icons.open_in_full, size: 16, color: colors.onSurface.withValues(alpha: 0.3)),
), ),
],
),
],
), ),
); );
} }