hyzp_ybqx-Commit137:已经实现android版通过资产添加百度地图标识图标,并通过BMFText添加文本标识;IOS版则通过自定义 flutter_bmfmap_1.0.2 插件加载外部存储中的.png带文本的标识图标

This commit is contained in:
WinUser01
2022-05-02 15:08:25 +08:00
parent eb03a6085d
commit 7dbf4f0901
2 changed files with 103 additions and 62 deletions
+17 -13
View File
@@ -1,3 +1,4 @@
import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/cupertino.dart';
@@ -694,21 +695,24 @@ Future getAllSumCll(String field, List listStatis) async {
//////////////////////////////////////////////////////////////////
// 百度地图初始化
Future bmfInit() async {
g_myIconPathPre = await createDir(g_myIconDir);
print("g_myIconPathPre = $g_myIconPathPre");
// g_myIconPathPre = /data/user/0/com.example.hyzp_yibin_bmfmap/app_flutter/myIcons
// 只有IOS版才需要
if (Platform.isIOS) {
g_myIconPathPre = await createDir(g_myIconDir);
print("g_myIconPathPre = $g_myIconPathPre");
// g_myIconPathPre = /data/user/0/com.example.hyzp_yibin_bmfmap/app_flutter/myIcons
int len = listDwinfoGetList2.length;
for (int i = 0; i < len; i++) {
Widget iconWidget = await getIconWidget("${i + 1}、" + listDwinfoGetList2[i]["dwmc"]);
ByteData byteData = await widgetToImage(iconWidget);
await saveImage(g_myIconDir, "${g_myIconPre}${i + 1}.png", byteData);
print("i = $i");
if (i == len - 1) {
// setState(() {});
// runApp(MyApp());
int len = listDwinfoGetList2.length;
for (int i = 0; i < len; i++) {
Widget iconWidget = await getIconWidget("${i + 1}、" + listDwinfoGetList2[i]["dwmc"]);
ByteData byteData = await widgetToImage(iconWidget);
await saveImage(g_myIconDir, "${g_myIconPre}${i + 1}.png", byteData);
print("i = $i");
if (i == len - 1) {
// setState(() {});
// runApp(MyApp());
}
}
}
} else if (Platform.isAndroid) {}
}
//////////////////////////////////////////////////////////////////