@@ -351,18 +351,144 @@ class _AllTestsPageState extends State<AllTestsPage> {
351351 fontSize: 12 ,
352352 ),
353353 ),
354- if (_processedImageData != null ) ...[
354+ if (_processedImageData != null &&
355+ _selectedImagePath != null ) ...[
355356 const SizedBox (height: 16 ),
356- const Text (
357- 'Processed Image:' ,
358- style: TextStyle (fontWeight: FontWeight .bold),
357+ // Side-by-side comparison
358+ Container (
359+ decoration: BoxDecoration (
360+ color: Colors .grey.shade100,
361+ borderRadius: BorderRadius .circular (12 ),
362+ ),
363+ padding: const EdgeInsets .all (12 ),
364+ child: Column (
365+ children: [
366+ // Labels row
367+ Row (
368+ children: [
369+ Expanded (
370+ child: Container (
371+ padding: const EdgeInsets .symmetric (
372+ vertical: 6 ),
373+ decoration: BoxDecoration (
374+ color: Colors .blue.shade100,
375+ borderRadius:
376+ BorderRadius .circular (6 ),
377+ ),
378+ child: const Text (
379+ 'Original / 原图' ,
380+ textAlign: TextAlign .center,
381+ style: TextStyle (
382+ fontWeight: FontWeight .bold,
383+ fontSize: 12 ,
384+ ),
385+ ),
386+ ),
387+ ),
388+ const SizedBox (width: 8 ),
389+ Expanded (
390+ child: Container (
391+ padding: const EdgeInsets .symmetric (
392+ vertical: 6 ),
393+ decoration: BoxDecoration (
394+ color: Colors .green.shade100,
395+ borderRadius:
396+ BorderRadius .circular (6 ),
397+ ),
398+ child: const Text (
399+ 'Processed / 处理后' ,
400+ textAlign: TextAlign .center,
401+ style: TextStyle (
402+ fontWeight: FontWeight .bold,
403+ fontSize: 12 ,
404+ ),
405+ ),
406+ ),
407+ ),
408+ ],
409+ ),
410+ const SizedBox (height: 8 ),
411+ // Images row
412+ Row (
413+ crossAxisAlignment: CrossAxisAlignment .start,
414+ children: [
415+ // Original image
416+ Expanded (
417+ child: GestureDetector (
418+ onTap: () => _showFullImage (
419+ context,
420+ 'Original / 原图' ,
421+ Image .file (
422+ File (_selectedImagePath! ),
423+ fit: BoxFit .contain,
424+ ),
425+ ),
426+ child: Container (
427+ decoration: BoxDecoration (
428+ border: Border .all (
429+ color: Colors .blue.shade300,
430+ width: 2 ,
431+ ),
432+ borderRadius:
433+ BorderRadius .circular (8 ),
434+ ),
435+ child: ClipRRect (
436+ borderRadius:
437+ BorderRadius .circular (6 ),
438+ child: Image .file (
439+ File (_selectedImagePath! ),
440+ fit: BoxFit .contain,
441+ ),
442+ ),
443+ ),
444+ ),
445+ ),
446+ const SizedBox (width: 8 ),
447+ // Processed image
448+ Expanded (
449+ child: GestureDetector (
450+ onTap: () => _showFullImage (
451+ context,
452+ 'Processed / 处理后' ,
453+ Image .memory (
454+ _processedImageData! ,
455+ fit: BoxFit .contain,
456+ ),
457+ ),
458+ child: Container (
459+ decoration: BoxDecoration (
460+ border: Border .all (
461+ color: Colors .green.shade300,
462+ width: 2 ,
463+ ),
464+ borderRadius:
465+ BorderRadius .circular (8 ),
466+ ),
467+ child: ClipRRect (
468+ borderRadius:
469+ BorderRadius .circular (6 ),
470+ child: Image .memory (
471+ _processedImageData! ,
472+ fit: BoxFit .contain,
473+ ),
474+ ),
475+ ),
476+ ),
477+ ),
478+ ],
479+ ),
480+ ],
481+ ),
359482 ),
360- const SizedBox (height: 8 ),
361- ClipRRect (
362- borderRadius: BorderRadius .circular (8 ),
363- child: Image .memory (
364- _processedImageData! ,
365- fit: BoxFit .contain,
483+ const SizedBox (height: 12 ),
484+ // Tap to view full size hint
485+ Center (
486+ child: Text (
487+ 'Tap images to view full size / 点击图片查看大图' ,
488+ style: TextStyle (
489+ fontSize: 11 ,
490+ color: Colors .grey.shade600,
491+ ),
366492 ),
367493 ),
368494 ],
@@ -387,4 +513,48 @@ class _AllTestsPageState extends State<AllTestsPage> {
387513 ),
388514 );
389515 }
516+
517+ void _showFullImage (BuildContext context, String title, Widget image) {
518+ showDialog (
519+ context: context,
520+ builder: (context) => Dialog (
521+ backgroundColor: Colors .black,
522+ insetPadding: const EdgeInsets .all (16 ),
523+ child: Column (
524+ mainAxisSize: MainAxisSize .min,
525+ children: [
526+ // Header
527+ Container (
528+ padding: const EdgeInsets .all (12 ),
529+ color: Colors .black87,
530+ child: Row (
531+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
532+ children: [
533+ Text (
534+ title,
535+ style: const TextStyle (
536+ color: Colors .white,
537+ fontWeight: FontWeight .bold,
538+ ),
539+ ),
540+ IconButton (
541+ icon: const Icon (Icons .close, color: Colors .white),
542+ onPressed: () => Navigator .pop (context),
543+ ),
544+ ],
545+ ),
546+ ),
547+ // Image with InteractiveViewer for zoom/pan
548+ Flexible (
549+ child: InteractiveViewer (
550+ minScale: 0.5 ,
551+ maxScale: 4.0 ,
552+ child: image,
553+ ),
554+ ),
555+ ],
556+ ),
557+ ),
558+ );
559+ }
390560}
0 commit comments