Is there a way to know which position text overflow occurred in Flutter? - flutter

I have several text boxes of different widths sequentially in one of my layouts, and I need to know where overflow occurred in a Text widget so the next Text widget can pick up where the last one left off.
Been looking around in the documentation for a way to check wherein a Text widget an overflow occurred, but haven't been able to find anything. Is this possible at this point?

Related

how to avoid the overlapping of many overlay widget - flutter

0
in my case I have a bunch of questions and each question have a list to choose one of the existing answers displayed in overlay widget.
for my list i used an overlay.
the problem is if there is other overlay, they will hide each other same as stack order its child (the last child widget will be overlapping above the other children of stack) the
the result of my code looks like:
before click the first overlay to animate to the big size
after click the overlay widget
I cant use the entry.remove() cause I want the overlay stay shown but only the size will change to small size after user choose one of the displayed answers. (I'm using animatedContainer for that)
I'm looking for a way to make the selected widget overlay above the other overlay widgets
so any suggestions to solve this? or maybe the way of implementation is wrong ? and thanks
something like this (the selected one will always shown at the top)
https://pub.dev/packages/indexed

Is there a way to calculate a dynamically sized widget?

I'd like to add a custom showMore widget if the skills widget which has a dynamic size(width) exceeds the screen width. On clicking the showMore widget it should show all the skills in a wrap .else show less.
In flutter
Constraints go down and sizes go up
See this documentation.
Flutter uses a single pass algorithm to render your application. This is a technical choice to ensure performance but it comes with limitations.
One of them is that, when you are building the widget tree, you only have access to the constraints of the parent, and not any size of any widget (since they are not rendered yet).
So a short answer to your question is:
No, you cannot do what you are trying to do (displaying something if some widgets are not fitting on the screen) since you don't have access to any sizes in the build method.
An alternative solution would be to use Wrap to wrap your chips or use a ListView on the horizontal axis to make the list of chips horizontally scrollable.
Anyway, if you really want to do this, you can hardcode the sizes of your chip and access the device size with MediaQuery.of(context).size or by using the LayoutBuilder and using contraints.maxWidth as the parent's width. Then you can check whether or not numberOfChips * chipSize <= maxWidth. But I wouldn't recommend it as the design wouldn't be responsive:
All the chips will have the same size, so you'll end up with a big chip for "c" and maybe a long name like "python" won't fit in and you'll end up with overflow issues.
What if the user changes the font size of his device? You will also end up with overflow issues.

Flutter ignore overflow when resizing

DartPad Sample
I have two widgets in a Row. One can be resized and one that shouldn't. When the space get's to small and overflow occurs (you can resize the panel in dart pad). I just want to ignore the overflow not change anything else about the behavior.
Wrapping it in a SingleChildScrollView with NeverScrollableScrollPhysics e.g. changes the overflow behavior.

question on wrap column with SingleChildScrollView

I had problem when keyboards up, The error occured "bottom overflowed by xx pixels".
So I resolved the problem by Wrapping column with SingleChildScrollView, and I wonder how It can happen? I s there special trick with SingleChildScrollView?
It happens because the keyboard takes up padding space from screen estate. So wrapping the column with SingleChildScrollView() essentially handles that by making your screen scrollable.
Hope this helpsāœŒ
Edit:
Also the second solution given by #EdwynZN is perfectly alright.
It just has one issue, if you have textfields that are in the region where the keyboard lies, the user won't be able to see them until they lower their keyboard. And that isn't considered a good UX practice.
So using SingleChildScrollView() is the best way to go, in regards to UI/UX.
SingleChildScrollView allows to scroll an area of the space if there is not enough to show the widget (in this case the column). When the keyboard appears the amount of space of the screen is reduced and it shows the overflow because the column cannot show the whole list of children, that's why you would need a scroll area. Another solution if you don't need to scroll is to change the parameter resizeToAvoidBottomInset: false in the scaffold

Is there any way to move the search box in Visual Studio Code?

As you can see in the below image, the search box is at the top right corner.
Sometimes this image will cover up the text underneath it. Is there a way to move the search box to some other place? For example, like Atom's or Sublime's search box.
NO, there is currently no way to move it.
There was discussion on this amongst the vscode developers: Find Widget UI enhancement.
We should definitely not make this move both vertically and
horizontally since we do not do this anywhere else in our UX.
Introducing such a new concept does not align well with our general
workbench UX which is not very flexible
Looking at the pictures the docked find widget at the top / bottom
feel too heavy for me.
The current find widget solution I like because it is similar to the
chrome experience which every user on the planet is familiar with
While implementing the docking solution, we found we can actually
split this two issues completely. For the issue of covering search
result, we can allow users to scroll beyond the first line by the
height of Find Widget. It doesn't change Find Widget at all, you can
only scroll beyond first line only when the Find Widget is visible so
it won't cover anything.
I made two changes to the Find Widget for this work item.
You can resize the Find widget horizontally
You can scroll beyond the first line when the find widget is visible.
Which gives us the only customizations we can do to the search/find widget if it (as you said) "covers up text underneath it":
You can adjust the width horizontally
You can set "editor.find.addExtraSpaceOnTop": true to allow "scroll beyond the first line when the Find Widget is visible"