flutter 输入控件

    技术2025-09-27  41

    flutter 输入控件的使用:

    //1.声明控件 TextEditingController typeController = TextEditingController() //2.使用输入框 TextField( controller: typeController, decoration: InputDecoration( contentPadding: EdgeInsets.all(10.0), labelText: '用户名', helperText: '请输入用户名' prefixIcon: Icon(Icons.person) ) ), //3. 定义一个button点击出发事件 RaisedButton(onPressed: fn(), child: Text('获取输入值')) //4. fn()方法内获取输入值 typeController.text.toString()

    详细使用教程

    Processed: 0.013, SQL: 9