skip to Main Content

In Flutter how to capitalize first letter of string and first letter after dot and capitalize first letter once click enter/return in mobile device using Regex?

String capitalize(String text) {
  return text.replaceAllMapped(RegExp(r'•s*[a-z]|^[a-z]'), (m) {
    return match.toUpperCase();
  });
}

Once I press space button two times one dot will automatically added and unable set newline…

2

Answers


  1. Chosen as BEST ANSWER

    Actually above code is working fine, how to validate new line in that regex..


  2. You can used maxLines: 1 in TextFromFiled

    maxLines: 1
     softWrap: false,
     overflow:TextOverflow.ellipsis,
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search