image_view.dart 925 B

12345678910111213141516171819202122232425262728293031
  1. import 'package:cached_network_image/cached_network_image.dart';
  2. import 'package:eitc_erm_app/utils/Constants.dart';
  3. import 'package:eitc_erm_app/utils/logger.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:photo_view/photo_view.dart';
  6. class ImagePreviewPage extends StatelessWidget {
  7. final String imageUrl;
  8. ImagePreviewPage(this.imageUrl);
  9. @override
  10. Widget build(BuildContext context) {
  11. return Scaffold(
  12. appBar: AppBar(
  13. backgroundColor: Global.StatusBarColor,
  14. leading: IconButton(
  15. color: Colors.white,
  16. onPressed: () => Navigator.pop(context),
  17. icon: const Icon(Icons.arrow_back_ios_new)),
  18. ),
  19. body: Hero(
  20. tag: imageUrl,
  21. child: PhotoView(
  22. imageProvider: CachedNetworkImageProvider(imageUrl,
  23. errorListener: (o) => loge("图片加载失败", error: o)),
  24. )),
  25. );
  26. }
  27. }