import 'package:flutter/material.dart';
import 'package:test_sa/extensions/widget_extensions.dart';

import '../new_views/app_style/app_color.dart';

class FullScreenImageViewer extends StatelessWidget {
  final Widget child;

  const FullScreenImageViewer(this.child, {Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: [
          InteractiveViewer(clipBehavior: Clip.none, panEnabled: true, minScale: 0.5, maxScale: 4.0, child: child).center,
          SafeArea(
            child: Padding(
              padding: const EdgeInsets.all(16.0),
              child: FloatingActionButton(
                heroTag: "full-screen-image-viewer",
                backgroundColor: AppColor.background(context),
                onPressed: () => Navigator.maybePop(context),
                hoverColor: Colors.transparent,
                splashColor: Colors.transparent,
                shape: RoundedRectangleBorder(
                  side: BorderSide(color: AppColor.borderColor(context)),
                  borderRadius: BorderRadius.circular(14.0),
                ),
                child: Icon(Icons.clear, size: 24, color: AppColor.icon2Color(context)),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
