-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Tab Character \t should be displayed as indentation in EditableText, TextField and all implementations of Text widgets in Desktop
This is a common behaviour in many desktop applications
Flutter Channel: master
Platform: Desktop, Linux
Version: 2.1.0-11.0.pre.138
When Tab key is pressed while the TextField is focused, in a Flutter Desktop Application, by default, the focused TextField is unfocused and the focus shifts to another widget. That is a problem in my case as I want the user to be able to enter tab characters. But I partially solved it by using a RawKeyboardListener to detect when the user presses Tab key, and then inserted a \t to the TextField at the current cursor position through its controller.
The problem is that, the \t character is displayed as a small space, almost half as wide as whitespace, which is counterproductive.
There should be an option to configure how \t is displayed, as it can be of multiple number of spaces' width, and it should be customisable.
I believe this is not exactly a bug. For mobile devices, the Tab key is irrelevant. For web, pressing Tab key is helpful in shifting focus between UI elements.
But for desktop, it makes sense to have an option to customise how a Tab character is displayed in a TextField.
Suggestion
Add an option to disable focus shifting on Tab press on Desktop and add Tab character to the TextField. Provide a way to customise Tab character display, by equating it to a specific number of whitespaces that can be changed if required.