From 2ec8c4a674cc6a74c83ee8b5c8c05cb458799ee2 Mon Sep 17 00:00:00 2001 From: ttdyce Date: Sun, 22 Dec 2024 19:13:18 +0800 Subject: [PATCH] Show also the dead link for debugging when loading image --- lib/main.dart | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d2b7550..88ad0a6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1203,10 +1203,28 @@ class SimpleCachedNetworkImage extends StatelessWidget { ), errorWidget: (context, url, error) => AspectRatio( aspectRatio: width / height, - child: const Center( - child: Icon( - Icons.error, - color: Colors.red, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon( + Icons.error, + color: Colors.red, + ), + GestureDetector( + onTap: () { + Clipboard.setData(ClipboardData(text: url)); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Link copied to clipboard')), + ); + }, + child: Text( + "$url", + style: const TextStyle( + color: Colors.blue, decoration: TextDecoration.underline), + ), + ), + ], ), ), ),