{"id":586,"date":"2023-02-18T18:37:58","date_gmt":"2023-02-18T10:37:58","guid":{"rendered":"http:\/\/gjweb.top\/?p=586"},"modified":"2023-05-10T21:51:06","modified_gmt":"2023-05-10T13:51:06","slug":"15-%e8%a1%a8%e5%8d%95%e7%bb%84%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=586","title":{"rendered":"15. \u8868\u5355\u7ec4\u4ef6"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"\u6587\u672c\u6846\u7ec4\u4ef6-textfiled\">\u6587\u672c\u6846\u7ec4\u4ef6 TextFiled<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5c5e\u6027<\/th><th>\u4f5c\u54c1<\/th><th>\u7c7b\u578b<\/th><\/tr><\/thead><tbody><tr><td>maxLines<\/td><td>\u6539\u6210\u591a\u884c\u6587\u672c,\u6700\u5927\u884c\u6570<\/td><td>int<\/td><\/tr><tr><td>onChanged<\/td><td>\u6587\u672c\u6846\u53d8\u5316\u65f6\u7684\u76d1\u542c<\/td><td>fun<\/td><\/tr><tr><td>decoration<\/td><td>\u6837\u5f0f InputDecoration<\/td><td><\/td><\/tr><tr><td>obscureText<\/td><td>\u5bc6\u7801\u6846<\/td><td>bool<\/td><\/tr><tr><td>controller<\/td><td>\u7ed3\u5408 textEditingController \u53ef\u4ee5\u914d\u7f6e\u8868\u5355\u9ed8\u8ba4\u663e\u793a\u7684\u5185\u5bb9<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>TextField(<br> &nbsp; &nbsp;decoration: InputDecoration(<br> &nbsp; &nbsp; &nbsp; &nbsp;hintText: \"\u7528\u6237\u540d\", \/\/ \u63d0\u793a\u8bcd<br> &nbsp; &nbsp; &nbsp; &nbsp;border: OutlineInputBorder(), \/\/ \u5e26\u8fb9\u6846<br> &nbsp;  )<br>)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u8bbe\u7f6e\u521d\u59cb\u5316\u503c\">\u8bbe\u7f6e\u521d\u59cb\u5316\u503c<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>late TextEditingController _xxx;<br>String username = \"zhangsan\";<br>String password = \"\";<br>void initState(){<br> &nbsp; &nbsp;super.initState();<br> &nbsp; &nbsp;_xxx = TextEditingController.fromValue(TextEditingValue(<br> &nbsp;      text: username,<br> &nbsp; &nbsp; &nbsp; &nbsp;selection: TextSelection.fromPosition(TextPosition(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;offset: username.length;<br> &nbsp; &nbsp; &nbsp;  ))<br> &nbsp;  ))<br>}<br>\u4f7f\u7528<br> &nbsp; &nbsp;<br>TextField(<br>    controller: _xxx,<br>    decoration: const InputDecoration(<br>        hintText: \"\u7528\u6237\u540d\", <br> &nbsp; &nbsp; &nbsp; &nbsp;border: OutlineInputBorder()),<br>        onChanged: (value) =&gt; setState(() {<br>            username = value;<br>        }<br> &nbsp;  ),<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5355\u9009\u6309\u94ae\u7ec4\">\u5355\u9009\u6309\u94ae\u7ec4<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Radio(<br> &nbsp; &nbsp;value:1,<br> &nbsp; &nbsp;onchanged:(){},<br> &nbsp; &nbsp;groupValue:1<br>),<br>Radio(<br> &nbsp; &nbsp;value:2,<br> &nbsp; &nbsp;onchanged:(){},<br> &nbsp; &nbsp;groupValue:1<br>),<br>\u200b<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"radiolisttile-\u5355\u9009\u6309\u94ae\u7ec4\">RadioListTile \u5355\u9009\u6309\u94ae\u7ec4<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>RadioListTile(<br>    title: Text(\"\u7537\"),<br>    value: 1,<br>    groupValue: 1,<br>    onChanged: (){}<br>),<br>RadioListTile(<br>    title: Text(\"\u5973\"),<br>    value: 2,<br>    groupValue: 1,<br>    onChanged: (){}<br>),<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"checkbox-\u591a\u9009\u6309\u94ae\">checkBox \u591a\u9009\u6309\u94ae<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">Checkbox \u7528\u6cd5\u540c Radio<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"checkboxlisttile-\u591a\u9009\u6309\u94ae\u7ec4\">checkBoxListTile \u591a\u9009\u6309\u94ae\u7ec4<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">\u7528\u6cd5\u540c RadioListTile<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"switch-\u5f00\u5173\">Switch \u5f00\u5173<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>bool flag = true;<br>Switch(<br>    value:flag,<br> &nbsp; &nbsp;onChange(val){<br> &nbsp; &nbsp; &nbsp; &nbsp;setState((){<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;flag = value<br> &nbsp; &nbsp; &nbsp;  })<br> &nbsp;  }<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u8fdb\u5ea6\u6761\">\u8fdb\u5ea6\u6761<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5706\u5f62\u52a0\u8f7d\">\u5706\u5f62\u52a0\u8f7d<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>CircularProgressIndicator(<br>    valueColor: AlwaysStoppedAnimation(Colors.red),<br>    backgroundColor: Colors.white<br>)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"ios\u5706\u5f62\u52a0\u8f7d\">IOS\u5706\u5f62\u52a0\u8f7d<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>import \"packge:flutter\/cupertino.dart\"<br>CupertinoActivityIndicator(radius:24)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u7ebf\u6027\u8fdb\u5ea6\">\u7ebf\u6027\u8fdb\u5ea6<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>LinearProgressIndicator(<br>\tvalue: 0.1,<br>\tvalueColor: AlwaysStoppedAnimation(Colors.blue),<br>\tbackgroundColor: Colors.grey,<br>)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u672c\u6846\u7ec4\u4ef6 TextFiled \u5c5e\u6027 \u4f5c\u54c1 \u7c7b\u578b maxLines \u6539\u6210\u591a\u884c\u6587\u672c,\u6700\u5927\u884c\u6570 int onCha [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-586","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=586"}],"version-history":[{"count":2,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/586\/revisions"}],"predecessor-version":[{"id":588,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/586\/revisions\/588"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}