{"id":536,"date":"2026-10-07T14:49:01","date_gmt":"2026-10-07T06:49:01","guid":{"rendered":"https:\/\/www.linerroom.cn\/?p=536"},"modified":"2026-10-07T14:51:10","modified_gmt":"2026-10-07T06:51:10","slug":"flutter-%e5%ba%94%e7%94%a8%e5%88%9b%e5%bb%ba","status":"publish","type":"post","link":"https:\/\/www.linerroom.cn\/?p=536","title":{"rendered":"Flutter \u5e94\u7528\u521b\u5efa"},"content":{"rendered":"\n<div class=\"wp-block-jetpack-markdown\"><h1>\u7b2c\u4e00\u4e2a Flutter \u5e94\u7528<\/h1>\n<blockquote>\n<p>\u524d\u7f6e\u6761\u4ef6\uff1a\u5df2\u5b89\u88c5 Flutter SDK\uff0c\u5e76\u901a\u8fc7 <code>flutter doctor<\/code> \u68c0\u67e5\u597d\u5f00\u53d1\u73af\u5883\u3002\n\u672c\u7bc7\u6211\u4eec\u5c06\u4ece\u96f6\u521b\u5efa\u4e00\u4e2a Flutter \u9879\u76ee\uff0c\u628a\u5b83\u8dd1\u8d77\u6765\uff0c\u5e76\u8bfb\u61c2\u9ed8\u8ba4\u6a21\u677f\u7684\u4ee3\u7801\u3002<\/p>\n<\/blockquote>\n<p>\u5b66\u5b8c\u672c\u6587\u4f60\u5c06\u638c\u63e1\uff1a<\/p>\n<ol>\n<li>\u7528 Flutter CLI \u521b\u5efa\u9879\u76ee<\/li>\n<li>\u5728\u6a21\u62df\u5668 \/ \u6d4f\u89c8\u5668 \/ \u684c\u9762\u7aef\u8fd0\u884c\u5e94\u7528<\/li>\n<li>\u4f7f\u7528\u70ed\u91cd\u8f7d\u5feb\u901f\u8c03\u8bd5<\/li>\n<li>\u7406\u89e3 <code>lib\/main.dart<\/code> \u7684\u57fa\u672c\u7ed3\u6784<\/li>\n<\/ol>\n<hr>\n<h2>\u4e00\u3001\u4f7f\u7528 Flutter CLI \u521b\u5efa\u9879\u76ee<\/h2>\n<p>Flutter CLI \u662f Flutter \u81ea\u5e26\u7684\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u9879\u76ee\u7684\u521b\u5efa\u3001\u8fd0\u884c\u3001\u6784\u5efa\u3001\u6d4b\u8bd5\u90fd\u901a\u8fc7\u5b83\u5b8c\u6210\u3002<\/p>\n<h3>1. \u521b\u5efa\u65b0\u9879\u76ee<\/h3>\n<p>\u6253\u5f00\u7ec8\u7aef\uff0c\u8fdb\u5165\u4f60\u5b58\u653e\u4ee3\u7801\u7684\u76ee\u5f55\uff0c\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-bash\">flutter create my_first_app\n<\/code><\/pre>\n<p><code>my_first_app<\/code> \u662f\u9879\u76ee\u540d\uff0cFlutter \u4f1a\u81ea\u52a8\u751f\u6210\u540c\u540d\u6587\u4ef6\u5939\u53ca\u5168\u90e8\u521d\u59cb\u6587\u4ef6\u3002<\/p>\n<p>\u9879\u76ee\u547d\u540d\u89c4\u5219\uff1a<\/p>\n<ul>\n<li>\u53ea\u80fd\u4f7f\u7528<strong>\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf<\/strong><\/li>\n<li>\u5fc5\u987b\u4ee5\u5b57\u6bcd\u6216\u4e0b\u5212\u7ebf\u5f00\u5934<\/li>\n<li>\u4e0d\u80fd\u5305\u542b\u7a7a\u683c\u3001\u4e2d\u5212\u7ebf\u548c\u7279\u6b8a\u5b57\u7b26<\/li>\n<\/ul>\n<h3>2. \u5e38\u7528\u547d\u4ee4\u53c2\u6570<\/h3>\n<p><code>flutter create<\/code> \u652f\u6301\u4e0d\u5c11\u53c2\u6570\uff0c\u5e38\u7528\u7684\u6709\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u53c2\u6570<\/th>\n<th>\u4f5c\u7528<\/th>\n<th>\u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>--org<\/code><\/td>\n<td>\u8bbe\u7f6e\u5e94\u7528\u7684\u7ec4\u7ec7\u6807\u8bc6\uff08\u53cd\u5411\u57df\u540d\u5199\u6cd5\uff0c\u4f1a\u6210\u4e3a Android \u5305\u540d \/ iOS Bundle ID \u7684\u524d\u7f00\uff09<\/td>\n<td><code>--org com.mycompany<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>--platforms<\/code><\/td>\n<td>\u6307\u5b9a\u751f\u6210\u54ea\u4e9b\u5e73\u53f0\u7684\u5de5\u7a0b\u76ee\u5f55\uff0c\u53ef\u9009 <code>android,ios,web,windows,macos,linux<\/code><\/td>\n<td><code>--platforms ios,android,web<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>--empty<\/code><\/td>\n<td>\u4f7f\u7528\u6700\u5c0f\u5316\u6a21\u677f\uff0c\u53ea\u751f\u6210\u4e00\u4e2a\u6700\u7b80 <code>main.dart<\/code>\uff0c\u4e0d\u542b\u8ba1\u6570\u5668\u793a\u4f8b<\/td>\n<td><code>flutter create demo --empty<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>--project-name<\/code><\/td>\n<td>\u5f53\u6240\u5728\u6587\u4ef6\u5939\u540d\u4e0d\u5408\u6cd5\u65f6\uff0c\u5355\u72ec\u6307\u5b9a Dart \u5305\u540d<\/td>\n<td><code>--project-name my_app<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>--description<\/code><\/td>\n<td>\u8bbe\u7f6e\u9879\u76ee\u63cf\u8ff0\u4fe1\u606f<\/td>\n<td><code>--description &quot;\u6211\u7684\u7b2c\u4e00\u4e2a\u5e94\u7528&quot;<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4f8b\u5982\uff0c\u53ea\u9762\u5411 iOS \u548c Android \u521b\u5efa\u9879\u76ee\uff1a<\/p>\n<pre><code class=\"language-bash\">flutter create my_first_app --org com.mycompany --platforms ios,android\n<\/code><\/pre>\n<h3>3. \u521b\u5efa\u8fc7\u7a0b\u7684\u8f93\u51fa<\/h3>\n<p>\u6267\u884c\u540e\u7ec8\u7aef\u4f1a\u5217\u51fa\u65b0\u751f\u6210\u7684\u6587\u4ef6\uff0c\u5e76\u81ea\u52a8\u62c9\u53d6\u4f9d\u8d56\uff1a<\/p>\n<pre><code class=\"language-text\">Creating project &quot;my_first_app&quot;...\nResolving dependencies in `my_first_app`... \nGot dependencies in 8.3s.\nWrote 129 files.\n\nAll files written to:\n  \/Users\/you\/code\/my_first_app\n\nYou can find general documentation for Flutter at: https:\/\/docs.flutter.dev\/\n<\/code><\/pre>\n<p>\u770b\u5230 <code>Got dependencies<\/code> \u5c31\u8868\u793a\u4f9d\u8d56\u4e0b\u8f7d\u5b8c\u6210\uff0c\u9879\u76ee\u53ef\u4ee5\u8fd0\u884c\u4e86\u3002<\/p>\n<hr>\n<h2>\u4e8c\u3001\u8fd0\u884c Flutter \u5e94\u7528<\/h2>\n<h3>1. \u542f\u52a8\u5e94\u7528<\/h3>\n<p>\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u6267\u884c <code>flutter run<\/code>\uff1a<\/p>\n<pre><code class=\"language-bash\">cd my_first_app\nflutter run\n<\/code><\/pre>\n<p>\u5982\u679c\u5f53\u524d\u53ea\u6709\u4e00\u4e2a\u53ef\u7528\u8bbe\u5907\uff0cFlutter \u4f1a\u76f4\u63a5\u628a\u5e94\u7528\u5b89\u88c5\u5e76\u542f\u52a8\u5230\u8be5\u8bbe\u5907\u4e0a\uff1b\u6709\u591a\u4e2a\u8bbe\u5907\u65f6\u4f1a\u63d0\u793a\u4f60\u9009\u62e9\u3002<\/p>\n<p>\u9996\u6b21\u7f16\u8bd1\u9700\u8981\u4e00\u4e9b\u65f6\u95f4\uff08Gradle \/ Xcode \u6784\u5efa\uff09\uff0c\u4e4b\u540e\u518d\u6b21\u8fd0\u884c\u4f1a\u5feb\u5f88\u591a\u3002<\/p>\n<h3>2. \u6307\u5b9a\u8fd0\u884c\u8bbe\u5907<\/h3>\n<p>\u4f7f\u7528 <code>-d<\/code> \u53c2\u6570\u53ef\u4ee5\u76f4\u63a5\u6307\u5b9a\u76ee\u6807\u8bbe\u5907\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u76ee\u6807\u5e73\u53f0<\/th>\n<th>\u547d\u4ee4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Android \u6a21\u62df\u5668 \/ \u771f\u673a<\/td>\n<td><code>flutter run -d android<\/code><\/td>\n<\/tr>\n<tr>\n<td>iOS \u6a21\u62df\u5668<\/td>\n<td><code>flutter run -d ios<\/code>\uff08\u6216 <code>-d iphone<\/code>\uff09<\/td>\n<\/tr>\n<tr>\n<td>Chrome \u6d4f\u89c8\u5668<\/td>\n<td><code>flutter run -d chrome<\/code><\/td>\n<\/tr>\n<tr>\n<td>macOS \u684c\u9762<\/td>\n<td><code>flutter run -d macos<\/code><\/td>\n<\/tr>\n<tr>\n<td>Windows \u684c\u9762<\/td>\n<td><code>flutter run -d windows<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>3. \u67e5\u770b\u6240\u6709\u53ef\u7528\u8bbe\u5907<\/h3>\n<p>\u4e0d\u786e\u5b9a\u8bbe\u5907 ID \u65f6\uff0c\u5148\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-bash\">flutter devices\n<\/code><\/pre>\n<p>\u8f93\u51fa\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-text\">3 connected devices:\n\nmacOS (desktop)  \u2022 macos  \u2022 darwin-arm64   \u2022 macOS 15.0\nChrome (web)     \u2022 chrome \u2022 web-javascript \u2022 Google Chrome 130\niPhone 16 Pro    \u2022 xxxxxx \u2022 ios            \u2022 com.apple.CoreSimulator.SimRuntime.iOS-18-0\n<\/code><\/pre>\n<p>\u4e5f\u53ef\u4ee5\u7528\u6a21\u62df\u5668 ID \u7cbe\u786e\u6307\u5b9a\uff1a<\/p>\n<pre><code class=\"language-bash\">flutter run -d xxxxxx\n<\/code><\/pre>\n<h3>4. \u8fd0\u884c\u65f6\u7684\u7ec8\u7aef\u5feb\u6377\u952e<\/h3>\n<p><code>flutter run<\/code> \u542f\u52a8\u540e\uff0c\u7ec8\u7aef\u4f1a\u8fdb\u5165\u70ed\u91cd\u8f7d\u63a7\u5236\u53f0\uff0c\u5e38\u7528\u6309\u952e\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u6309\u952e<\/th>\n<th>\u529f\u80fd<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>r<\/code><\/td>\n<td>\u70ed\u91cd\u8f7d\uff08Hot Reload\uff09<\/td>\n<\/tr>\n<tr>\n<td><code>R<\/code><\/td>\n<td>\u70ed\u91cd\u542f\uff08Hot Restart\uff0c\u91cd\u7f6e\u5e94\u7528\u72b6\u6001\uff09<\/td>\n<\/tr>\n<tr>\n<td><code>o<\/code><\/td>\n<td>Android\/iOS \u5207\u6362\u8c03\u8bd5\u5e73\u53f0\u6a21\u5f0f<\/td>\n<\/tr>\n<tr>\n<td><code>q<\/code><\/td>\n<td>\u9000\u51fa\u5e94\u7528\u5e76\u7ed3\u675f\u8fd0\u884c<\/td>\n<\/tr>\n<tr>\n<td><code>h<\/code><\/td>\n<td>\u67e5\u770b\u5168\u90e8\u5e2e\u52a9\u547d\u4ee4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr>\n<h2>\u4e09\u3001\u70ed\u91cd\u8f7d\uff08Hot Reload\uff09<\/h2>\n<p>\u70ed\u91cd\u8f7d\u662f Flutter \u6700\u5177\u4ee3\u8868\u6027\u7684\u5f00\u53d1\u7279\u6027\uff1a<\/p>\n<ol>\n<li>\u5728\u7f16\u8f91\u5668\u91cc\u4fee\u6539 Dart \u4ee3\u7801\u5e76\u4fdd\u5b58\uff1b<\/li>\n<li>\u56de\u5230\u8fd0\u884c\u4e2d\u7684\u7ec8\u7aef\u6309 <code>r<\/code>\uff08\u5728 VS Code \/ Android Studio \u4e2d\u4fdd\u5b58\u6587\u4ef6\u4f1a\u81ea\u52a8\u89e6\u53d1\uff09\uff1b<\/li>\n<li>\u7ea6 1 \u79d2\u5185\uff0c\u6a21\u62df\u5668\u6216\u771f\u673a\u4e0a\u7684\u754c\u9762\u5c31\u4f1a\u5237\u65b0\u6210\u6700\u65b0\u4ee3\u7801\u3002<\/li>\n<\/ol>\n<p>\u70ed\u91cd\u8f7d\u7684\u7279\u70b9\uff1a<\/p>\n<ul>\n<li><strong>\u4fdd\u7559\u5e94\u7528\u72b6\u6001<\/strong>\uff1a\u8ba1\u6570\u5668\u6570\u503c\u3001\u8f93\u5165\u6846\u5185\u5bb9\u3001\u9875\u9762\u6808\u90fd\u4e0d\u4f1a\u4e22\u5931\uff1b<\/li>\n<li>\u539f\u7406\u662f\u628a\u6539\u52a8\u540e\u7684\u4ee3\u7801\u6ce8\u5165\u6b63\u5728\u8fd0\u884c\u7684 Dart VM\uff0c\u518d\u91cd\u65b0\u6784\u5efa Widget \u6811\uff1b<\/li>\n<li>\u5c11\u6570\u6539\u52a8\uff08\u5982 <code>main()<\/code> \u5165\u53e3\u3001\u5e94\u7528\u521d\u59cb\u5316\u903b\u8f91\u3001\u679a\u4e3e\u6539\u4e3a\u7c7b\u7b49\uff09\u70ed\u91cd\u8f7d\u65e0\u6cd5\u751f\u6548\uff0c\u6b64\u65f6\u6309\u5927\u5199 <code>R<\/code> \u505a<strong>\u70ed\u91cd\u542f<\/strong>\uff0c\u6216\u5b8c\u5168\u91cd\u65b0\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u56db\u3001\u5165\u53e3\u6587\u4ef6 main.dart \u89e3\u6790<\/h2>\n<p>\u6bcf\u4e2a Flutter \u9879\u76ee\u7684\u5165\u53e3\u90fd\u662f <code>lib\/main.dart<\/code>\u3002\u9ed8\u8ba4\u6a21\u677f\u662f\u4e00\u4e2a\u70b9\u51fb\u6309\u94ae\u8ba1\u6570\u7684\u793a\u4f8b\uff0c\u4e0b\u9762\u7ed9\u51fa\u5e26\u8be6\u7ec6\u6ce8\u91ca\u7684\u7248\u672c\uff1a<\/p>\n<pre><code class=\"language-dart\">\/\/ lib\/main.dart\n\n\/\/ 1. \u5bfc\u5165 Material Design \u7ec4\u4ef6\u5e93\nimport 'package:flutter\/material.dart';\n\n\/\/ 2. main() \u662f Dart \u7a0b\u5e8f\u7684\u5165\u53e3\u51fd\u6570\nvoid main() {\n  \/\/ runApp() \u63a5\u6536\u4e00\u4e2a Widget \u4f5c\u4e3a\u5e94\u7528\u7684\u6839\u8282\u70b9\n  runApp(const MyApp());\n}\n\n\/\/ 3. \u6839\u7ec4\u4ef6\uff1a\u65e0\u72b6\u6001\u7ec4\u4ef6\nclass MyApp extends StatelessWidget {\n  const MyApp({super.key});\n\n  @override\n  Widget build(BuildContext context) {\n    \/\/ MaterialApp \u63d0\u4f9b Material \u98ce\u683c\u7684\u9875\u9762\u5bfc\u822a\u3001\u4e3b\u9898\u7b49\u914d\u7f6e\n    return MaterialApp(\n      title: 'Flutter Demo',                 \/\/ \u5e94\u7528\u6807\u9898\uff08\u4efb\u52a1\u7ba1\u7406\u5668\u4e2d\u663e\u793a\uff09\n      theme: ThemeData(\n        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),\n        useMaterial3: true,                  \/\/ \u542f\u7528 Material 3\n      ),\n      home: const MyHomePage(title: 'Flutter \u793a\u4f8b\u9996\u9875'),\n    );\n  }\n}\n\n\/\/ 4. \u9996\u9875\uff1a\u6709\u72b6\u6001\u7ec4\u4ef6\nclass MyHomePage extends StatefulWidget {\n  const MyHomePage({super.key, required this.title});\n\n  final String title; \/\/ \u4e0d\u53ef\u53d8\u7684\u914d\u7f6e\u6570\u636e\n\n  @override\n  State&lt;MyHomePage&gt; createState() =&gt; _MyHomePageState();\n}\n\n\/\/ 5. \u9996\u9875\u7684\u72b6\u6001\u7c7b\uff1a\u6301\u6709\u53ef\u53d8\u72b6\u6001\u5e76\u8d1f\u8d23\u6784\u5efa UI\nclass _MyHomePageState extends State&lt;MyHomePage&gt; {\n  int _counter = 0; \/\/ \u8ba1\u6570\u5668\u72b6\u6001\n\n  void _incrementCounter() {\n    \/\/ setState \u901a\u77e5\u6846\u67b6\uff1a\u72b6\u6001\u53d8\u4e86\uff0c\u8bf7\u91cd\u65b0\u6267\u884c build()\n    setState(() {\n      _counter++;\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    \/\/ Scaffold \u63d0\u4f9b\u9875\u9762\u7684\u57fa\u672c\u9aa8\u67b6\uff08\u5e94\u7528\u680f\u3001\u4e3b\u4f53\u3001\u60ac\u6d6e\u6309\u94ae\u7b49\uff09\n    return Scaffold(\n      appBar: AppBar(\n        backgroundColor: Theme.of(context).colorScheme.inversePrimary,\n        title: Text(widget.title),\n      ),\n      body: Center(\n        child: Column(\n          mainAxisAlignment: MainAxisAlignment.center, \/\/ \u5782\u76f4\u65b9\u5411\u5c45\u4e2d\n          children: [\n            const Text('\u6309\u94ae\u88ab\u70b9\u51fb\u7684\u6b21\u6570\uff1a'),\n            Text(\n              '$_counter',\n              style: Theme.of(context).textTheme.headlineMedium,\n            ),\n          ],\n        ),\n      ),\n      floatingActionButton: FloatingActionButton(\n        onPressed: _incrementCounter,\n        tooltip: '\u589e\u52a0',\n        child: const Icon(Icons.add),\n      ),\n    );\n  }\n}\n<\/code><\/pre>\n<h3>\u4ee3\u7801\u7ed3\u6784\u5bf9\u7167\u8868<\/h3>\n<table>\n<thead>\n<tr>\n<th>\u7ec4\u6210\u90e8\u5206<\/th>\n<th>\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>import<\/code> \u8bed\u53e5<\/td>\n<td>\u5f15\u5165\u5916\u90e8\u5e93\u3002<code>material.dart<\/code> \u63d0\u4f9b\u4e86\u4e00\u6574\u5957 Material Design \u98ce\u683c\u7ec4\u4ef6<\/td>\n<\/tr>\n<tr>\n<td><code>main()<\/code> \u51fd\u6570<\/td>\n<td>\u5e94\u7528\u5165\u53e3\uff0c\u6bcf\u4e2a Dart \u7a0b\u5e8f\u6709\u4e14\u53ea\u6709\u4e00\u4e2a<\/td>\n<\/tr>\n<tr>\n<td><code>runApp()<\/code><\/td>\n<td>\u628a\u6839 Widget \u6302\u8f7d\u5230\u5c4f\u5e55\u4e0a\uff0c\u542f\u52a8\u6e32\u67d3\u6d41\u6c34\u7ebf<\/td>\n<\/tr>\n<tr>\n<td><code>StatelessWidget<\/code><\/td>\n<td>\u65e0\u72b6\u6001\u7ec4\u4ef6\uff1a\u754c\u9762\u53ea\u4f9d\u8d56\u4f20\u5165\u7684\u914d\u7f6e\uff0c\u81ea\u8eab\u4e0d\u4fdd\u5b58\u53ef\u53d8\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td><code>StatefulWidget<\/code> + <code>State<\/code><\/td>\n<td>\u6709\u72b6\u6001\u7ec4\u4ef6\uff1a\u7531\u7ec4\u4ef6\u7c7b\uff08\u914d\u7f6e\uff09\u548c\u72b6\u6001\u7c7b\uff08\u6570\u636e\u4e0e <code>build<\/code>\uff09\u4e24\u90e8\u5206\u7ec4\u6210<\/td>\n<\/tr>\n<tr>\n<td><code>build()<\/code> \u65b9\u6cd5<\/td>\n<td>\u8fd4\u56de\u8be5\u7ec4\u4ef6\u7684 UI \u6811\uff1b\u72b6\u6001\u6539\u53d8\u65f6\u4f1a\u88ab\u91cd\u65b0\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td><code>setState()<\/code><\/td>\n<td>\u4fee\u6539\u72b6\u6001\u540e\u8c03\u7528\uff0c\u6846\u67b6\u636e\u6b64\u8c03\u5ea6\u4e00\u6b21\u91cd\u5efa<\/td>\n<\/tr>\n<tr>\n<td><code>MaterialApp<\/code> \/ <code>Scaffold<\/code><\/td>\n<td>\u524d\u8005\u914d\u7f6e\u5168\u5c40\u4e3b\u9898\u4e0e\u8def\u7531\uff0c\u540e\u8005\u642d\u5efa\u5355\u9875\u9762\u7684\u6807\u51c6\u5e03\u5c40\u9aa8\u67b6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u8bd5\u7740\u6539\u4e00\u6539<\/h3>\n<p>\u5efa\u8bae\u7acb\u523b\u4f53\u9a8c\u70ed\u91cd\u8f7d\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u628a <code>'\u6309\u94ae\u88ab\u70b9\u51fb\u7684\u6b21\u6570\uff1a'<\/code> \u6539\u6210 <code>'\u4f60\u5df2\u7ecf\u70b9\u4e86'<\/code>\uff0c\u4fdd\u5b58\u540e\u6309 <code>r<\/code>\uff1b<\/li>\n<li>\u628a <code>seedColor: Colors.deepPurple<\/code> \u6539\u6210 <code>Colors.blue<\/code>\uff0c\u89c2\u5bdf\u4e3b\u9898\u8272\u53d8\u5316\uff1b<\/li>\n<li>\u628a <code>Icon(Icons.add)<\/code> \u6539\u6210 <code>Icon(Icons.plus_one)<\/code>\u3002<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u6539\u52a8\u90fd\u4f1a\u5728\u4e0d\u4e22\u5931\u8ba1\u6570\u503c\u7684\u60c5\u51b5\u4e0b\u5373\u65f6\u751f\u6548\u3002<\/p>\n<hr>\n<h2>\u4e94\u3001\u5c0f\u7ed3<\/h2>\n<ul>\n<li><code>flutter create \u9879\u76ee\u540d<\/code> \u521b\u5efa\u9879\u76ee\uff0c<code>--org<\/code> \/ <code>--platforms<\/code> \/ <code>--empty<\/code> \u662f\u6700\u5e38\u7528\u7684\u4e09\u4e2a\u53c2\u6570\uff1b<\/li>\n<li><code>flutter devices<\/code> \u67e5\u770b\u8bbe\u5907\uff0c<code>flutter run -d \u8bbe\u5907ID<\/code> \u6307\u5b9a\u8bbe\u5907\u8fd0\u884c\uff1b<\/li>\n<li><code>r<\/code> \u70ed\u91cd\u8f7d\u4fdd\u7559\u72b6\u6001\uff0c<code>R<\/code> \u70ed\u91cd\u542f\u91cd\u7f6e\u72b6\u6001\uff1b<\/li>\n<li>\u4e00\u5207 UI \u7686 Widget\uff1a<code>StatelessWidget<\/code> \u7ba1\u9759\u6001\u754c\u9762\uff0c<code>StatefulWidget<\/code> \u7ba1\u4f1a\u53d8\u5316\u7684\u754c\u9762\uff1b<\/li>\n<li>\u6539\u72b6\u6001\u8981\u5305\u5728 <code>setState()<\/code> \u91cc\uff0c\u754c\u9762\u624d\u4f1a\u5237\u65b0\u3002<\/li>\n<\/ul>\n<hr>\n<p>\u4e0a\u4e00\u7bc7\uff1a<a href=\"https:\/\/www.runoob.com\/flutter\/flutter-install.html\">Flutter \u5b89\u88c5\u4e0e\u73af\u5883\u914d\u7f6e<\/a>\n\u4e0b\u4e00\u7bc7\uff1a<a href=\"https:\/\/www.runoob.com\/flutter\/flutter-project-structure.html\">Flutter \u9879\u76ee\u7ed3\u6784\u8bf4\u660e<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-536","post","type-post","status-publish","format-standard","hentry","category-flutter"],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/posts\/536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=536"}],"version-history":[{"count":2,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions"}],"predecessor-version":[{"id":538,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=\/wp\/v2\/posts\/536\/revisions\/538"}],"wp:attachment":[{"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=536"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=536"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linerroom.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}