|
|
|
@ -1759,21 +1759,52 @@ class AgentController extends GetxController { |
|
|
|
|
|
|
|
// 打开图片查看器 |
|
|
|
void openImageViewer(BuildContext context, String imagePath) { |
|
|
|
// 构建完整的图片路径 |
|
|
|
String fullImagePath; |
|
|
|
if (imagePath.startsWith('/')) { |
|
|
|
// 如果是相对路径(以/开头),需要拼接AppDir.value |
|
|
|
fullImagePath = '${AppDir.value}$imagePath'; |
|
|
|
} else { |
|
|
|
// 如果已经是完整路径,直接使用 |
|
|
|
fullImagePath = imagePath; |
|
|
|
} |
|
|
|
|
|
|
|
Navigator.push( |
|
|
|
context, |
|
|
|
MaterialPageRoute( |
|
|
|
builder: (context) => Scaffold( |
|
|
|
appBar: AppBar( |
|
|
|
backgroundColor: Colors.black, |
|
|
|
iconTheme: IconThemeData(color: Colors.white), |
|
|
|
), |
|
|
|
// appBar: AppBar( |
|
|
|
// backgroundColor: Colors.black, |
|
|
|
// leading: IconButton( |
|
|
|
// icon: Icon(Icons.arrow_back_ios, color: Colors.white), |
|
|
|
// onPressed: () => Navigator.of(context).pop(), |
|
|
|
// ), |
|
|
|
// iconTheme: IconThemeData(color: Colors.white), |
|
|
|
// //title: Text('图片预览', style: TextStyle(color: Colors.white)), |
|
|
|
// ), |
|
|
|
body: Container( |
|
|
|
color: Colors.black, |
|
|
|
child: PhotoView( |
|
|
|
imageProvider: FileImage(File(imagePath)), |
|
|
|
minScale: PhotoViewComputedScale.contained, |
|
|
|
maxScale: PhotoViewComputedScale.covered * 2, |
|
|
|
backgroundDecoration: BoxDecoration(color: Colors.black), |
|
|
|
child: GestureDetector( |
|
|
|
onTap: () => Navigator.of(context).pop(), // 点击退出 |
|
|
|
|
|
|
|
child: PhotoView( |
|
|
|
imageProvider: FileImage(File(fullImagePath)), |
|
|
|
minScale: PhotoViewComputedScale.contained, |
|
|
|
maxScale: PhotoViewComputedScale.covered * 2, |
|
|
|
backgroundDecoration: BoxDecoration(color: Colors.black), |
|
|
|
// errorBuilder: (context, error, stackTrace) { |
|
|
|
// return const Center( |
|
|
|
// child: Column( |
|
|
|
// mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
// children: [ |
|
|
|
// Icon(Icons.error, color: Colors.white, size: 64), |
|
|
|
// SizedBox(height: 16), |
|
|
|
// Text('图片加载失败', style: TextStyle(color: Colors.white)), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
// ); |
|
|
|
// }, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|