I am trying to implement an OTP UI like the one in the following image with Flutter:
The idea is that the keyboard and placeholder gray dots would be always shown and when the user enters a number, the corresponding placeholder dot color should be changed to blue.
I want know how to implement the logic of changing the placeholder dot color depending on the user input?
The described logic can be implemented with a variable to store the OTP code and then use it to determine the color of the placeholder dot depending on the length of the currently entered OTP.
I have created a demo example in this link which implements the same described logic, you can run it directly from DartPad.
Related
So, I want to make a custom spinner as you can show in the image.
Basically, a List of data will display and the mid one shows highlighted.
This design is for blood group selection. Mid data will be automatically stored in some variable.
like String selectedBg = B+;
The one you're looking for is called the Picker, and you can look at Flutter's documentation about it.
Cupertino Picker
Is there an efficient way to implement the next line completion in flutter textfield ?
The image shows the final result, the grey text is human written and the red is app generated which can be either appended to the editable on textfield or canceled.
You may add some prediction words after user's input and still keep the cursor on his/her last entered character using TextInputFormatter. Flutter already has built-in formatters like FilteringTextInputFormatter.
Just switch to text when you want to show the prediction, there is no other way to do this in flutter.
You simply cannot show other text and options on textfield in flutter
I am looking for changing colors of an illustration svg in flutter. I tried flutter_svg package but it support applying only one color to the svg and if I do that svg will be displayed as a single color svg, individual colors are lost. Is there any way to change colors at runtime in flutter for a multi color svg?
Do you mean something like this? I call it SVG colorization.
I'll try to squeeze the concept into a short summary. In an SVG file, you need to play around with the fill property as it defines the hex color code.
In terms of programming, you would:
Extract the SVG file data as a String variable svgCode.
Assign the previous hex color code in previousColor & the currently selected hex color code in newColor.
Apply the String.replaceAll method on svgCode to replace the colors.
Update the value of the previousColor.
A more brief elaboration would be
/// Initially without any color selection.
SVGPicture.string('''<svg code with fill #f7ebcb>''');
/// After the user selects the red color.
SVGPicture.string('''<svg code with fill #FF0000>''');
This tutorial can help to solve your issue. Not only does this app changes the color on runtime, but it also allows the user to download the manipulated SVG code.
I'm trying to create a generalized function/class that builds embedded hyperlinks. I am using an NSAttributedString with NSAttributedString.Key.link attribute and assigning a URL to the specified range. I can even specify multiple links within the body of text, with specific styles for the text. However the only caveat that I am seeing is that the highlighted state of the links have a grey background color. Is there a way to get rid of this background color, and on top of that assign a specified highlight state color for the link?
I am open to other means of creating the text and links, but I feel like NSAttributedString is the right means.
Again:
the body of text should be able to handle any number of links
each link can contain any number of words
the highlighted state shouldn't have a background color of grey, and be able to accept a specified color for a highlight state
the text should be able to wrap if needed
I am working on a SAPUI5 app in which we do not want to add custom css to. Currently we are displaying text in a form which does not have the same height and styling as the inputs.
I'd prefer to change the text to an input with a pre-filled value so everything in the form has consistent styling but I need to differentiate that this should be treated as text.
The easiest way to do this is to remove the border but I cannot find away of doing this without creating custom css.
I tried borderDesign="None" but this does not affect inputs.