Warning: Undefined array key "pathway" in /home/clients/160b20c93964292618c158d21ce27bf5/sites/tech.org-services.ch/wp-content/themes/Newspaper/functions.php on line 543
Monday, December 5, 2022
HomeiOS Developmentandroid - Flutter Keyboard not preserve uppercase enabled and locked after the...

android – Flutter Keyboard not preserve uppercase enabled and locked after the second characters


I take advantage of a customized TextField to get consumer enter.

However when keyboardType is outlined by TextInputType.title or TextInputType.textual content. The Keyboard not preserve the uppercase enabled and locked after the second characters. (it is working when use TextInputType.visiblePassword)

However When the next code is commented, working accomplished :

_editingController.choice = TextSelection.fromPosition(
        TextPosition(offset: _editingController.textual content.size));

How I can right this drawback ?

There may be my code :

class AppTextFieldForm extends StatefulWidget {
  last String titleLabel;
  last String initialValue;
  last Operate(String) onChangeCallback;

  const AppTextFieldForm(
      {required this.initialValue,
      required this.onChangeCallback,
      this.titleLabel = "",
      Key? key})
      : tremendous(key: key);

  @override
  State<AppTextFieldForm> createState() => _AppTextFieldFormState();
}

class _AppTextFieldFormState extends State<AppTextFieldForm> {
  late TextEditingController _editingController;

  @override
  void initState() {
    tremendous.initState();
    _editingController = TextEditingController();
    _editingController.textual content = widget.initialValue;
  }

  @override
  void dispose() {
    _editingController.dispose();
    tremendous.dispose();
  }

  void _onUpdateValue(String worth) {
    _editingController.textual content = worth;
    _editingController.choice = TextSelection.fromPosition(
        TextPosition(offset: _editingController.textual content.size));
  }

  @override
  Widget construct(BuildContext context) {
    return Theme(
        knowledge: Theme.of(context).copyWith(
            textSelectionTheme: const TextSelectionThemeData(
                selectionColor: AppTheme.deepCerulean)),
        baby: TextField(
            controller: _editingController,
            minLines: 1,
            maxLines: 1,
            keyboardType: TextInputType.title,
            textAlignVertical: TextAlignVertical.middle,
            textCapitalization: TextCapitalization.none,
            cursorColor: AppTheme.darkGrey,
            type: const TextStyle(
                fontFamily: AppTheme.fontFamily,
                fontWeight: FontWeight.w700,
                fontSize: 14,
                letterSpacing: 0.2,
                coloration: AppTheme.black),
            enableSuggestions: false,
            autocorrect: false,
            onChanged: _onUpdateValue));
  }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments