<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>移动技术</title>
	<atom:link href="http://www.newlifeclan.com/mobile/feed" rel="self" type="application/rss+xml" />
	<link>http://www.newlifeclan.com/mobile</link>
	<description>又一个NewLifeClan站点</description>
	<lastBuildDate>Wed, 10 Jan 2024 09:33:26 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.38</generator>
	<item>
		<title>ITMS-90078: Missing Push Notification Entitlement 解决方案  开启推送</title>
		<link>http://www.newlifeclan.com/mobile/archives/808</link>
		<comments>http://www.newlifeclan.com/mobile/archives/808#comments</comments>
		<pubDate>Wed, 10 Jan 2024 09:33:26 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=808</guid>
		<description><![CDATA[<p>双击添加开启即可</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/808">ITMS-90078: Missing Push Notification Entitlement 解决方案  开启推送</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<h1 id="articleContentId" class="title-article">双击添加开启即可</h1>
<h1 class="title-article"><img class="alignnone size-full wp-image-809" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2024/01/20210310152936632.png" alt="20210310152936632" width="1694" height="1138" /></h1>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/808">ITMS-90078: Missing Push Notification Entitlement 解决方案  开启推送</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/808/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flutter 如何 禁用深色模式</title>
		<link>http://www.newlifeclan.com/mobile/archives/804</link>
		<comments>http://www.newlifeclan.com/mobile/archives/804#comments</comments>
		<pubDate>Wed, 10 Jan 2024 09:28:55 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=804</guid>
		<description><![CDATA[<p>以防万一要改写两个地方： 一、flutter程序中修改 方法1：在主题中直接添加brightness [cra [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/804">Flutter 如何 禁用深色模式</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>以防万一要改写两个地方：</p>
<p>一、flutter程序中修改</p>
<p>方法1：在主题中直接添加brightness<span id="more-804"></span></p><pre class="crayon-plain-tag">return MaterialApp(
   ThemeData(
       brightness: Brightness.light,
      )

    );</pre><p>参考链接：https://www.codenong.com/cs107087514/</p>
<p>&nbsp;</p>
<p>二、在info.plist中添加</p><pre class="crayon-plain-tag">&lt;key&gt;UIUserInterfaceStyle&lt;/key&gt;
    &lt;string&gt;Light&lt;/string&gt;
    &lt;key&gt;UIViewControllerBasedStatusBarAppearance&lt;/key&gt;
    &lt;true/&gt;</pre><p>UIStatusBarStyle <code>(Status bar style) ： </code>状态栏风格，指定状态栏内容显示风格。</p>
<p>在info.plist文件中 <mark>View controller-based status bar appearance</mark><br />
-&gt;Boolean-&gt; <mark>YES</mark>，则控制器对状态栏设置的优先级高于app<br />
-&gt;Boolean-&gt; NO，则以app为准，控制器设置状态栏设置无效</p>
<p>参考：https://codeantenna.com/a/sRkEHTNj3h</p>
<p>https://www.jianshu.com/p/3f157cbb3f42</p>
<p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/804">Flutter 如何 禁用深色模式</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/804/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flutter调试compute方法时，插拔数据线后出现问题</title>
		<link>http://www.newlifeclan.com/mobile/archives/685</link>
		<comments>http://www.newlifeclan.com/mobile/archives/685#comments</comments>
		<pubDate>Fri, 01 Dec 2023 01:49:46 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=685</guid>
		<description><![CDATA[<p>compute(function,formData).then((result) { 在调试时，将数据线拔下来 [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/685">flutter调试compute方法时，插拔数据线后出现问题</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>compute(function,formData).then((result) {</p>
<p>在调试时，将数据线拔下来，会出现无法访问的情况。</p>
<p>使用<code>compute</code>时，如果你在进行计算的过程中拔掉了数据线，可能会导致应用程序异常或崩溃，因为<code>compute</code>是在新的隔离区域（Isolate）中执行的，而拔掉数据线可能导致该隔离区域被销毁。这可能会导致一些未处理的异常，从而影响应用程序的稳定性。</p>
<p>解决：</p>
<p>手机中退出app。重新进入即可</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/685">flutter调试compute方法时，插拔数据线后出现问题</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/685/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flutter全局变量</title>
		<link>http://www.newlifeclan.com/mobile/archives/343</link>
		<comments>http://www.newlifeclan.com/mobile/archives/343#comments</comments>
		<pubDate>Wed, 27 Nov 2019 13:39:46 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=343</guid>
		<description><![CDATA[<p>我们在访问http时，需要Flutter存储一个url路径，作为全局变量，以后url路径更改以后方便更改。 其 [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/343">Flutter全局变量</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>我们在访问http时，需要Flutter存储一个url路径，作为全局变量，以后url路径更改以后方便更改。<span id="more-343"></span><br />
其实很容易，我们建一个类即可。</p>
<p>lib/common/global.dart</p><pre class="crayon-plain-tag">import 'package:flutter/material.dart';

final String httpurl = "http://192.168.2.105/";</pre><p>我们在lib/main.dart，随意使用，例如：</p><pre class="crayon-plain-tag">http.post(httpurl+'list/1',body: param).then((http.Response response){</pre><p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/343">Flutter全局变量</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/343/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>flutter 监控返回键</title>
		<link>http://www.newlifeclan.com/mobile/archives/325</link>
		<comments>http://www.newlifeclan.com/mobile/archives/325#comments</comments>
		<pubDate>Sun, 24 Nov 2019 12:36:45 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=325</guid>
		<description><![CDATA[<p>当点击左上角返回按钮时，我们需要做一些操作，那么就需要监听这个返回键。 我们来看一看代码 [crayon-6a [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/325">flutter 监控返回键</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>当点击左上角返回按钮时，我们需要做一些操作，那么就需要监听这个返回键。<span id="more-325"></span></p>
<p>我们来看一看代码</p><pre class="crayon-plain-tag">class CustomWidget extends StatelessWidget {
  .....
  @override
  Widget build(BuildContext context) {
    return WillPopScope(
      child: Scaffold(
        appBar: 
        ......
        ),
        body: Center(
          ........
        ),
      ),
      onWillPop: () async {
        print("返回键点击了");
        return true;
      },
    );
  }
}</pre><p>主要我们需要在Scaffold外面套一个WillPopScope，这样我们就能使用这个WillPopScope    widget的onWillPop方法来完成我们自己的任务了。记住onWillPop要返回true或者false</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/325">flutter 监控返回键</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/325/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flutter 富文本框</title>
		<link>http://www.newlifeclan.com/mobile/archives/322</link>
		<comments>http://www.newlifeclan.com/mobile/archives/322#comments</comments>
		<pubDate>Sun, 24 Nov 2019 12:29:30 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=322</guid>
		<description><![CDATA[<p>Flutter的TextField，虽然能通过下面的形式输入多行内容，但是感觉很不舒服并且功能很单一。 [cr [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/322">Flutter 富文本框</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>Flutter的TextField，虽然能通过下面的形式输入多行内容，但是感觉很不舒服并且功能很单一。</p><pre class="crayon-plain-tag">child: new TextField(
            keyboardType: TextInputType.multiline,
            maxLines: null,
          )</pre><p>所以我们需要一个富文本框，我们需要一个Flutter插件。<span id="more-322"></span></p>
<p><a href="https://pub.dev/packages/zefyr#-readme-tab-">https://pub.dev/packages/zefyr#-readme-tab-</a></p>
<p><a href="https://zefyr-editor.gitbook.io/docs/quick-start">https://zefyr-editor.gitbook.io/docs/quick-start</a></p>
<p>首先来安装它</p>
<p>pubspec.yaml中添加</p><pre class="crayon-plain-tag">dependencies:
  zefyr: ^0.8.0</pre><p>安装</p><pre class="crayon-plain-tag">flutter pub get</pre><p>现在我们来使用</p><pre class="crayon-plain-tag">import 'dart:convert';

import 'package:flutter/material.dart';
//富文本框
import 'package:zefyr/zefyr.dart';
import 'package:quill_delta/quill_delta.dart';

class AddProduct extends StatefulWidget{
  AddProduct({Key key}) : super(key: key);

  final String title = "添加页面";

  @override
  State&lt;StatefulWidget&gt; createState() {
    // TODO: implement createState
    return _AddProductState();
  }

}

class _AddProductState extends State&lt;AddProduct&gt; {

  /// //富文本框Allows to control the editor and the document.
  ZefyrController _controller;

  /// //富文本框Zefyr editor like any other input field requires a focus node.
  FocusNode _focusNode;

  @override
  void initState() {
    super.initState();
    // //富文本框Here we must load the document and pass it to Zefyr controller.
    final document = _loadDocument();
    _controller = ZefyrController(document);
    _focusNode = FocusNode();
  }


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
        // &lt;&lt;&lt; begin change
        actions: &lt;Widget&gt;[
          Builder(
            builder: (context) =&gt; IconButton(
              icon: Icon(Icons.save),
              onPressed: () =&gt; _saveDocument(context),
            ),
          )
        ],
        // end change &gt;&gt;&gt;
      ),
      body: WillPopScope(

        child: ZefyrScaffold(
          /*child: new TextField(
            keyboardType: TextInputType.multiline,
            maxLines: null,
          ),*/
          //富文本框
          child:  ZefyrEditor(
            padding: EdgeInsets.all(16),
            controller: _controller,
            focusNode: _focusNode,
          ),

        ),
        //监听返回按钮被触发
        onWillPop: () async{
          print("返回键点击了");
          return true;
        },
      )


    );
  }


   ///富文本框加载内容方法
  /// Loads the document to be edited in Zefyr.
  NotusDocument _loadDocument() {
    // For simplicity we hardcode a simple document with one line of text
    // saying "Zefyr Quick Start".
    // (Note that delta must always end with newline.)这里一定要有\n
    final Delta delta = Delta()..insert("\n");
    return NotusDocument.fromDelta(delta);
  }
  /// 保存内容方法
  void _saveDocument(BuildContext context) {
    // Notus documents can be easily serialized to JSON by passing to
    // `jsonEncode` directly
    final contents = jsonEncode(_controller.document);
    // For this example we save our document to a temporary file.
    print(contents);
  }

}</pre><p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/322">Flutter 富文本框</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/322/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flutter的android中其他应用可以分享到本应用</title>
		<link>http://www.newlifeclan.com/mobile/archives/317</link>
		<comments>http://www.newlifeclan.com/mobile/archives/317#comments</comments>
		<pubDate>Sat, 16 Nov 2019 09:57:24 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=317</guid>
		<description><![CDATA[<p>Flutter 可以通过直接和 Android 层通信并请求分享的数据来处理接收到的 Android inte [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/317">Flutter的android中其他应用可以分享到本应用</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>Flutter 可以通过直接和 Android 层通信并请求分享的数据来处理接收到的 Android intent。<span id="more-317"></span></p>
<p>运行 Flutter 代码的原生 Activity 注册了一个文本分享的 intent 过滤器，这样其它应用就可以和 Flutter 应用分享文本了。</p>
<p>我们首先在 Android 原生层面（在我们的 <code class="highlighter-rouge">Activity</code> 中）处理分享的文本数据，然后 Flutter 再通过使用 <code class="highlighter-rouge">MethodChannel</code> 获取这个数据。</p>
<p>首先来到 android\app\src\main\AndroidManifest.xml 中，注册 intent ：</p><pre class="crayon-plain-tag">&lt;activity
  android:name=".MainActivity"
  android:launchMode="singleTop"
  android:theme="@style/LaunchTheme"
  android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
  android:hardwareAccelerated="true"
  android:windowSoftInputMode="adjustResize"&gt;
  &lt;!-- ... --&gt;
  &lt;intent-filter&gt;
    &lt;action android:name="android.intent.action.SEND" /&gt;
    &lt;category android:name="android.intent.category.DEFAULT" /&gt;
    &lt;data android:mimeType="text/plain" /&gt;
  &lt;/intent-filter&gt;
&lt;/activity&gt;</pre><p>接着在 <code class="highlighter-rouge">MainActivity</code> 中处理 intent，提取出其它 intent 分享的文本并保存。当 Flutter 准备好处理的时候，它会使用一个平台通道请求数据，数据便会从原生端发送过来：</p>
<p>android\app\src\main\java\com\newlifeclan\tcode_book_app\MainActivity.java</p><pre class="crayon-plain-tag">package com.example.shared;

import android.content.Intent;
import android.os.Bundle;

import java.nio.ByteBuffer;

import io.flutter.app.FlutterActivity;
import io.flutter.plugin.common.ActivityLifecycleListener;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {

  private String sharedText;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
    Intent intent = getIntent();
    String action = intent.getAction();
    String type = intent.getType();

    if (Intent.ACTION_SEND.equals(action) &amp;&amp; type != null) {
      if ("text/plain".equals(type)) {
        handleSendText(intent); // Handle text being sent
      }
    }

    new MethodChannel(getFlutterView(), "app.channel.shared.data").setMethodCallHandler(
      new MethodCallHandler() {
        @Override
        public void onMethodCall(MethodCall call, MethodChannel.Result result) {
          if (call.method.contentEquals("getSharedText")) {
            result.success(sharedText);
            sharedText = null;
          }
        }
      });
  }

  void handleSendText(Intent intent) {
    sharedText = intent.getStringExtra(Intent.EXTRA_TEXT);
  }
}</pre><p>来到Flutter</p>
<p>最后，当 Widget 渲染的时候，从 Flutter 这端请求数据：</p><pre class="crayon-plain-tag">import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(SampleApp());
}

class SampleApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Sample Shared App Handler',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: SampleAppPage(),
    );
  }
}

class SampleAppPage extends StatefulWidget {
  SampleAppPage({Key key}) : super(key: key);

  @override
  _SampleAppPageState createState() =&gt; _SampleAppPageState();
}

class _SampleAppPageState extends State&lt;SampleAppPage&gt; {
  static const platform = const MethodChannel('app.channel.shared.data');
  String dataShared = "No data";

  @override
  void initState() {
    super.initState();
    getSharedText();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(body: Center(child: Text(dataShared)));
  }

  getSharedText() async {
    var sharedData = await platform.invokeMethod("getSharedText");
    if (sharedData != null) {
      setState(() {
        dataShared = sharedData;
      });
    }
  }
}</pre><p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/317">Flutter的android中其他应用可以分享到本应用</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/317/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>windows Flutter安装</title>
		<link>http://www.newlifeclan.com/mobile/archives/307</link>
		<comments>http://www.newlifeclan.com/mobile/archives/307#comments</comments>
		<pubDate>Fri, 15 Nov 2019 16:10:24 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=307</guid>
		<description><![CDATA[<p>其实Flutter安装很简单，只需两步：安装flutter sdk 和 安装 android studio 插 [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/307">windows Flutter安装</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>其实Flutter安装很简单，只需两步：安装flutter sdk 和 安装 android studio 插件</p>
<p>前提准备是我们已经成功安装了android studio，并能够运行android模拟器。</p>
<p>既然android studio和android模拟器，已经准备好了，那么我们安装吧！<span id="more-307"></span></p>
<h2>安装Flutter SDK</h2>
<p>来到官网</p>
<p><a href="https://flutter.dev/docs/get-started/install/windows">https://flutter.dev/docs/get-started/install/windows</a></p>
<p>下载sdk</p>
<p><img class="alignnone size-full wp-image-309" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2019/11/20191116000230.png" alt="20191116000230" width="638" height="373" /></p>
<p>解压后，放到自己喜欢的目录下（如 C:\src\flutter），记住不要放到需要权限的目录下。</p>
<p>在“开始”搜索栏中，输入“ env”，配置环境变量。</p>
<p>在环境变量的<strong>Path下添加flutter\bin。</strong></p>
<p>&nbsp;</p>
<h2>安装 android studio 的Flutter插件</h2>
<p>既然已经安装好了android studio，我们打开android studio。</p>
<p>选择 <strong>File &gt; Settings &gt; Plugins，选择 Marketplace</strong></p>
<p>搜索：Flutter</p>
<p>安装之。</p>
<p><img class="alignnone size-full wp-image-310" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2019/11/20191115234912.png" alt="20191115234912" width="591" height="348" /></p>
<p>&nbsp;</p>
<p>运行 flutter doctor ，得到一下错误</p>
<p>[!] Android toolchain &#8211; develop for Android devices (Android SDK 28.0.3)<br />
! Some Android licenses not accepted. To resolve this, run: flutter doctor &#8211;android-licenses</p>
<p>解决办法</p>
<p>直接运行： flutter doctor &#8211;android-licenses</p>
<p>全部选择 y</p>
<p>完成后，再次运行  flutter doctor ，就没问题</p>
<p>[√] Android toolchain &#8211; develop for Android devices (Android SDK version 28.0.3)</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/307">windows Flutter安装</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/307/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APP首页框架搭建-Scaffold与PageView</title>
		<link>http://www.newlifeclan.com/mobile/archives/301</link>
		<comments>http://www.newlifeclan.com/mobile/archives/301#comments</comments>
		<pubDate>Sun, 15 Sep 2019 03:32:11 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=301</guid>
		<description><![CDATA[<p>APP首页框架搭建 实现首页导航需要哪些材料？ 什么是Scaffold widget？ 什么是PageView [&#8230;]</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/301">APP首页框架搭建-Scaffold与PageView</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<h4>APP首页框架搭建</h4>
<ul>
<li>实现首页导航需要哪些材料？</li>
<li>什么是Scaffold widget？</li>
<li>什么是PageView？</li>
<li>实现首页导航</li>
</ul>
<p><span id="more-301"></span></p>
<h4>实现首页导航需要哪些材料<strong>?</strong></h4>
<ul>
<li>Scaffold</li>
<li>
<ul>
<li>BottomNavigationBar</li>
</ul>
</li>
<li>PageView</li>
<li>
<ul>
<li>PageController</li>
</ul>
</li>
</ul>
<h4>什么是Scaffold widget？</h4>
<p><code>Scaffold</code>是一个实现了基本的<code>material design</code>的布局结构。</p><pre class="crayon-plain-tag">class Scaffold extends StatefulWidget {
  /// Creates a visual scaffold for material design widgets.
  const Scaffold({
    Key key,
    this.appBar,
    this.body,
    this.floatingActionButton,
    this.floatingActionButtonLocation,
    this.floatingActionButtonAnimator,
    this.persistentFooterButtons,
    this.drawer,
    this.endDrawer,
    this.bottomNavigationBar,
    this.bottomSheet,
    this.backgroundColor,
    this.resizeToAvoidBottomPadding = true,
    this.primary = true,
  }) : assert(primary != null), super(key: key);</pre><p>&nbsp;</p>
<h4>顶部导航</h4>
<p><img class="alignnone size-full wp-image-302" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2019/09/9404810-d33ae5c06d0d7f4d.jpg" alt="9404810-d33ae5c06d0d7f4d" width="300" height="493" /></p><pre class="crayon-plain-tag">import 'package:flutter/material.dart';

class TabbedAppBarSample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: choices.length,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('Tabbed AppBar'),
            bottom: TabBar(
              isScrollable: true,
              tabs: choices.map((Choice choice) {
                return Tab(
                  text: choice.title,
                  icon: Icon(choice.icon),
                );
              }).toList(),
            ),
          ),
          body: TabBarView(
            children: choices.map((Choice choice) {
              return Padding(
                padding: const EdgeInsets.all(16.0),
                child: ChoiceCard(choice: choice),
              );
            }).toList(),
          ),
        ),
      ),
    );
  }
}

class Choice {
  const Choice({this.title, this.icon});
  final String title;
  final IconData icon;
}

const List&lt;Choice&gt; choices = const &lt;Choice&gt;[
  const Choice(title: 'CAR', icon: Icons.directions_car),
  const Choice(title: 'BICYCLE', icon: Icons.directions_bike),
  const Choice(title: 'BOAT', icon: Icons.directions_boat),
  const Choice(title: 'BUS', icon: Icons.directions_bus),
  const Choice(title: 'TRAIN', icon: Icons.directions_railway),
  const Choice(title: 'WALK', icon: Icons.directions_walk),
];

class ChoiceCard extends StatelessWidget {
  const ChoiceCard({Key key, this.choice}) : super(key: key);
  final Choice choice;

  @override
  Widget build(BuildContext context) {
    final TextStyle textStyle = Theme.of(context).textTheme.display1;
    return Card(
      color: Colors.white,
      child: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: &lt;Widget&gt;[
            Icon(choice.icon, size: 128.0, color: textStyle.color),
            Text(choice.title, style: textStyle),
          ],
        ),
      ),
    );
  }
}
void main() {
  runApp(TabbedAppBarSample());
}</pre><p>&nbsp;</p>
<h4>底部导航菜单</h4>
<h4><img class="alignnone size-full wp-image-303" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2019/09/20190915webp.jpg" alt="20190915webp" width="360" height="583" /></h4>
<p></p><pre class="crayon-plain-tag">import 'package:flutter/material.dart';
import 'package:flutter_app/pages/home_page.dart';
import 'package:flutter_app/pages/my_page.dart';
import 'package:flutter_app/pages/search_page.dart';
import 'package:flutter_app/pages/travel_page.dart';

class TabNavigator extends StatefulWidget {
  @override
  _TabNavigatorState createState() =&gt; _TabNavigatorState();
}

class _TabNavigatorState extends State&lt;TabNavigator&gt;
    with SingleTickerProviderStateMixin {
  final _defaultColor = Colors.grey;
  final _activeColor = Colors.blue;
  int _currentIndex = 0;
  var _controller = PageController(
    initialPage: 0,
  );

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: PageView(
        controller: _controller,
        children: &lt;Widget&gt;[HomePage(), SearchPage(), TravelPage(), MyPage()],
        physics: NeverScrollableScrollPhysics(),
      ),
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (index) {
          _controller.jumpToPage(index);
          setState(() {
            _currentIndex = index;
          });
        },
        type: BottomNavigationBarType.fixed,
        items: [
          BottomNavigationBarItem(
            icon: Icon(
              Icons.home,
              color: _defaultColor,
            ),
            activeIcon: Icon(
              Icons.home,
              color: _activeColor,
            ),
            title: Text(
              '首页',
              style: TextStyle(
                  color: _currentIndex != 0 ? _defaultColor : _activeColor),
            ),
          ),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.search,
                color: _defaultColor,
              ),
              activeIcon: Icon(
                Icons.search,
                color: _activeColor,
              ),
              title: Text(
                '搜索',
                style: TextStyle(
                    color: _currentIndex != 1 ? _defaultColor : _activeColor),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.camera_alt,
                color: _defaultColor,
              ),
              activeIcon: Icon(
                Icons.camera_alt,
                color: _activeColor,
              ),
              title: Text(
                '旅拍',
                style: TextStyle(
                    color: _currentIndex != 2 ? _defaultColor : _activeColor),
              )),
          BottomNavigationBarItem(
              icon: Icon(
                Icons.account_circle,
                color: _defaultColor,
              ),
              activeIcon: Icon(
                Icons.account_circle,
                color: _activeColor,
              ),
              title: Text(
                '我的',
                style: TextStyle(
                    color: _currentIndex != 3 ? _defaultColor : _activeColor),
              )),
        ],
      ),
    );
  }
}</pre><p>&nbsp;</p>
<h4>侧拉栏菜单</h4>
<p><img class="alignnone size-full wp-image-304" src="http://www.newlifeclan.com/mobile/wp-content/uploads/sites/6/2019/09/20190915webp_1.jpg" alt="20190915webp_1" width="320" height="533" /></p><pre class="crayon-plain-tag">import 'package:flutter/material.dart';

void main() =&gt; runApp(MyApp());

class MyApp extends StatelessWidget {
  final appTitle = 'Drawer Demo';
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: appTitle,
      home: MyHomePage(title: appTitle),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String title;
  MyHomePage({Key key, this.title}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(title)),
      body: Center(child: Text('My Page!')),
      drawer: Drawer(
        // Add a ListView to the drawer. This ensures the user can scroll
        // through the options in the Drawer if there isn't enough vertical
        // space to fit everything.
        child: ListView(
          // Important: Remove any padding from the ListView.
          padding: EdgeInsets.zero,
          children: &lt;Widget&gt;[
            DrawerHeader(
              child: Text('Drawer Header'),
              decoration: BoxDecoration(
                color: Colors.blue,
              ),
            ),
            ListTile(
              title: Text('Item 1'),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
            ListTile(
              title: Text('Item 2'),
              onTap: () {
                // Update the state of the app
                // ...
                // Then close the drawer
                Navigator.pop(context);
              },
            ),
          ],
        ),
      ),
    );
  }
}</pre><p>&nbsp;</p>
<h4>什么是PageView？</h4>
<p><code>PageView</code>是一个可以完成页面之间滚动的widget。 类似于Android中的ViewPager</p><pre class="crayon-plain-tag">class PageView extends StatefulWidget {
   PageView({
    Key key,
    this.scrollDirection = Axis.horizontal, //滚动的方向，支持水平和垂直两个方向
    this.reverse = false, //是否反方向滚动
    PageController controller, //PageView的控制类
    this.physics, //手势滚动逻辑，支持不滚动，总是滚动，与滚动到边缘时是否有bounce
    this.pageSnapping = true,//设置为false以禁用页面捕捉，对自定义滚动行为很有用。
    this.onPageChanged,//页面切换时调用
    List&lt;Widget&gt; children = const &lt;Widget&gt;[],
  }) : controller = controller ?? _defaultPageController,
       childrenDelegate = SliverChildListDelegate(children),
       super(key: key);
...</pre><p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/301">APP首页框架搭建-Scaffold与PageView</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/301/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>android之imageview加载assets中的图片</title>
		<link>http://www.newlifeclan.com/mobile/archives/290</link>
		<comments>http://www.newlifeclan.com/mobile/archives/290#comments</comments>
		<pubDate>Fri, 07 Dec 2018 06:56:59 +0000</pubDate>
		<dc:creator><![CDATA[napoleon]]></dc:creator>
				<category><![CDATA[未分类]]></category>

		<guid isPermaLink="false">http://www.newlifeclan.com/mobile/?p=290</guid>
		<description><![CDATA[<p>很简单不多介绍，直接看代码吧！ [crayon-6a1089eb00003057950231/] &#160;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/290">android之imageview加载assets中的图片</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></description>
				<content:encoded><![CDATA[<p>很简单不多介绍，直接看代码吧！<span id="more-290"></span></p><pre class="crayon-plain-tag">//加载图片
        //assetManager = mActivity.getAssets();//在adapter中写法
        assetManager=context.getAssets(); //获取assets下内容
        ImageView imageView =  (ImageView) view.findViewById(R.id.imageView); 
        try {
            InputStream in=assetManager.open("crocodile.PNG"); //打开文件
            Bitmap bmp=BitmapFactory.decodeStream(in); //转化
            imageView.setImageBitmap(bmp); //将图片写入imageview
        } catch (Exception e) {
            // TODO: handle exception
        }</pre><p>&nbsp;</p>
<p><a rel="nofollow" href="http://www.newlifeclan.com/mobile/archives/290">android之imageview加载assets中的图片</a>，首发于<a rel="nofollow" href="http://www.newlifeclan.com/mobile">移动技术</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.newlifeclan.com/mobile/archives/290/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
