<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 概述 ## pubspec.yaml 指定文件 ``` flutter: assets: - assets/my_icon.png - assets/background.png ``` 指定目錄 ``` flutter: assets: - directory/ - directory/subdirectory/ ``` ## 加載不同分辨率的圖片 將邏輯請求資源映射到最接近當前[設備像素比](https://api.flutter-io.cn/flutter/dart-ui/FlutterView/devicePixelRatio.html)的資源 如 ``` .../my_icon.png .../2.0x/my_icon.png .../3.0x/my_icon.png ``` 設備像素比率為 1.8 的設備上,對應是`.../2.0x/my_icon.png`。如果是 2.7 的設備像素比,對應是`.../3.0x/my_icon.png` 加載資源的code ``` return const Image(image: AssetImage('graphics/background.png')); ``` > 注意:`lib/`是隱含的,所以它不應該包含在資源路徑中 ## 平臺共享 assets 在Android和 iOS 中加載 Flutter 資源文件 ### Android 在 Android 平臺上,assets 通過[`AssetManager`](https://developer.android.google.cn/reference/android/content/res/AssetManager)API 讀取 想要在 Java 插件中訪問 icons/heart.png; ``` AssetManager assetManager = registrar.context().getAssets(); String key = registrar.lookupKeyForAsset("icons/heart.png"); AssetFileDescriptor fd = assetManager.openFd(key); ``` ### iOS 在 iOS 平臺上,assets 資源文件通過[`mainBundle`](https://developer.apple.com/documentation/foundation/nsbundle/1410786-mainbundle)讀取 ``` NSString* key = [registrar lookupKeyForAsset:@"icons/heart.png"]; NSString* path = [[NSBundle mainBundle] pathForResource:key ofType:nil]; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看