online_picture_view_page.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import 'package:auto_route/annotations.dart';
  2. import 'package:cached_network_image/cached_network_image.dart';
  3. import 'package:eitc_erm_dental_flutter/funcs.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:photo_view/photo_view.dart';
  7. ///在线图片查看页面
  8. @RoutePage(name: "onlinePictureViewRoute")
  9. class OnlinePictureViewPage extends StatelessWidget {
  10. final String url;
  11. const OnlinePictureViewPage({super.key, required this.url});
  12. @override
  13. Widget build(BuildContext context) {
  14. return Scaffold(
  15. appBar: AppBar(
  16. title: Text(getS().viewPicture),
  17. centerTitle: true,
  18. ),
  19. body: SafeArea(
  20. child: Container(
  21. color: Colors.black,
  22. child: PhotoView(
  23. imageProvider: CachedNetworkImageProvider(url),
  24. errorBuilder: (ctx, obj, stacktrack) {
  25. logd("在线查看图片,图片加载异常", error: obj, stackTrace: stacktrack);
  26. return Center(
  27. child: Icon(
  28. size: 100.r,
  29. Icons.image_not_supported_outlined,
  30. color: Colors.white,
  31. ),
  32. );
  33. },
  34. ),
  35. )),
  36. );
  37. }
  38. }