import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';

class ChatImagePreviewScreen extends StatelessWidget {
  const ChatImagePreviewScreen({Key? key, required this.imgTitle, required this.img}) : super(key: key);

  final String imgTitle;
  final Uint8List img;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Navigator.of(context).pop();
      },
      child: Dialog(
        backgroundColor: Colors.transparent,
        insetPadding: const EdgeInsets.all(10),
        child: Stack(
          alignment: Alignment.center,
          children: [
            Image.memory(
              img,
              fit: BoxFit.cover,
              height: 400,
              width: double.infinity,
            ).paddingAll(10),
            const Positioned(
              right: 0,
              top: 0,
              child: Icon(Icons.cancel, color: MyColors.redA3Color, size: 35),
            )
          ],
        ),
      ),
    );
  }
}
