showImageDialog function
Implementation
void showImageDialog(BuildContext context, Uint8List bytes) {
showGeneralDialog(
context: context,
pageBuilder: (context, animation, secondaryAnimation) {
return Center(
child: Material(
type: MaterialType.transparency,
child: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width * 0.9,
height: MediaQuery.of(context).size.height * 0.9,
padding: const EdgeInsets.all(16.0),
color: Colors.white,
child: InteractiveViewer(
maxScale: 5,
child: SvgPicture.memory(bytes),
),
),
Positioned(
top: 10,
right: 10,
child: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: const Icon(
Icons.close,
color: Colors.grey,
size: 30,
),
),
),
],
),
),
);
},
barrierDismissible: true,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 200),
);
}