From bb7b2c0191d953653550346d77200cdc6a24784f Mon Sep 17 00:00:00 2001 From: DelLevin-Home Date: Sun, 8 Mar 2026 12:48:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=94=B9=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E5=A4=87=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/note_detail_page.dart | 49 ++++++++++++++++++++++++++------- lib/pages/note_form_page.dart | 27 ++++++++++++++++++ lib/pages/profile_page.dart | 17 ++++++------ 3 files changed, 74 insertions(+), 19 deletions(-) diff --git a/lib/pages/note_detail_page.dart b/lib/pages/note_detail_page.dart index 357bf3e..afe80c1 100644 --- a/lib/pages/note_detail_page.dart +++ b/lib/pages/note_detail_page.dart @@ -130,16 +130,19 @@ class _NoteDetailPageState extends State { scrollDirection: Axis.horizontal, itemCount: note.images.length, itemBuilder: (context, index) { - return Container( - width: 100, - height: 100, - margin: const EdgeInsets.only(right: 12), - decoration: BoxDecoration( - border: Border.all(color: const Color(0xFFE5E5E5)), - ), - child: Image.file( - File(note.images[index]), - fit: BoxFit.cover, + return GestureDetector( + onTap: () => _showImagePreview(context, note.images, index), + child: Container( + width: 100, + height: 100, + margin: const EdgeInsets.only(right: 12), + decoration: BoxDecoration( + border: Border.all(color: const Color(0xFFE5E5E5)), + ), + child: Image.file( + File(note.images[index]), + fit: BoxFit.cover, + ), ), ); }, @@ -318,6 +321,32 @@ class _NoteDetailPageState extends State { }); } + /// 显示图片预览 + void _showImagePreview(BuildContext context, List images, int initialIndex) { + showDialog( + context: context, + barrierDismissible: true, + builder: (context) => GestureDetector( + onTap: () => Navigator.pop(context), + child: Container( + color: Colors.black.withOpacity(0.9), + child: Center( + child: InteractiveViewer( + panEnabled: true, + boundaryMargin: const EdgeInsets.all(20), + minScale: 0.5, + maxScale: 4, + child: Image.file( + File(images[initialIndex]), + fit: BoxFit.contain, + ), + ), + ), + ), + ), + ); + } + /// 显示删除对话框 void _showDeleteDialog(BuildContext context) { showDialog( diff --git a/lib/pages/note_form_page.dart b/lib/pages/note_form_page.dart index 6b62372..4df6de0 100644 --- a/lib/pages/note_form_page.dart +++ b/lib/pages/note_form_page.dart @@ -662,6 +662,7 @@ class _NoteFormPageState extends State { /// 构建图片项 Widget _buildImageItem(int index) { return InkWell( + onTap: () => _showImagePreview(index), onLongPress: () => _showDeleteImageDialog(index), child: Container( decoration: BoxDecoration( @@ -675,6 +676,32 @@ class _NoteFormPageState extends State { ); } + /// 显示图片预览 + void _showImagePreview(int index) { + showDialog( + context: context, + barrierDismissible: true, + builder: (context) => GestureDetector( + onTap: () => Navigator.pop(context), + child: Container( + color: Colors.black.withOpacity(0.9), + child: Center( + child: InteractiveViewer( + panEnabled: true, + boundaryMargin: const EdgeInsets.all(20), + minScale: 0.5, + maxScale: 4, + child: Image.file( + File(_images[index]), + fit: BoxFit.contain, + ), + ), + ), + ), + ), + ); + } + /// 显示删除图片确认对话框 void _showDeleteImageDialog(int index) { showDialog( diff --git a/lib/pages/profile_page.dart b/lib/pages/profile_page.dart index 18998cb..255867d 100644 --- a/lib/pages/profile_page.dart +++ b/lib/pages/profile_page.dart @@ -618,15 +618,14 @@ class SettingsPage extends StatelessWidget { body: ListView( children: [ // 使用说明 - _buildLinkItem( - context: context, - icon: Icons.help_outline, - title: '使用说明', - subtitle: '查看应用使用指南', - url: 'https://www.iletter.top/', - ), - - const Divider(height: 0.5, indent: 24, endIndent: 24), + // _buildLinkItem( + // context: context, + // icon: Icons.help_outline, + // title: '使用说明', + // subtitle: '查看应用使用指南', + // url: 'https://www.iletter.top/', + // ), + // const Divider(height: 0.5, indent: 24, endIndent: 24), // 关于作者 _buildLinkItem(