TextFormField or TextField with more buttons , multibuttons flutter - flutter

I'm new to flutter and I don't know how to do it, please tell me how to do it or a working option. because I've been trying for a very long time
https://sun9-east.userapi.com/sun9-18/s/v1/ig2/NhRxi0YKSHPdqxIaG37XCWUcygL--5igPancpM8aVbjVuZazevntosns_TcgcXzYaIZN37dpzHlCa7o9Hr41pz67.jpg?size=2142x482&quality=95&type=album
https://sun9-west.userapi.com/sun9-63/s/v1/ig2/IVIkAOvJzFSbBD5VsqgncEuhvZAq8D3EkMKSnzK8wXffnPiB2SvLE2Q2sUkNjvvJp9-fLYzh2Wp3PUv8mD6zBLVe.jpg?size=1550x949&quality=95&type=album
https://sun9-west.userapi.com/sun9-50/s/v1/ig2/WdrgTVpnxrH7mBUe1L3a3SvAepAIB4zxvl_CQKJim1O0JxddGe-qQN5JLiN-WfIcgecwXdwGGZ7UNHScnpP3TtN1.jpg?size=1578x239&quality=95&type=album
https://sun9-north.userapi.com/sun9-81/s/v1/ig2/ZQZqB1bibWQUseKiajkYuHETzNeTGSV1dc1D5IEHXiUlwuYS-Cebt9uT5VknD3xWBsXjLNkMiAk_siV287kUE0JG.jpg?size=2142x482&quality=95&type=album
TextFormField(
decoration: InputDecoration())

There's no possible option in the TextField or any equivalent widget for user input.
You can easily replicate those interfaces with layout widgets like Column and Row. If there's a case where you want to overlay other widgets on the TextField then you can stack them using Stack.
Else, if you need more advanced editor-like features, you can refer to packages like this.

Related

How can I code a editable textfield in a CustomPainter in Flutter

I have a CustomPainter extending class. Until now, I paint only rectangles with some static text in it. Now I want to improve this a little bit and want that the user of my Flutter-App can edit this text.
I added a TextEditingController to my Object-Class and tried this:
TextField textField = TextField(
controller: object.textController,
);
textField.createRenderObject(context).paint;
textFieldPainter.paint(canvas, Offset.zero);
}
Unfortunaly, there is nothing like a textField.createRenderObject-Function in Flutter. So I look for a idea how I can get my a "controlled Text" working.
I also played around with TextSpan(). But I can't set the Controller to this.
The following steps are not the best solution , but you can try this solution.
Steps:
create an OverlayEntry, put a (hidden) TextField into it with a FocusNode and TextEditController.
after added the overlay entry, request focus on the focusNode, so the keyboard will open.
Add an onChanged to the TextField, and notify the painter somehow (e.g. valueNotifier) on text change.
In the TextPainer use the TextEditController.text value
For me, the following solution fit:
I built a function that checks if a click was done within the dimensions of the rectangle. If yes, a "properties dialog" opens (currently only the text) and here the text can now also be changed.
I know, this is only a workaround and not a real solution to my question, but maybe the approach helps one or the other.

Create Vertical List in Flutter

I want to create this type of listview using flutter.
https://dribbble.com/shots/6872462-Food-ordering-app-Animate
You can find out more by clicking on this link. But I don't know how to create this type of list. I mean, you can see in the GIF that the list is indexed based.
A fixed indexed item container is colored.
How can I achieve it?
Flutter provides you with a widget very similar to the result you want to achieve called NavigationRail.
You will not have the animation by default, but you can maybe search in the source code of this widget how to create a custom widget that will implement animations.

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.

Asking about Flutter UI

I have one question regarding Flutter UI. You guys know what this is called in flutter at "Nutrition Fact" part as my picture shown below? The keyword or package that I can search regarding that part. Hope u guys can help me.
Image Reference
It is called Bottom Sheet.
There are so many dart packages but any one of two can be use for your example.
First : solid_bottom_sheet
Second : modal_bottom_sheet
It looks like a rounded container with a row widget. Row widget has 2 children: Text("Nutritional Fact") and IconButton. MainAxisAlignment of row is set to MainAxisAlignment.spaceBetween.IconButton's onpressed parameter might show a BottomModalSheet to display the fact.

How do you hide widgets when you are using/tapped into a TextFormField in flutter?

I would like to hide a Text widget when a user is currently tapped into a TextFormField to type. And when they aren't using it, I would like for it to be visible again. Only problem is I don't see a way to accomplish this. Any help is appreciated!
The easiest way is to check whether the user is using TextField or not is by detecting whether the keyboard is visible or not. For that follow this stack-overflow post. Once you know whether keyboard is visible or not, you can simply update the state(setState()) and decide whether to hide the widget or not. Follow this stack-overflow post as a reference to hide and un-hide widgets in flutter.