diff --git a/lib/data/services/novice_guide_service.dart b/lib/data/services/novice_guide_service.dart index 4fa2c12c7..d32be2368 100644 --- a/lib/data/services/novice_guide_service.dart +++ b/lib/data/services/novice_guide_service.dart @@ -12,7 +12,7 @@ class NoviceGuideService extends GetxService { StreamSubscription? _statusSubscription; bool isHomeGuide = true; - bool isAIGuide = false; + bool isAIGuide = true; RxBool isWakeup = false.obs; diff --git a/lib/modules/agent/controllers/agent_controller.dart b/lib/modules/agent/controllers/agent_controller.dart index 4ab856798..89eed9292 100644 --- a/lib/modules/agent/controllers/agent_controller.dart +++ b/lib/modules/agent/controllers/agent_controller.dart @@ -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)), + // ], + // ), + // ); + // }, + ), ), ), ),