class InputMdnWidget extends StatefulWidget {
const InputMdnWidget({Key key}) : super(key: key);
@override
_InputMdnWidgetState createState() => _InputMdnWidgetState();
}
class _InputMdnWidgetState extends State<InputMdnWidget> {
TextEditingController _controller;
@override
void initState() {
super.initState();
_controller = TextEditingController();
}
@override
Widget build(BuildContext context) {
return TextField(
controller: _controller,
textCapitalization: TextCapitalization.words
);
}
}
i'm new to flutter, i have a textfield and using a controller, i want to make the text that the user typed into camel case, for example the user types "lala lala", the text in the textfield will change to "Lala Lala", is this possible and how?
I use textCapitalization: TextCapitalization.words doesn't work
You can try using TextInputFormatters. These make input conform to particular patterns, and can be supplied to
TextFields
like so:If you want custom formatting, and I think you're wanting "title case," you can create your own
TextInputFormatter
by extending the class like this:Again, use it like this: