Programmatic Control of Edit Widget Font Size? - swift

SwiftUI offers .dynamicTypeSize(...) to control/limit the impact of user Text size preferences. An app developer, for example, can limit dynamic type to DynamicTypeSize.xxxLarge rather than allow a larger accessibility size that might complicate UI design.
https://developer.apple.com/documentation/swiftui/dynamictypesize
Can a developer also limit dynamic type size of a widget's configuration UI ... the UI that appears after users long-press on a widget then select Edit Widget?

Related

Flutter: Make text/images selectable in whole web app

In the Flutter web apps, there is no default functionality which makes text and images in the app selectable.
Is there a way to enable selection functionality for text/image on web?
I did check SelectableText widget but it is only for text and I would need to use it over every text. Also, you can't select text in multiple SelectableText widgets at once, you can only select text in one of them. I'm looking for a solution to select all text in the app without making change to every text widget.
Let me know if there’s one step solution to achieve this thing in whole web app.
In Flutter 3.3, with the introduction of the SelectableArea widget, any child of the SelectableArea widget has selection enabled for free!
To take advantage of this powerful new feature, simply wrap your route body (such as the Scaffold) with the SelectionArea widget and let Flutter do the rest.
For a more comprehensive deep dive into this awesome new feature, please visit the SelectableArea API page.
Flutter Web currently does not support multiple text selection across SelectableText widgets.
However, there are some experimental widgets that people are currently working on. According to a guide available at:
Custom SelectableScope Widget
They have proposed a custom widget, a Selectable scope, which basically allows for anything within it to be selectable (currently text and images)
NOTE: THIS IS CURRENTLY UNDER EXPERIMENTATION AND MIGHT CHANGE AS MENTIONED IN THE PROVIDED LINK.

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.

How to check visibility of a Flutter widget even when covered by another

I'm trying to find a way to check the visibility of a Flutter widget when it's either off screen or when it's obscured by another, for example Drawer, Dialog or BottomSheet.
visibility_detector helps with checking whether it's on the screen or not but does not work with the second use case (known limitation).
Is there a lower lever api that I can use to check whether a widget is actually visible to the user?
My use case: I'm adding a widget to the Overlay when something external happens (similar to Tooltip but not on long press). If the user opens for example the Drawer, the widget will appear on top. I want to detect that the child is not visible and delay or cancel the action.
Do I understand your problem?
You have a widget you want to always be on top?
You want the user to interact with that widget first before doing other things?
Use design patterns to make coding easier, your users will thank you.
You can show a Dialog on-top of other widgets with the showGeneralDialog or showDialog functions. Because Dialogs are a design-pattern used in many apps, users will already know how to use them.
Define app behavior with explicit state.
It is too hard to derive app behavior from rendered UI, not all devices are the same size and shape. This means you should try to write a variable that describes your situation and then write the code you need to make that variable's value correct. It sounds like you want a variable like bool overlayIsShowing.

How to change Widget style in SWT, of existing widget

How to change Widget style in SWT, of existing widget, Means i am working on ProgressBar and i want to change it's style SWT.VERTICAL from SWT.HORIZONTAL
You can't, styles are fixed once the control has been created.
In some cases SWT may use a completely different native control to implement the SWT control depending on the style flags. For example on macOS a Combo with the SWT.READ_ONLY style uses a different macOS control to a read/write Combo. This would make allowing you to change the style very complex.

How to make widget to occupy all the available space in Gtk.HBox

I am implementing a custom Gtk# widget which is based on Gtk.EventBox. When I am inserting it into the HBox or VBox it occupies the exact size that is returned by OnSizeRequested method.
How can I make my widget to occupy all the space given to it by the parent box, window or the widget? Just like HBox does.
There is a slight different between the preferred way to do packing in GTK+2 vs GTK+3. With GTK+ you would typically use expand and fill properties of a GtkBox to control how space is allocated. With GTK+3 they are suggesting the user of vertical-expand, horizontal-expand, vertical-fill, horizontal-fill.
A good way to understand how packing works is to play with the fill and expand properties with Glade so you can see the effects in real time. An old tutorial (slightly out of date) shows some screenshots of different packing properties: How_Packing_Effects_the_Layout
As you are developing a widget it is more likely that users of your widget will determine how it should be packed in a larger UI. However, if you're widget is a composite widget (built from other widgets) then you will need to pack the other widgets properly.
PackStart and PackEnd have a fill parameter to specify items that should expand to fill the box. You probably want PackStart(widget, true, true, 0);