<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Bárbara Watanabe on Medium]]></title>
        <description><![CDATA[Stories by Bárbara Watanabe on Medium]]></description>
        <link>https://medium.com/@barbswatanabe?source=rss-68d9f7c684b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Bárbara Watanabe on Medium</title>
            <link>https://medium.com/@barbswatanabe?source=rss-68d9f7c684b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 17:48:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@barbswatanabe/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zoom-Draggable your images with Flutter]]></title>
            <link>https://medium.com/@barbswatanabe/zoom-draggable-your-images-with-flutter-a32ac166dadd?source=rss-68d9f7c684b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a32ac166dadd</guid>
            <category><![CDATA[code-newbie]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[Bárbara Watanabe]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 01:57:23 GMT</pubDate>
            <atom:updated>2018-07-23T01:57:23.964Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone! I thought I’d write a quick tutorial on how to zoom and drag and drop with Flutter, because I didn’t find this kind of tutorial together and I think this might give some light to anyone who needs it. In addition, I will also show how to use the image picker plugin, a great package that can help you take photos or choose an image from the gallery.</p><p><strong>First step</strong><br>- Start a new project<br>- In the <em>pubspec.yaml</em> file, include the <a href="https://pub.dartlang.org/packages/image_picker">image_picker</a> plugin inside the dependencies and don’t forget to run the <em>flutter packages get</em></p><pre>dependencies:<br> flutter:<br> sdk: flutter </pre><pre> cupertino_icons: ^ 0.1.2<br> <strong>image_picker: “^ 0.4.5”</strong></pre><ul><li>inside <em>lib/main.dart</em>, import the packages that we’ll use in this tutorial:</li></ul><pre>import ‘dart:io’;<br>import ‘package:image_picker/image_picker.dart’; <br>import ‘package:vector_math/vector_math_64.dart’ as vector; <em>//we&#39;ll need later to create the zoom</em></pre><p><strong>Second step</strong><br>Let’s change some things to looks like the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*MgULdcPvKIzG3t56E5jG6A.jpeg" /></figure><p>- First, let’s change the body content to a Container, which will show the images.<br>- Change the icon of the floatingActionButton to a camera icon, because it’ll now trigger the camera.<br>- Lastly, create a new button to choose the images from the gallery.</p><p>The code should look similar to this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc3ba7395437b18a71b2c897075e13b7/href">https://medium.com/media/cc3ba7395437b18a71b2c897075e13b7/href</a></iframe><p>Once this is done we’ll create two functions: one to trigger the gallery and one to trigger the camera.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3d45df694946b225fc882eab85f077b/href">https://medium.com/media/c3d45df694946b225fc882eab85f077b/href</a></iframe><p>Now you can take a picture and choose images from the gallery! Let’s zoom it and pan the image now.<br> <br><strong> Third step</strong><br>Let’s create a DragImage class that will be responsible for the zoom and drag and drop of the image. This way, we keep the code easier to understand. This class will receive two parameters: an offset that is the original position (like a Cartesian plane) and the image. The container will remain this way.</p><pre>new Container(<br> child: _image == null ? null : new DragImage(Offset(0.0, 0.0), _image),<br> ),</pre><p>Let’s create the class:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2738ca3d1f45735f911072ea0b1538bc/href">https://medium.com/media/2738ca3d1f45735f911072ea0b1538bc/href</a></iframe><p>And finally, we need to tell the DragImage class that you have changed the images, if you chose / took a new photo:</p><pre><a href="http://twitter.com/override">@override</a><br>    void didUpdateWidget(DragImage oldWidget) {<br>      setState(() {<br>              _image = widget.image;<br>            });<br>      super.didUpdateWidget(oldWidget);<br>    }</pre><p>And that’s it! I hope I’ve helped a bit! Special thanks to <a href="https://github.com/tensor-programming/Flutter_Drag_Tutorial">Tensor programming</a> who had the initiative to share the tutorial of drag and drop the images.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a32ac166dadd" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>