ElevatedButton 凸起的按钮
    TextButton 扁平化的按钮
    OutlinedButton 线框按钮
    IconButton 图标按钮
    ButtonBar 按钮组
    FloatingActionButton 浮动按钮
    InkWell 可点击容器
    Divider 分割线
    Row 行
    Column 列
    Warp 流
    • 圆形图片

      1. ClipOval(
      2. child: Image.network(
      3. "https://img2020.cnblogs.com/blog/1338189/202012/1338189-20201208222047944-989579474.png",
      4. //Image.asset('images/aa.jpg')
      5. height: 100,
      6. width: 100,
      7. fit: BoxFit.cover,),
      8. ),
    • 输入框数据绑定

      1. var _username=new TextEditingController();
      2. ...
      3. TextField(
      4. decoration: InputDecoration(
      5. //hintText: 'hint提示',
      6. icon: Icon(Icons.account_circle),
      7. labelText: '标签标题',
      8. border: OutlineInputBorder(),
      9. ),
      10. //maxLines: 4,//4行文本框
      11. //obscureText: true, //密码框,maxLines必须为1
      12. controller: _username,//数据绑定
      13. onChanged: (value){
      14. print(this._username.text);
      15. },
      16. ),
    • 勾选框数据绑定

      1. bool _flag=false;
      2. ...
      3. //基础单控件
      4. Checkbox(value: _flag,activeColor: Colors.red, onChanged: (value){
      5. setState(() {
      6. this._flag=value!;
      7. });
      8. }),
      9. //列表形式控件
      10. CheckboxListTile(
      11. value: _flag,
      12. activeColor: Colors.red,
      13. onChanged: (value){
      14. setState(() {
      15. this._flag=value!;
      16. });
      17. },
      18. title: Text('标题文字'),
      19. subtitle: Text('二级标题文字'),
      20. secondary: Icon(Icons.help),
      21. selected: _flag,//选中高亮
      22. ),
    • 单选框数据绑定

      1. var _sex;
      2. ...
      3. //基础单控件
      4. Row(children: [
      5. Radio(
      6. value: 1,
      7. groupValue: this._sex,
      8. onChanged: (value){
      9. setState(() {
      10. this._sex=value;
      11. });
      12. }
      13. ),
      14. Radio(
      15. value: 2,
      16. groupValue: this._sex,
      17. onChanged: (value){
      18. setState(() {
      19. this._sex=value;
      20. });
      21. }
      22. ),
      23. ],)
      24. //列表形式控件
      25. RadioListTile(
      26. title: Text('标题'),
      27. subtitle: Text('次标题'),
      28. secondary: Icon(Icons.help),
      29. selected: this._sex==1,//选中高亮
      30. value: 1,
      31. groupValue: this._sex,
      32. onChanged: (value){
      33. setState(() {
      34. this._sex=value;
      35. });
      36. }
      37. ),
      38. RadioListTile(
      39. title: Text('标题'),
      40. subtitle: Text('次标题'),
      41. secondary: Icon(Icons.help),
      42. selected: this._sex==2,
      43. value: 2,
      44. groupValue: this._sex,
      45. onChanged: (value){
      46. setState(() {
      47. this._sex=value;
      48. });
      49. }
      50. ),
    • 开关数据绑定

      1. bool _flag=false;
      2. ...
      3. Switch(value: _flag, onChanged: (value){
      4. setState(() {
      5. this._flag=value;
      6. });
      7. }),