import 'package:cached_network_image/cached_network_image.dart';
import 'package:eitc_erm_app/utils/Constants.dart';
import 'package:eitc_erm_app/utils/logger.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';

class ImagePreviewPage extends StatelessWidget {
  final String imageUrl;

  ImagePreviewPage(this.imageUrl);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Global.StatusBarColor,
        leading: IconButton(
            color: Colors.white,
            onPressed: () => Navigator.pop(context),
            icon: const Icon(Icons.arrow_back_ios_new)),
      ),
      body: Hero(
          tag: imageUrl,
          child: PhotoView(
            imageProvider: CachedNetworkImageProvider(imageUrl,
                errorListener: (o) => loge("图片加载失败", error: o)),
          )),
    );
  }
}
