How to rotate an image of CachedNetworkImage in flutter? - flutter

It's flutter app. It's an app with portrait-only mode.
I want to show some images of my product. When user touches the image,
I would like to show it on full screen using CachedNetworkImage.
But the problem is, when width is bigger than height, Boxfit.cover only shows middle part of image (left and right side not shown). If I make it dispaly all picture, then there'll be so much empty space above and below
I would rather to make the image(CachedNetworkImage) rotate 90 degree, so that whole image can fit the full screen.
Any idea?

Related

How can I lay out the following screen in flutter

I am new to Flutter and trying to convert my iOS app to Flutter. However, I am having difficulty laying out the screen. Below is what the iOS screen looks like. I keep on getting red screens with layout errors saying it cannot layout the screen. When I add a column and add to that an image and a horizontally scrolling grid in Flutter I get the layout errors. How can I layout this screen?
I think it should have a column as the main widget. Then, a large image should be displayed, which displays centered width-wise on the screen. It should be constrained height-wise and wide enough not to distort the image. The photos come in a variety of heights and widths.
Then there should be a large text field centered width-wise in the central column. Then a breed text box is centered width-wise in the central column and followed by a line of stats—lastly, a city, state, and miles.
Then a centered list of icons with a single line of text-centered underneath each icon. Finally, the whole icon bar should be centered width-wise in the column.
Next, there should be a line of small photos of the cat, which is left aligned to the column and fills to the right going off-screen and scrollable horizontally. It should be a grid with a staggered layout width-wise. Each image should be a fixed height and a ratio of width to fixed height to fit the image without distorting it. The images should have rounded corners. The width and height of the source image are known ahead of time and need to be adjusted to fit the new fixed height.
Lastly, there should be a web browser that fills the width of the column with a height large enough to hold the content of the HTML without scrolling the web browser so the whole screen looks like it is one screen.
The whole screen should be able to scroll vertically but not horizontally to see the main column's total content.
Below is what the screen should look like:

How to keep the same resolution of canvas on different screen resolution?

First of all, sry for my English mistakes, I'm not a native English speaker.
I'm trying to make an UI which is composed of a canvas within different gameObject, and I would like that my canvas scales to the dimension of the screen but keeps its original resolution (16x9 portrait). If it is displayed on a tablet resolution (4x3) then an image is displayed in the space that is not covered by the canvas.
But actually all I've got is a canvas which scales to every resolution, and it changes the aspect of its child (for example a square becomes a rectangle).
Thank you for showing interest in my query!
UI's are heavy beasts. Canvas in Unity have a component attached to themm called Canvas Scaler which is set by default on Constant Pixel Size. You may try to set this property on Scale With Screen Size and then specify the base resolution you want to work with (usually 1920x1080 is a console standart). This is your first step
Then, to avoid strange Image scaling, you may check the property Preserve Aspect, this way the ration of the Sprite into your Image will remain the same indepently of the ratio of the Image
Last, you may play a bit with anchors but this is another story, you should let those at plain center at the beginning and come back to it when you will feel ready
Hope that helped ;)
Your canvas should have a component called Canvas Scaler. Here it should say Constant Pixel Size, change this to Scale With Screen Size and it should lock the Canvas to be the same width / height as the screen. If you want to lock an image to a specific width/height ratio, go to the Image component on the image and check the Preserve Aspect checkbox. This way if you have a 100x100 image, the images width will always be the same as the height. If you have a 200x100 image, the images width will always be twice the height, etc etc etc.

Unity - Keeping UI centered no matter the screen resolution

I want to keep my UI looking the same no matter which resolution the screen is at I am running of 16:10 in my game view and I want the UI to stay the exactly the same and centered even if the screen resolution changes.
Screenshot of UI
For the UI in the screenshot, I assume you want it always at the bottom of the screen and always the width of the screen.
For always taking up the width of the screen, select your canvas and go to its canvas scalar component. 'Change UI Scale Mode' to 'Scale with Screen Size' and adjust Reference Resolution to a resolution that looks good for you. Then the canvas elements will be the same width on all resolutions.
For always staying centered at the bottom of the screen, select the UI elements themselves, or their parent if they have one. Change their anchor to bottom center.
For more information about how to design for all screen resolutions, check the documentation as Hellium suggested!

Is iPhone's Safari resolution treated differently than the rest of the device?

I have an image that is 480x270. In theory this should occupy all the space between the battery bar on top and the navigation bar at the bottom when the phone is rotated on to its side. However, inexplicably the image is displayed shrunken to where it barely occupies 1/2 the screen horizontally.
I thought perhaps the phone is shrinking the image for some reason, so I just created a div that has its dimensions set to the same size as the image and nothing in it but a background color. The phone displays this rectangle of color in exactly the same dimensions as the graphic.
So, the question is, is Safari compensating in some way and displaying things in a reduced ratio, and if so, WHAT is that ratio?! (or am I just totally out of my mind?)
Check out viewport.

image Gallery in iPhone

I need to Create an Image Gallery that may be use concept of scrolling and paging together.
When I click on a button, it will open a new view in landscape mode. This view is for my Image Gallery..
It shows 5 Images:
Centered Large Image With its description on Bottom.
Next Coming image on left side, This image is slightly tilled at some angle, Without any description at bottom.
next to next coming image on left to 2nd image.
previous image on right side, This image is slightly tilled at some angle, Without any description at bottom.
Previous to Previous image on right of 4th image
Moreover, all images should be scrollable, like when I scroll 2nd image, it will move to Center and show its description and image which is already centered move to previous image.
Sorry for my confused English, here's an example of what I am trying to obtain.
I tried for basic code of paging and scrolling but unluckily nothing helpful.
Could you give me some pointers?
Check out flowcover (see this question: Open source CoverFlow library for iPhone), which should get you started.
I think someone reported flowcover doesn't work on iOS 4.0, I haven't tried yet, ofcourse.
But, you can also take a look to this OpenFlow project, It will be help you I guess. Many people has builts their app on this library.