{"id":787,"date":"2023-07-29T21:12:30","date_gmt":"2023-07-29T13:12:30","guid":{"rendered":"http:\/\/gjweb.top\/?p=787"},"modified":"2023-07-31T21:07:45","modified_gmt":"2023-07-31T13:07:45","slug":"flutter-%e5%b8%b8%e7%94%a8%e6%a0%b7%e5%bc%8f%e8%b0%83%e6%95%b4%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=787","title":{"rendered":"Flutter \u5e38\u7528\u6837\u5f0f\u8c03\u6574\u603b\u7ed3"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"flutter-\u66f4\u6539\u4e3b\u9898\u989c\u8272\">flutter \u66f4\u6539\u4e3b\u9898\u989c\u8272<\/h2>\n\n\n\n<p>\u5728 main.js \u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>GetMaterialApp(<br> &nbsp;  ...<br> &nbsp; &nbsp; &nbsp;theme: ThemeData( <br> &nbsp; &nbsp; &nbsp; &nbsp;colorScheme: const ColorScheme.light().copyWith(primary: Color.fromRGBO(255, 255, 255, 1)),<br> &nbsp; &nbsp;  ),<br>    ... &nbsp; &nbsp; <br>),<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u66f4\u6539\u72b6\u6001\u680f\u989c\u8272\">\u66f4\u6539\u72b6\u6001\u680f\u989c\u8272<\/h2>\n\n\n\n<p>\u540c\u6837\u5728 main.js \u4e2d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void main(){<br> &nbsp;SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(<br> &nbsp; &nbsp; &nbsp;statusBarColor:Color.fromRGBO(255, 255, 255, 1)), \/* \u8bbe\u7f6e\u72b6\u6001\u680f\u80cc\u666f\u989c\u8272 *\/<br> &nbsp; &nbsp; &nbsp;statusBarIconBrightness: Brightness.light,\/*\u8bbe\u7f6e\u72b6\u6001\u680f\u989c\u8272\u4e3a\u767d\u8272; Brightness.dark \u8bbe\u7f6e\u5b57\u4f53\u4e3a\u9ed1\u8272 light \u767d\u8272*\/<br>  );<br> &nbsp;SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);<br> &nbsp;runApp(...);<br>}<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u8868\u5355\u6837\u5f0f\u914d\u7f6e\">\u8868\u5355\u6837\u5f0f\u914d\u7f6e<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>TextField(<br>    maxLines: 1,<br>    decoration: InputDecoration(<br>        hintText: \"\u641c\u7d22\",<br>        hintStyle:TextStyle(color:Color.fromRGBO(206, 206, 206, 1)), \/*\u63d0\u793a\u6587\u672c\u6837\u5f0f*\/<br>        contentPadding: EdgeInsets.symmetric(vertical:9,horizontal:-10), \/*\u8c03\u6574\u4e0a\u4e0b\u5185\u8fb9\u8ddd,\u53ef\u6539\u53d8\u8f93\u5165\u6846\u7684\u9ad8\u5ea6*\/<br>        border: InputBorder.none, \/*\u4e0d\u663e\u793a\u4e0b\u5212\u7ebf*\/ <br>        icon:Padding( \/*\u7ed9\u5de6\u8fb9\u6dfb\u52a0\u56fe\u6807*\/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;padding: &nbsp;EdgeInsets.only(left: 10,),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;child: Icon(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Icons.search,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color: Color.fromRGBO(228, 228, 228, 1),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ),<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=\"\u83b7\u53d6\u72b6\u6001\u680f\u7684\u9ad8\u5ea6\">\u83b7\u53d6\u72b6\u6001\u680f\u7684\u9ad8\u5ea6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>MediaQuery.of(context).padding.top<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u5bbd\u5ea6\u586b\u6ee1\u5143\u7d20\">\u5bbd\u5ea6\u586b\u6ee1\u5143\u7d20<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>MediaQuery. of (context).size.width<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"\u70b9\u51fb\u4ea4\u4e92\u6c34\u6ce2\u6d6a\u6539\u5706\u89d2\">\u70b9\u51fb\u4ea4\u4e92\u6c34\u6ce2\u6d6a\u6539\u5706\u89d2<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Inkell(\n &nbsp; &nbsp;borderRadius: BorderRadius.circular(20), \/*\u4ea4\u4e92\u7684\u6c34\u6ce2\u7eb9\u4e3a\u5706\u89d2*\/\n &nbsp; &nbsp;onTap:(){},\n &nbsp; &nbsp;child:Widget\n)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ink-\u7ec4\u4ef6\u914d\u7f6e\u6c34\u6ce2\u7eb9\">Ink \u7ec4\u4ef6\u914d\u7f6e\u6c34\u6ce2\u7eb9<\/h3>\n\n\n\n<p>\u573a\u666f\u91cd\u73b0\uff1a\u5982\u679c Inkell \u7684\u5b50\u96c6\u5143\u7d20\u8bbe\u7f6e\u4e86\u80cc\u666f\u989c\u8272\uff0c\u9ed8\u8ba4\u7684\u6c34\u6ce2\u7eb9\u5c06\u4f1a\u6d88\u5931\uff0c\u4f8b\u5982\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>InkWell(<br>    child:Container(<br> &nbsp;      decoration:BoxDecoration(<br> &nbsp; &nbsp; &nbsp;      color:Colors.red<br> &nbsp; &nbsp; &nbsp;  ),<br> &nbsp; &nbsp; &nbsp; &nbsp;child:Text(\"\u6309\u94ae\")<br> &nbsp;  )<br>)<\/code><\/pre>\n\n\n\n<p>\u89e3\u51b3\u65b9\u5f0f: \u4f7f\u7528 <code>Ink<\/code> \u7ec4\u4ef6\u5d4c\u5957 <code>InkWell<\/code> ,\u53ef\u4ee5\u51fa\u73b0\u6c34\u6ce2\u7eb9\u6548\u679c, \u4f7f\u7528\u540c <code>Container<\/code> \u4e00\u81f4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Ink(<br> &nbsp; &nbsp;decoration: BoxDecoration(<br> &nbsp; &nbsp; &nbsp;color: MyTheme.themeColor, \/*\u8bbe\u7f6e\u80cc\u666f\u989c\u8272*\/<br> &nbsp; &nbsp; &nbsp;borderRadius: BorderRadius.circular(20) \/*\u8bbe\u7f6e\u5706\u89d2*\/<br> &nbsp;  ),<br>    child:InkWell(<br> &nbsp;      onTap(){},<br> &nbsp; &nbsp; &nbsp; &nbsp;child:Container(<br> &nbsp; &nbsp; &nbsp;      child:Text(\"\u6309\u94ae\")<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=\"flutter-\u8fdb\u5ea6\u6761\">flutter \u8fdb\u5ea6\u6761<\/h2>\n\n\n\n<p>\u7ebf\u6027\u8fdb\u5ea6\u6761<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*<br>* value \u8868\u793a\u5f53\u524d\u8fdb\u5ea6 0-1 \u5c5e\u4e8e double\u7c7b\u578b<br>* \u5982\u679c \u53c2\u6570\u4e3a\u7a7a\u5219\u53d8\u6210 loading \u6548\u679c<br>*\/<br>body:LinearProgressIndicator(value:0.4),<\/code><\/pre>\n\n\n\n<p>\u73af\u5f62\u8fdb\u5ea6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/*\u7528\u6cd5\u4e0e\u4e0a\u9762\u76f8\u540c*\/<br>body:CircularProgressIndicator(value:0.4)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"container\u7ec4\u4ef6\u6dfb\u52a0\u9634\u5f71\">container\u7ec4\u4ef6\u6dfb\u52a0\u9634\u5f71<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Container(<br> &nbsp; &nbsp;decoration:BocDecoration(<br> &nbsp;      boxShadow: const&#91;<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;BoxShadow(<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;color: Colors.black12,<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;offset: Offset(0.0, 0.0), \/*\u9634\u5f71xy\u8f74\u504f\u79fb\u91cf*\/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;blurRadius: 4.0, \/*\u9634\u5f71\u6a21\u7cca\u7a0b\u5ea6*\/<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;spreadRadius:1.0 \/*\u9634\u5f71\u6269\u6563\u7a0b\u5ea6*\/<br> &nbsp; &nbsp; &nbsp; &nbsp;  )<br> &nbsp; &nbsp; &nbsp;  ]<br> &nbsp;  ),<br>    child:&lt;Widget&gt;<br>)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>flutter \u66f4\u6539\u4e3b\u9898\u989c\u8272 \u5728 main.js \u4e2d \u66f4\u6539\u72b6\u6001\u680f\u989c\u8272 \u540c\u6837\u5728 main.js \u4e2d \u8868\u5355\u6837\u5f0f\u914d\u7f6e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[],"class_list":["post-787","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/787","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=787"}],"version-history":[{"count":4,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/787\/revisions"}],"predecessor-version":[{"id":792,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/787\/revisions\/792"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}