Custom TextField in Flutter: add superscript - flutter

Is it possible in flutter to develop custom TextField to input numbers with superscript like 102 ?

Well, there has to be a way for the user to specify that he is getting into (and out of) superscript mode (say using a specific key). Using a TextInputFormatter to 'trap' these locations - there should be a way to then display the text the way you wanted.
Alternatively, as in stackoverflow where we use ``` to highlight code and there is a display-only section that shows how the text looks, you can do all sorts of text display for formatting the text as per the codes in the typed text without needing to use the TextInputFormatter method.

Related

Adding line counter to a text field

I want to add a line counter to a textfield for a sort of text editor. Looking around, I've seen that a lot of questions on this topic are either unanswered, or do not answer in a satisfactory manner. Something like this How to add prefix widget on every new line in textfield in flutter? asks fundamentally the same question I am, however the only answer there is to create a new widget for each line.
This is one method that could be used, where I add new textfields in a list and build them in a row with their respective line number. However, this means I cannot have those textfields function on more than one line, and I will need to add more textfields each time a user wants to add enough text to make it overflow. The biggest flaw I see with this, though, is that it makes it harder (if not impossible?) to easily select and edit text as you would expect from a text editor, such as using the built in systems for a textfield.
Now, for my solution I am using https://pub.dev/packages/extended_text_field as a way to gain some functionality that I don't really want to take the time to figure out how to do on my own (embedded onClick callbacks for text), so it would be ideal if I could continue to use that without having to fork or even have to figure out how to write my own version.
The primary issue I'm running into is not necessarily getting the number of lines, which can be found using some solutions from How can I add line numbers to TextField on Flutter?, but rather how and where to show those line numbers.
As above, it's not really ideal to pair some number alongside a textfield and create a new textfield for each expected line. What would be ideal, however, is something like , where each line number is prefixed to the line built by the text field. For example, like this: . Something like the solution proposed in Add a prefix to every line in a multiline Text Input in Flutter? would not work especially well, because the solution there is to literally add string values to the textfield, which would require systems to clean the text, in addition to causing an unexpected ability to actually change the numbers (or other line prefix) by the user.
So -- is there any way to implement a line prefix for each line in a textfield? Would it be possible to override an InputDecoration (which allows creating the individual line prefix, but nothing more) to create a line prefix for each line drawn by the textfield? If not, exactly what would be needed to create this? I am familiar with flutter, but I am not quite as familiar with the lower level API's.

How to have text of 2 different colors with Material-UI text field?

I'm trying to add an autocomplete feature in my project and I'd like the possible autocomplete data to be a greyed out, unselectable and without affecting the user typing.
If I could get the placeholder to be always visible that could work.
I tried setting the value prop of TextField to an JSX.Element but it only accepts primitive types. Fortunately I am using monospace fonts.
What are my options?
A div that is always visible and on-top?
2 text field next to each other with no padding or margin?
Somehow make the placeholder always visible?
Forced example (ignore the cursor)

How to indent if Text is softWrapped in Flutter

I'm working on an app that displays lyrics for several hymns in my native language.
Each line of the hymn is an individual Text Widget. I want the text to indent if it got softWrapped if user increases the font size to indicate that its not the next line. How can I achieve this effect?
Adding one or more tab escape characters "\t" to your strings may do the trick for you:
Text("\t this is a text string that will have an indentation",),

How to get the selected text's size(px) and font weight?

I am trying to get selected text's size(pixel) and font weight(pt) with AutoHotkey like HTML attributes. How do I do?
I have done some search on google and have found this:
Function: GetTextSize - Calculate text dimension
But every text have its own font-type and how this code works correctly for other font types?

MS Word - Create Style with Pre-made text

So I am making a ms word template and was creating a custom style that would have a pre-determined text. Example is, after clicking the custom style, it would generate an auto text:
Fig.1. Insert text here
Would that be possible?
Best regards.
No, this is not possible. Static text cannot be part of a Word style. If you're numbering something, then you can include static text as part of the numbering definition, for example Figure + number. Link the numbering definition to a style and you'll get that text when applying the style. But everytime you apply the style the number will increment.
Otherwise, use BuildingBlocks/AutoText, formatted with the style, and insert that - which will automatically apply the style.