Do you know how can i make a textfield draggable on flutter and also that its height and its width increases while the user types (not predetermined) ?
The idea is put like every user can write something and move it across the screen.
Im savings the screen coordinates in order, that if the user enters from another device will see the text in the location he left it before.
If already tried with a code i found that uses positioned and stuff but since i have to predefine the width/height of the box, the offset location is not accurate when im showing it on other screen.
Thank you
Try using the InteractiveViewer,
https://api.flutter.dev/flutter/widgets/InteractiveViewer-class.html
Related
I have a long, scrollable list of widgets, and need to be able to restore the correct position in the list whenever the user switches from portrait to landscape, because the content is mainly text.
For now, I am using scrollable_positioned_list, but it isn't enough in some cases because its position is of course based on its immediate children. But when the child itself contains a bunch of other widgets, you get very imprecise positionning.
What I would want to do is to go down to the individual RenderParagraph or equivalent level, and look at their position in the viewport (using getOffsetToReveal for example) in order to position the scroll correctly.
In more descriptive steps :
I keep track of the "topmost" RenderObject,
The user goes from portait to landscape,
I scroll the list until the equivalent RenderObject is again the "topmost".
But to do that, I would need to get a listing of all RenderObjects currently in a given viewport, and I do not know how.
There also is visitChildElements, but the docs warns that is it potentially performance-intensive.
Thanks in advance. Other ideas around this problem are welcome too !
I currently have a problem on a UI.
The button on the phone moves when changing resolution and changes size as well. On the screenshots, it is in the General Panel. I also tried to put a second panel of the size of the phone, but it is all this panel that moves and changes size. How can I do, to keep the buttons at the right size and in place, as the background does when changing resolution?
Thanks in advance !
You need to change the UI Scale Mode to "Scale With Screen Size".
THe Reference Resolution can help you place items in the editor. You can choose wether you want the width or the height (or a mixture) to be preferred when fitting the canvas to the resolution.
If you, for example, choose "Width" in the "Match" slider, the elements will never overshoot horizontally. This would be perfect for wrapping textfields.
So I am working working on something in unity (2d game). I have a list of button (UI) on my scene and I want to implement a scrolling mechanism. What is the best way to go about it? Currently , I can scroll through horizontally because I have added a "scroll rect" to the the canvas holding the buttons as I start the game. However when I try to scroll back (horizontally, it goes beyond the Buttons. Is there a way to make the scrolling continuous such that as I scroll, from the first UI element when I get to the last one and I keep scrolling, it continues with the first element. or what should I do. please let me Know If i should clarify.
In the Scroll rect you can set the movement type. I don't think the kind of "infinite scroll" you are asking for is available.
For your case, I think that the Use Elastic or Clamped mode to force the content to remain within the bounds of the Scroll Rect should do the work.
In the case of the infinite scroll specifically needed, you would need to ask for that explicitely and show your attempt for more specific help.
I think there is a bug in Row and Column in flutter as you can see from the image attached below. I was creating a custom calendar and noticed that there is a small space between some items that varies with the screen resolution. So i tested it on the Web with the built in layout editor and i found the same bug.
If i change my page zoom the space comes and goes according to my zoom percentage as you can see the picture.
I need the solution to this problem as i am stuck on this last problem.
I have a graphic that is 3 times the width of an iphone landscape view.
I am trying to auto scroll it so that it appears that it is moving sideways, without using the touchscreen scrolling method.
My aim is to maybe have a button you can press and it moves it left or right across the screen like an animation.
I can deal with everything else but am having trouble finding a solution.
Any example code would be appreciated or even any info on whether it is possible or not.
Thanks. Dave
You can wrap a UIView in an animation block. The animation sweeps the origin value in its frame property from one point to another, over a set period of time.