{"id":1142,"date":"2023-03-16T22:01:45","date_gmt":"2023-03-16T14:01:45","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1142"},"modified":"2023-03-16T22:12:03","modified_gmt":"2023-03-16T14:12:03","slug":"flutter-widget-text","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/16\/flutter-widget-text\/","title":{"rendered":"Flutter Widget\u4e4bText"},"content":{"rendered":"<p>Widget\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/flutter.io\/docs\/development\/ui\/widgets\">https:\/\/flutter.io\/docs\/development\/ui\/widgets<\/a><br \/>\nText\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/docs.flutter.io\/flutter\/widgets\/Text-class.html\">https:\/\/docs.flutter.io\/flutter\/widgets\/Text-class.html<\/a><\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-dart\">import &#039;package:flutter\/material.dart&#039;;\n\nclass TextDemoPage extends StatefulWidget {\n  @override\n  State&lt;StatefulWidget&gt; createState() =&gt; new _TextDemoPageState();\n}\n\nclass _TextDemoPageState extends State&lt;TextDemoPage&gt; {\n  String _name = &#039;Joe.Ye&#039;;\n\n  @override\n  Widget build(BuildContext context) {\n    return new Scaffold(\n      appBar: new AppBar(title: new Text(&#039;Text Page Demo&#039;),),\n      body: Center(\n        child: Column(\n          children: &lt;Widget&gt;[\n            Text(\n              &#039;Hello, $_name! How are you?&#039;,\n              textAlign: TextAlign.center,\n              overflow: TextOverflow.ellipsis,\n              style: TextStyle(fontWeight: FontWeight.bold),\n            ),\n            const Text.rich(\n              TextSpan(\n                text: &#039;Hello&#039;, \/\/ default text style\n                children: &lt;TextSpan&gt;[\n                  TextSpan(text: &#039; beautiful &#039;, style: TextStyle(fontStyle: FontStyle.italic)),\n                  TextSpan(text: &#039;world&#039;, style: TextStyle(fontWeight: FontWeight.bold)),\n                ],\n              ),\n            )\n          ],\n        )\n      ),\n    );\n  }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Widget\uff1ahttps:\/\/flutter.io\/docs\/development\/ui\/widgets T [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[305],"class_list":["post-1142","post","type-post","status-publish","format-standard","hentry","category-flutter","tag-flutter-widget"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1142"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1142\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}