Skip to content

Commit 4d69797

Browse files
Drakiruszephylac
Drakirus
authored andcommitted
feat: Send uppercase character when configured
1 parent dc8ec4f commit 4d69797

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

textinput.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package flutter
33
import (
44
"encoding/json"
55
"fmt"
6+
"unicode"
67

78
"github.com/go-flutter-desktop/go-flutter/plugin"
89
"github.com/go-gl/glfw/v3.2/glfw"
@@ -100,6 +101,13 @@ func (p *textinputPlugin) glfwCharCallback(w *glfw.Window, char rune) {
100101
if p.clientID == 0 {
101102
return
102103
}
104+
// Opinionated: If a flutter dev uses TextCapitalization.characters
105+
// in a TextField, that means he wants only to receive
106+
// uppercase characters.
107+
// TODO(Drakirus): Handle language-specific case mappings such as Turkish.
108+
if p.clientConf.TextCapitalization == "TextCapitalization.characters" {
109+
char = unicode.ToUpper(char)
110+
}
103111
p.addChar([]rune{char})
104112
}
105113

0 commit comments

Comments
 (0)