Home > OS >  Add zoom that works with my image - flutter
Add zoom that works with my image - flutter

Time:10-22

Good morning, I need to add zoom to my image, I have not been able to make the zoom work, if anyone could help me I would appreciate it.

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ImageScreen extends StatelessWidget {
  final url;

  ImageScreen({
    Key key,
    @required this.url,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: CachedNetworkImage(
        imageUrl: '${this.url}',
        // Ajust the image changing the box fit attributte
        //fit: BoxFit.cover,
      ),
    );
  }
}
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

You can try wrapping your image in the InteractiveViewer widget, like this:

InteractiveViewer(
  child: CachedNetworkImage(
    imageUrl: '${this.url}',
  ),
),

This widget provides pan and zoom interactions with its child, check out the Flutter's Widget of the Week video about it here.

CodePudding user response:

Try this package, it's easy to use and does what you want: https://pub.dev/packages/photo_view

  • Related