generated from dellevin/template
样式更改前的备份
This commit is contained in:
@@ -130,16 +130,19 @@ class _NoteDetailPageState extends State<NoteDetailPage> {
|
||||
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<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) {
|
||||
showDialog(
|
||||
|
||||
@@ -662,6 +662,7 @@ class _NoteFormPageState extends State<NoteFormPage> {
|
||||
/// 构建图片项
|
||||
Widget _buildImageItem(int index) {
|
||||
return InkWell(
|
||||
onTap: () => _showImagePreview(index),
|
||||
onLongPress: () => _showDeleteImageDialog(index),
|
||||
child: Container(
|
||||
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) {
|
||||
showDialog(
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user