176 lines
9.2 KiB
HTML
176 lines
9.2 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=no">
|
||
<meta name="description" content="API docs for the fromAssetImage method from the BitmapDescriptor class, for the Dart programming language.">
|
||
<title>fromAssetImage method - BitmapDescriptor class - amap_map library - Dart API</title>
|
||
|
||
|
||
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro:500,400i,400,300|Source+Sans+Pro:400,300,700" rel="stylesheet">
|
||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||
<link rel="stylesheet" href="../../static-assets/github.css">
|
||
<link rel="stylesheet" href="../../static-assets/styles.css">
|
||
<link rel="icon" href="../../static-assets/favicon.png">
|
||
|
||
</head>
|
||
|
||
<body data-base-href="../../"
|
||
data-using-base-href="false">
|
||
|
||
<div id="overlay-under-drawer"></div>
|
||
|
||
<header id="title">
|
||
<button id="sidenav-left-toggle" type="button"> </button>
|
||
<ol class="breadcrumbs gt-separated dark hidden-xs">
|
||
<li><a href="../../index.html">amap_map</a></li>
|
||
<li><a href="../../amap_map/amap_map-library.html">amap_map</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor-class.html">BitmapDescriptor</a></li>
|
||
<li class="self-crumb">fromAssetImage method</li>
|
||
</ol>
|
||
<div class="self-name">fromAssetImage</div>
|
||
<form class="search navbar-right" role="search">
|
||
<input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
|
||
</form>
|
||
</header>
|
||
|
||
<main>
|
||
|
||
<div id="dartdoc-sidebar-left" class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
|
||
<header id="header-search-sidebar" class="hidden-l">
|
||
<form class="search-sidebar" role="search">
|
||
<input type="text" id="search-sidebar" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
|
||
</form>
|
||
</header>
|
||
|
||
<ol class="breadcrumbs gt-separated dark hidden-l" id="sidebar-nav">
|
||
<li><a href="../../index.html">amap_map</a></li>
|
||
<li><a href="../../amap_map/amap_map-library.html">amap_map</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor-class.html">BitmapDescriptor</a></li>
|
||
<li class="self-crumb">fromAssetImage method</li>
|
||
</ol>
|
||
|
||
<h5>BitmapDescriptor class</h5>
|
||
<ol>
|
||
|
||
|
||
<li class="section-title inherited">
|
||
<a href="../../amap_map/BitmapDescriptor-class.html#instance-properties">Properties</a>
|
||
</li>
|
||
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/hashCode.html">hashCode</a></li>
|
||
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/runtimeType.html">runtimeType</a></li>
|
||
|
||
<li class="section-title"><a href="../../amap_map/BitmapDescriptor-class.html#instance-methods">Methods</a></li>
|
||
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/toMap.html">toMap</a></li>
|
||
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/toString.html">toString</a></li>
|
||
|
||
<li class="section-title inherited"><a href="../../amap_map/BitmapDescriptor-class.html#operators">Operators</a></li>
|
||
<li class="inherited"><a href="https://api.flutter.dev/flutter/dart-core/Object/operator_equals.html">operator ==</a></li>
|
||
|
||
|
||
<li class="section-title"><a href="../../amap_map/BitmapDescriptor-class.html#static-methods">Static methods</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/defaultMarkerWithHue.html">defaultMarkerWithHue</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/fromAssetImage.html">fromAssetImage</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/fromBytes.html">fromBytes</a></li>
|
||
|
||
<li class="section-title"><a href="../../amap_map/BitmapDescriptor-class.html#constants">Constants</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/defaultMarker-constant.html">defaultMarker</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueAzure-constant.html">hueAzure</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueBlue-constant.html">hueBlue</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueCyan-constant.html">hueCyan</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueGreen-constant.html">hueGreen</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueMagenta-constant.html">hueMagenta</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueOrange-constant.html">hueOrange</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueRed-constant.html">hueRed</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueRose-constant.html">hueRose</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueViolet-constant.html">hueViolet</a></li>
|
||
<li><a href="../../amap_map/BitmapDescriptor/hueYellow-constant.html">hueYellow</a></li>
|
||
|
||
|
||
</ol>
|
||
</div><!--/.sidebar-offcanvas-->
|
||
|
||
<div id="dartdoc-main-content" class="col-xs-12 col-sm-9 col-md-8 main-content">
|
||
<div><h1><span class="kind-method">fromAssetImage</span> method </h1></div>
|
||
|
||
<section class="multi-line-signature">
|
||
<span class="returntype"><a href="https://api.flutter.dev/flutter/dart-async/Future-class.html">Future</a><span class="signature"><<wbr><span class="type-parameter"><a href="../../amap_map/BitmapDescriptor-class.html">BitmapDescriptor</a></span>></span></span>
|
||
<span class="name ">fromAssetImage</span>
|
||
(<wbr><ol class="parameter-list"><li><span class="parameter" id="fromAssetImage-param-configuration"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/painting/ImageConfiguration-class.html">ImageConfiguration</a></span> <span class="parameter-name">configuration</span>, </span></li>
|
||
<li><span class="parameter" id="fromAssetImage-param-assetName"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/String-class.html">String</a></span> <span class="parameter-name">assetName</span>, </span></li>
|
||
<li><span class="parameter" id="fromAssetImage-param-bundle">{<span class="type-annotation"><a href="https://api.flutter.dev/flutter/services/AssetBundle-class.html">AssetBundle</a></span> <span class="parameter-name">bundle</span>, </span></li>
|
||
<li><span class="parameter" id="fromAssetImage-param-package"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/String-class.html">String</a></span> <span class="parameter-name">package</span>, </span></li>
|
||
<li><span class="parameter" id="fromAssetImage-param-mipmaps"><span class="type-annotation"><a href="https://api.flutter.dev/flutter/dart-core/bool-class.html">bool</a></span> <span class="parameter-name">mipmaps</span>: <span class="default-value">true</span>}</span></li>
|
||
</ol>)
|
||
|
||
</section>
|
||
<section class="desc markdown">
|
||
<p>从资源图像创建<a href="../../amap_map/BitmapDescriptor-class.html">BitmapDescriptor</a>。</p>
|
||
<p>Flutter中的assert的资产图像按以下方式存储:
|
||
<a href="https://flutter.dev/docs/development/ui/assets">https://flutter.dev/docs/development/ui/assets</a> and images声明-分辨率感知图像资源
|
||
该方法考虑了各种资产解决方案
|
||
并根据dpi将图像缩放到正确的分辨率。
|
||
将<code>mipmaps1设置为false可加载图像的精确dpi版本,默认情况下,</code>mipmap`为true。</p>
|
||
</section>
|
||
|
||
<section class="summary source-code" id="source">
|
||
<h2><span>Implementation</span></h2>
|
||
<pre class="language-dart"><code class="language-dart">static Future<BitmapDescriptor> fromAssetImage(
|
||
ImageConfiguration configuration,
|
||
String assetName, {
|
||
AssetBundle bundle,
|
||
String package,
|
||
bool mipmaps = true,
|
||
}) async {
|
||
if (!mipmaps && configuration.devicePixelRatio != null) {
|
||
return BitmapDescriptor._(<dynamic>[
|
||
'fromAssetImage',
|
||
assetName,
|
||
configuration.devicePixelRatio,
|
||
]);
|
||
}
|
||
final AssetImage assetImage =
|
||
AssetImage(assetName, package: package, bundle: bundle);
|
||
final AssetBundleImageKey assetBundleImageKey =
|
||
await assetImage.obtainKey(configuration);
|
||
return BitmapDescriptor._(<dynamic>[
|
||
'fromAssetImage',
|
||
assetBundleImageKey.name,
|
||
assetBundleImageKey.scale,
|
||
if (kIsWeb && configuration?.size != null)
|
||
[
|
||
configuration.size.width,
|
||
configuration.size.height,
|
||
],
|
||
]);
|
||
}</code></pre>
|
||
</section>
|
||
|
||
</div> <!-- /.main-content -->
|
||
|
||
<div id="dartdoc-sidebar-right" class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
|
||
</div><!--/.sidebar-offcanvas-->
|
||
|
||
</main>
|
||
|
||
<footer>
|
||
<span class="no-break">
|
||
amap_map
|
||
1.1.0
|
||
</span>
|
||
|
||
</footer>
|
||
|
||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||
<script src="../../static-assets/typeahead.bundle.min.js"></script>
|
||
<script src="../../static-assets/highlight.pack.js"></script>
|
||
<script src="../../static-assets/URI.js"></script>
|
||
<script src="../../static-assets/script.js"></script>
|
||
|
||
|
||
</body>
|
||
|
||
</html>
|