我正在Windows上进行Flutter开发尝试。我的一个简单测试应用程序中有一个输入框。我希望第一个键盘输入是大写字母,但目前看不到任何实现方法(例如使用按下Shift键启动键盘)。有什么想法吗?
代码(稍微简化了一下):
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
theme: new ThemeData.dark(),
home: new MainScreen()
));
}
class MainScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null,
),
title: new Text('Test'),
),
body: new NewTest(),
);
}
}
/// Widget
class NewTest extends StatefulWidget {
@override
_NewTestInputState createState() => new _NewTestInputState();
}
/// State
class _NewTestInputState extends State<NewTest> {
InputValue _currentInput;
void _handleInputChange(InputValue input) {
if (input != _currentInput){
setState(() {
_currentInput = input;
});
}
}
void _handleInputSubmitted(InputValue input) {
setState(() {
_currentInput = const InputValue();
});
}
@override
Widget build(BuildContext context) {
InputField _widget = new InputField(
value: _currentInput,
hintText: 'Enter text',
keyboardType: TextInputType.text,
autofocus: true,
onChanged: _handleInputChange,
onSubmitted: _handleInputSubmitted,
style: new TextStyle(fontSize: 20.0),
);
Container _container = new Container(
child: _widget,
decoration: new BoxDecoration(
border: new Border.all(
color: Colors.green[300],
width: 2.0,
),
),
padding: new EdgeInsets.all(16.0),
);
return _container;
}
}