| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import 'package:bbyyy/my_tools/AsperctRaioImage.dart';
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:flutter/material.dart';
- class PictureDisplayPage extends StatefulWidget {
- String imagePath;
- PictureDisplayPage(this.imagePath);
- @override
- _PictureDisplayPageState createState() => _PictureDisplayPageState();
- }
- class _PictureDisplayPageState extends State<PictureDisplayPage> {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.black,
- body: Column(
- children: <Widget>[
- Expanded(
- child: GestureDetector(
- child: AsperctRaioImage.network(widget.imagePath,
- builder: (context, snapshot, url) {
- double h = (snapshot.data.height.toDouble() / 5);
- double w = (snapshot.data.width.toDouble() / 5);
- bool fw = h / w >=
- MediaQuery.of(context).size.height /
- MediaQuery.of(context).size.width;
- print('h-------------$h\nw----------------$w');
- return CachedNetworkImage(
- imageUrl: widget.imagePath,
- height: fw
- ? h / w * MediaQuery.of(context).size.width
- : MediaQuery.of(context).size.height,
- width: fw
- ? MediaQuery.of(context).size.width
- : w / h * MediaQuery.of(context).size.height,
- );
- }),
- onTap: () {
- Navigator.pop(context);
- },
- behavior: HitTestBehavior.translucent,
- ),
- )
- ],
- ),
- );
- }
- }
|