{"id":559,"date":"2023-02-06T20:48:05","date_gmt":"2023-02-06T12:48:05","guid":{"rendered":"http:\/\/gjweb.top\/?p=559"},"modified":"2023-02-06T20:48:06","modified_gmt":"2023-02-06T12:48:06","slug":"03-%e7%bb%84%e4%bb%b6%e8%af%a6%e8%a7%a3-1","status":"publish","type":"post","link":"https:\/\/gjweb.top\/?p=559","title":{"rendered":"03. \u7ec4\u4ef6\u8be6\u89e3 ( 1 )"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"container-\u5bb9\u5668\u7ec4\u4ef6\">Container \u5bb9\u5668\u7ec4\u4ef6<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u529f\u80fd<\/th><\/tr><\/thead><tbody><tr><td>alignment<\/td><td>\u5bf9\u9f50\u65b9\u5f0f<\/td><\/tr><tr><td>decoration<\/td><td>\u5bb9\u5668\u7684\u6837\u5f0f\u8c03\u7528 BoxDecoration \u7c7b<\/td><\/tr><tr><td>margin<\/td><td>\u5916\u8fb9\u8ddd EdgeInsets.all(10.0)<\/td><\/tr><tr><td>padding<\/td><td>\u5916\u8fb9\u8ddd \u540c\u4e0a<\/td><\/tr><tr><td>transform<\/td><td>\u52a8\u753b\u5c5e\u6027 transform: Matrix4.rotationZ(0.2)<\/td><\/tr><tr><td>height<\/td><td>\u9ad8\u5ea6<\/td><\/tr><tr><td>width<\/td><td>\u5bbd\u5ea6<\/td><\/tr><tr><td>child<\/td><td>\u5b50\u5143\u7d20<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>Container(<br>    alignment: Alignment.center,<br> &nbsp; &nbsp;height: 200,<br> &nbsp; &nbsp;width: 200,<br> &nbsp; &nbsp;decoration: const BoxDecoration(<br> &nbsp;      color: Colors.yellow,<br> &nbsp;  ),<br> &nbsp; &nbsp;child: const Text(\"hello flutter\")<br>\u200b<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"text-\u6587\u5b57\u7ec4\u4ef6\">Text \u6587\u5b57\u7ec4\u4ef6<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u5c5e\u6027<\/th><th>\u4f5c\u7528<\/th><\/tr><\/thead><tbody><tr><td>textAlign<\/td><td>\u5bf9\u9f50\u65b9\u5f0f<\/td><\/tr><tr><td>textDireetion<\/td><td>\u6587\u672c\u65b9\u5411 ltr \u5de6\u5230\u53f3 rtl \u53f3\u5230\u5de6<\/td><\/tr><tr><td>overflow<\/td><td>\u6ea2\u51fa\u5904\u7406 clip \u88c1\u526a \\ fade \u6e10\u9690 \\ ellipsis \u7701\u7565\u53f7<\/td><\/tr><tr><td>maxLines<\/td><td>\u6587\u5b57\u6700\u5927\u884c\u6570<\/td><\/tr><tr><td>style<\/td><td>\u5b57\u4f53\u7684\u6837\u5f0f\u8bbe\u7f6e<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>Text(<br>    \"hello flutter\",<br> &nbsp; &nbsp;textAlign: TextAlign.center,<br> &nbsp; &nbsp;textDirection: TextDirection.ltr,<br> &nbsp; &nbsp;maxLines: 1,<br> &nbsp; &nbsp;overflow: TextOverflow.ellipsis,<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"image-\u56fe\u7247\u7ec4\u4ef6\">Image \u56fe\u7247\u7ec4\u4ef6<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u79f0<\/th><th>\u8bf4\u660e<\/th><th>\u7c7b\u578b<\/th><\/tr><\/thead><tbody><tr><td>alignment<\/td><td>\u5bf9\u9f50\u65b9\u5f0f<\/td><td>Alignment<\/td><\/tr><tr><td>color \/ colorBlendMode<\/td><td>\u4e00\u822c\u548c colorBlendMode \u4e00\u8d77\u4f7f\u7528,\u80cc\u666f\u8272\u548c\u56fe\u7247\u989c\u8272\u53ef\u4ee5\u878d\u5408<\/td><td><\/td><\/tr><tr><td>fit<\/td><td>fill \u62c9\u4f38 \/ contain \u539f\u6bd4\u4f8b \/ cover \u81ea\u9002\u5e94\u663e\u793a \/ fitWidth \u5bbd\u5ea6\u5145\u6ee1 \/ fitHeight \u9ad8\u5ea6\u5145\u6ee1<\/td><td>BoxFit<\/td><\/tr><tr><td>repeat<\/td><td>\u5e73\u94fa<\/td><td><\/td><\/tr><tr><td>width<\/td><td>\u5bbd\u5ea6<\/td><td><\/td><\/tr><tr><td>height<\/td><td>\u9ad8\u5ea6<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u52a0\u8f7d\u672c\u5730\u56fe\u7247-image-asset-url\">\u52a0\u8f7d\u672c\u5730\u56fe\u7247 Image.asset(url)<\/h3>\n\n\n\n<p>\u914d\u7f6e pybspec.yaml \u6587\u4ef6 assetc \u4e2d\u914d\u7f6e; \u89c4\u5219: \u9700\u8981\u539f\u56fe 2.x 3.x \u4e09\u4e2a\u6587\u4ef6\u5939 \u5b58\u653e\u540c\u540d\u8d44\u6e90<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u52a0\u8f7d\u8fdc\u7a0b\u56fe\u7247-image-network-src\">\u52a0\u8f7d\u8fdc\u7a0b\u56fe\u7247 Image.network(src)<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u5706\u5f62\u56fe\u7247\u5b9e\u73b0\u65b9\u5f0f\">\u5706\u5f62\u56fe\u7247\u5b9e\u73b0\u65b9\u5f0f<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u65b9\u6848\u4e00-container\u65b9\u5f0f\">\u65b9\u6848\u4e00 Container\u65b9\u5f0f<\/h4>\n\n\n\n<p>\u4f7f\u7528 container \u7ec4\u4ef6\u53d8\u6210\u5706\u5f62\uff0c\u8bbe\u7f6e\u80cc\u666f\u56fe\u7247\u5373\u53ef\u8fb9\u5706\u5f62<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Container(<br>    width:100,<br> &nbsp; &nbsp;height:100,<br> &nbsp; &nbsp;decoration:BoxDecoration(<br> &nbsp;      nprderRadius:BorderRadius.curcular(100),<br> &nbsp; &nbsp; &nbsp; &nbsp;imag:const DecorationImage(<br> &nbsp; &nbsp; &nbsp;      image:NetworkImage(\"url\"),<br> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fit:BoxFit.cover<br> &nbsp; &nbsp; &nbsp;  )<br> &nbsp;  )<br>)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u65b9\u6848\u4e8c-clipoval-\u5706\u5f62\u56fe\u7247\">\u65b9\u6848\u4e8c ClipOval \u5706\u5f62\u56fe\u7247<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>ClipOval(<br> &nbsp; &nbsp;child: Image.network(<br> &nbsp;      \"url\",<br> &nbsp;      width: 150.0,<br> &nbsp;      height: 150.0,<br> &nbsp;      fit: BoxFit.cover<br> &nbsp;  ),<br>)<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"\u65b9\u6848\u4e09-circleavatar-\u5b9e\u73b0\u5706\u5f62\u56fe\u7247\">\u65b9\u6848\u4e09 CircleAvatar \u5b9e\u73b0\u5706\u5f62\u56fe\u7247<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>const CircleAvatar(<br> &nbsp; &nbsp;radius: 200,<br> &nbsp; &nbsp;backgroundImage:<br> &nbsp; &nbsp;NetworkImage(\"https:\/\/www.itying.com\/images\/flutter\/3.png\"),<br>)<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"icon-\u56fe\u6807\u7ec4\u4ef6\">Icon \u56fe\u6807\u7ec4\u4ef6<\/h2>\n\n\n\n<p>flutter \u5185\u7f6e\u4e86\u90e8\u5206 icon \u7ec4\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Icon(Icons.xxx)<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"\u4f7f\u7528\u963f\u91cc\u56fe\u6807\u5e93\">\u4f7f\u7528\u963f\u91cc\u56fe\u6807\u5e93<\/h3>\n\n\n\n<p>\u5b98\u7f51\u4e0b\u8f7d\u76f8\u5173\u56fe\u6807\u8d44\u6e90\u5c06 &#8221; .ttf &#8221; \u548c &#8221; .json &#8221; \u6587\u4ef6\u62f7\u8d1d\u5230 fonts \u6587\u4ef6\u5939\u4e2d<\/p>\n\n\n\n<p>\u914d\u7f6e pubspec.yaml \u6587\u4ef6\u4e2d\u914d\u7f6e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fonts:<br>    - family: \u81ea\u5b9a\u4e49Name <br>      fonts:<br>        - asset: fonts \/ xxx.ttf<\/code><\/pre>\n\n\n\n<p>\u65b0\u5efa\u5b57\u4f53 alIcon.dart \u6587\u4ef6\u5939, \u521b\u5efa AlIcon \u7c7b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class AlIcon{<br> &nbsp; &nbsp;static const IconData xxx = IconData{<br> &nbsp; &nbsp; &nbsp; &nbsp;0xuncode,<br> &nbsp; &nbsp; &nbsp; &nbsp;fontFamily:'\u81ea\u5b9a\u4e49Name',<br> &nbsp; &nbsp; &nbsp; &nbsp;matchTextDirection:true<br> &nbsp;  }<br>}<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528\u5b57\u4f53\u56fe\u6807<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Icon(\u81ea\u5b9a\u4e49Name.xxx)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Container \u5bb9\u5668\u7ec4\u4ef6 \u540d\u79f0 \u529f\u80fd alignment \u5bf9\u9f50\u65b9\u5f0f decoration \u5bb9\u5668\u7684\u6837\u5f0f\u8c03\u7528  [&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-559","post","type-post","status-publish","format-standard","hentry","category-flutter"],"_links":{"self":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/559","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=559"}],"version-history":[{"count":1,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions"}],"predecessor-version":[{"id":560,"href":"https:\/\/gjweb.top\/index.php?rest_route=\/wp\/v2\/posts\/559\/revisions\/560"}],"wp:attachment":[{"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=559"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=559"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gjweb.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=559"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}