样式更改前的备份

This commit is contained in:
DelLevin-Home
2026-03-08 12:48:06 +08:00
parent 0c63242ca0
commit bb7b2c0191
3 changed files with 74 additions and 19 deletions

View File

@@ -130,16 +130,19 @@ class _NoteDetailPageState extends State<NoteDetailPage> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemCount: note.images.length, itemCount: note.images.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Container( return GestureDetector(
width: 100, onTap: () => _showImagePreview(context, note.images, index),
height: 100, child: Container(
margin: const EdgeInsets.only(right: 12), width: 100,
decoration: BoxDecoration( height: 100,
border: Border.all(color: const Color(0xFFE5E5E5)), margin: const EdgeInsets.only(right: 12),
), decoration: BoxDecoration(
child: Image.file( border: Border.all(color: const Color(0xFFE5E5E5)),
File(note.images[index]), ),
fit: BoxFit.cover, child: Image.file(
File(note.images[index]),
fit: BoxFit.cover,
),
), ),
); );
}, },
@@ -318,6 +321,32 @@ class _NoteDetailPageState extends State<NoteDetailPage> {
}); });
} }
/// 显示图片预览
void _showImagePreview(BuildContext context, List<String> 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) { void _showDeleteDialog(BuildContext context) {
showDialog( showDialog(

View File

@@ -662,6 +662,7 @@ class _NoteFormPageState extends State<NoteFormPage> {
/// 构建图片项 /// 构建图片项
Widget _buildImageItem(int index) { Widget _buildImageItem(int index) {
return InkWell( return InkWell(
onTap: () => _showImagePreview(index),
onLongPress: () => _showDeleteImageDialog(index), onLongPress: () => _showDeleteImageDialog(index),
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -675,6 +676,32 @@ class _NoteFormPageState extends State<NoteFormPage> {
); );
} }
/// 显示图片预览
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) { void _showDeleteImageDialog(int index) {
showDialog( showDialog(

View File

@@ -618,15 +618,14 @@ class SettingsPage extends StatelessWidget {
body: ListView( body: ListView(
children: [ children: [
// 使用说明 // 使用说明
_buildLinkItem( // _buildLinkItem(
context: context, // context: context,
icon: Icons.help_outline, // icon: Icons.help_outline,
title: '使用说明', // title: '使用说明',
subtitle: '查看应用使用指南', // subtitle: '查看应用使用指南',
url: 'https://www.iletter.top/', // url: 'https://www.iletter.top/',
), // ),
// const Divider(height: 0.5, indent: 24, endIndent: 24),
const Divider(height: 0.5, indent: 24, endIndent: 24),
// 关于作者 // 关于作者
_buildLinkItem( _buildLinkItem(