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 Dialog(
      backgroundColor: Colors.transparent,
      insetPadding: const EdgeInsets.all(10),
      child: Stack(
        alignment: Alignment.center,
        fit: StackFit.loose,
        children: <Widget>[
          Image.memory(
            img,
            fit: BoxFit.fill,
          ).paddingAll(15),
          Positioned(
            right: 0,
            top: 0,
            child: Container(
              width: 30,
              height: 30,
              alignment: Alignment.center,
              padding: EdgeInsets.zero,
              margin: EdgeInsets.zero,
              constraints: const BoxConstraints(),
              color: MyColors.white,
              child: const Icon(
                Icons.cancel,
                color: MyColors.redA3Color,
                size: 30,
              ),
            ).onPress(() {
              Navigator.of(context).pop();
            }).circle(35),
          )
        ],
      ),
    );
  }
}
