I am trying to make Gallery App. Where I need to fit images into a fixed-size widget, and it can be moveable.
Here is Example.
Related
I have a car image and i want to make user enable to tap on apart of it then the tapped part name will be shown. How can i do it?
Like this image but i want to use car image not a map.
I think the way I'd do this, is use a Stack to overlay a GestureDetector on your image and see what the coordinates are. You could even use a CustomClipper with some custom shapes, or overlay multiple Positioned widgets with separate listeners on it, depending on your needs.
https://api.flutter.dev/flutter/widgets/GestureDetector-class.html
https://api.flutter.dev/flutter/rendering/CustomClipper-class.html
I have a single PNG image(32px X 128px). Each 32px square contains a image as shown below.
What widget(s) should i use in flutter to provide this image as input and expect a GIF like animated image?
If that is not possible, how can i import few images(maybe 4 images) and display them one after the other inside the same Container, to make the image look like its animating?
Use this package spritewidget https://pub.dev/packages/spritewidget
I'm trying to show a ui panel using unity3d ,I have a main camera scene after i click a button ,i want my scrollable panel to show up
just like this
after i click the menu button i want the scrolling ui to appear like this.
It'd be great if someone could point out some kind of a tutorial that would cover this.
You need the following:
Image component - This is used to represent the items you want
to display
Grid Layout Group component - This is used to arrange those
image components you want to display.
Content Size Fitter component - This is used to make sure
that those Images fit in the Grid Layout.
The video from here should show you how to use these 3 together to get what you are looking for. To detect which Image is clicked, see this post.
I need it because the image is small and it's difficult to touch it on the mobile device. So I need to have bigger area of interactable zone but the image should stay small.
I believe the most proper way to make such button is like this:
Create a new Button, remove default child Text.
Set Width and Height of Button as you need for hitzone size.
Add Vertical Layout Group component to the Button.
Set Padding of the Vertical Layout Group to desirable difference between hitzone and visuals.
Remove default Image component. Set alpha of default Image component to zero.
Put your Image as child of Button.
Fix tint: drag (or otherwise set) the child Image to Target Graphic field of Button.
You need to set it up so that the image is inside a button object. Like this:
This way you can have the Button as big as you want and the Image can be any size. If you don't need the Button background image just make the color transparent in the image componenent of the Button object.
A surprisingly better way (in terms of ease and performance) is to add a text child element, even if you already have one. Leave the text empty and resize it however you like. It doesn't add any alpha.
Unity now have Raycast Padding property on Image component, edit these padding values will allow you to have more interactable zone for your button image. Note that you use negative value to extend the click zone.
Image raycast padding
I am trying to build 15-puzzle game.
Here I need to swap a blank image with a clicked on image. I would like to know how to swap these images.
I have stored the co-ordinates of the two images,but don't know the format to identify the blank image and then set its origin to clicked image.
Present each tile as a CALayer. To swap two tiles, set each layer's position to the other's position.