| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import 'package:bbyyy/my_tools/AsperctRaioImage.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:cached_network_image/cached_network_image.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_svg/svg.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,
- ),
- )
- ],
- ),
- );
- }
- }
|