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

View File

@@ -217,11 +217,8 @@ 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(
width: double.infinity,
constraints: const BoxConstraints(minHeight: 140),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colors.surfaceContainerHigh, color: colors.surfaceContainerHigh,
@@ -231,37 +228,41 @@ class _BookExcerptFormPageState extends State<BookExcerptFormPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Expanded(
_contentController.text.isEmpty ? '在这里粘贴或输入书中的原文段落…' : _contentController.text, child: TextField(
style: TextStyle( controller: _contentController,
fontSize: 15, maxLines: null,
height: 1.8, expands: true,
color: _contentController.text.isEmpty ? colors.onSurface.withValues(alpha: 0.25) : colors.onSurface, textAlignVertical: TextAlignVertical.top,
style: TextStyle(fontSize: 15, height: 1.8, color: colors.onSurface),
decoration: InputDecoration(
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), const SizedBox(height: 8),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text('$_contentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))), Text('$_contentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))),
const SizedBox(width: 4), const SizedBox(width: 8),
Icon(Icons.edit_outlined, size: 14, color: colors.onSurface.withValues(alpha: 0.25)), 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(
width: double.infinity,
constraints: const BoxConstraints(minHeight: 80),
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14),
decoration: BoxDecoration( decoration: BoxDecoration(
color: colors.surfaceContainerHigh, color: colors.surfaceContainerHigh,
@@ -271,27 +272,34 @@ class _BookExcerptFormPageState extends State<BookExcerptFormPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Expanded(
_commentController.text.isEmpty ? '记录思考、联想或评论…' : _commentController.text, child: TextField(
style: TextStyle( controller: _commentController,
fontSize: 15, maxLines: null,
height: 1.8, expands: true,
color: _commentController.text.isEmpty ? colors.onSurface.withValues(alpha: 0.25) : colors.onSurface, textAlignVertical: TextAlignVertical.top,
style: TextStyle(fontSize: 15, height: 1.8, color: colors.onSurface),
decoration: InputDecoration(
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), const SizedBox(height: 8),
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Text('$_commentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))), Text('$_commentChars字', style: TextStyle(fontSize: 11, color: colors.onSurface.withValues(alpha: 0.3))),
const SizedBox(width: 4), const SizedBox(width: 8),
Icon(Icons.edit_outlined, size: 14, color: colors.onSurface.withValues(alpha: 0.25)), GestureDetector(
], onTap: _editComment,
child: Icon(Icons.open_in_full, size: 16, color: colors.onSurface.withValues(alpha: 0.3)),
), ),
], ],
), ),
],
), ),
); );
} }