提交 fcc475e2 authored 作者: 袁静春's avatar 袁静春

提交:修改文件目录和配置;

上级 9bdd74bd
import 'dart:async'; import 'dart:async';
import 'package:amap_flutter_base/amap_flutter_base.dart'; import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:clx_map_poi_search/core/clx_map_poi_search_platform_interface.dart';
import 'package:clx_map_poi_search/core/poi_result.dart'; import 'package:clx_map_poi_search/core/poi_result.dart';
import 'clx_map_poi_search_platform_interface.dart';
class ClxMapPoiSearch { class ClxMapPoiSearch {
...@@ -10,26 +10,13 @@ class ClxMapPoiSearch { ...@@ -10,26 +10,13 @@ class ClxMapPoiSearch {
ClxMapPoiSearch._() { ClxMapPoiSearch._() {
setupSearch(); setupSearch();
} }
setupSearch() { }
// late final StreamController<MapEvent> mapEventStreamController; /// init
setupSearch() {
// MethodChannel searchChannel = ClxMapPoiSearchPlatform.instance.getSearchChannel as MethodChannel;
// searchChannel.setMethodCallHandler((call) => _handleMethodCall(call));
// handleMethodCall的`broadcast`
// mapEventStreamController = StreamController<MapEvent>.broadcast();
}
/// init Search
initPoiSearch(AMapApiKey apiKey) { initPoiSearch(AMapApiKey apiKey) {
ClxMapPoiSearchPlatform.instance.initPoiSearch(apiKey); ClxMapPoiSearchPlatform.instance.initPoiSearch(apiKey);
} }
/// Demo
Future<String?> getPlatformVersion() {
return ClxMapPoiSearchPlatform.instance.getPlatformVersion();
}
/// poi 搜索 /// poi 搜索
Future<PoiResult?> keywordsSearch(String keyWord) { Future<PoiResult?> keywordsSearch(String keyWord) {
return ClxMapPoiSearchPlatform.instance.keywordsSearch(keyWord); return ClxMapPoiSearchPlatform.instance.keywordsSearch(keyWord);
...@@ -39,19 +26,4 @@ class ClxMapPoiSearch { ...@@ -39,19 +26,4 @@ class ClxMapPoiSearch {
Future<PoiResult?> aroundSearch(double latitude, double longitude) { Future<PoiResult?> aroundSearch(double latitude, double longitude) {
return ClxMapPoiSearchPlatform.instance.aroundSearch(latitude, longitude); return ClxMapPoiSearchPlatform.instance.aroundSearch(latitude, longitude);
} }
// 回调函数
// Future<dynamic> _handleMethodCall(MethodCall call) async {
// switch (call.method) {
// case 'camera#searchPOIEvent':
// try {
// mapEventStreamController.add(
// MapSearchPOIEvent(PoiResult.toPoiResult(call.arguments['searchPOIResult'])!),
// );
// } catch (e) {
// print("camera#searchPOIEvent error===>" + e.toString());
// }
// break;
// }
// }
} }
import 'package:amap_flutter_base/amap_flutter_base.dart'; import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:clx_map_poi_search/core/clx_map_poi_search_platform_interface.dart';
import 'package:clx_map_poi_search/core/poi_result.dart'; import 'package:clx_map_poi_search/core/poi_result.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'clx_map_poi_search_platform_interface.dart';
/// An implementation of [ClxMapPoiSearchPlatform] that uses method channels. /// An implementation of [ClxMapPoiSearchPlatform] that uses method channels.
class MethodChannelClxMapPoiSearch extends ClxMapPoiSearchPlatform { class MethodChannelClxMapPoiSearch extends ClxMapPoiSearchPlatform {
...@@ -22,12 +22,6 @@ class MethodChannelClxMapPoiSearch extends ClxMapPoiSearchPlatform { ...@@ -22,12 +22,6 @@ class MethodChannelClxMapPoiSearch extends ClxMapPoiSearchPlatform {
}); });
} }
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
// 关键字搜索 // 关键字搜索
@override @override
Future<PoiResult?> keywordsSearch(String keywords) async { Future<PoiResult?> keywordsSearch(String keywords) async {
......
import 'package:amap_flutter_base/amap_flutter_base.dart'; import 'package:amap_flutter_base/amap_flutter_base.dart';
import 'package:clx_map_poi_search/core/clx_map_poi_search_method_channel.dart';
import 'package:clx_map_poi_search/core/poi_result.dart'; import 'package:clx_map_poi_search/core/poi_result.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'clx_map_poi_search_method_channel.dart';
abstract class ClxMapPoiSearchPlatform extends PlatformInterface { abstract class ClxMapPoiSearchPlatform extends PlatformInterface {
/// Constructs a ClxMapPoiSearchPlatform. /// Constructs a ClxMapPoiSearchPlatform.
...@@ -38,11 +38,6 @@ abstract class ClxMapPoiSearchPlatform extends PlatformInterface { ...@@ -38,11 +38,6 @@ abstract class ClxMapPoiSearchPlatform extends PlatformInterface {
throw UnimplementedError('initPoiSearch() has not been implemented.'); throw UnimplementedError('initPoiSearch() has not been implemented.');
} }
// 获取平台version
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
// 关键字搜索 // 关键字搜索
Future<PoiResult?> keywordsSearch(String keywords) async { Future<PoiResult?> keywordsSearch(String keywords) async {
throw UnimplementedError('keywordsSearch() has not been implemented.'); throw UnimplementedError('keywordsSearch() has not been implemented.');
......
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:clx_map_poi_search/clx_map_poi_search_method_channel.dart'; import 'package:clx_map_poi_search/core/clx_map_poi_search_method_channel.dart';
void main() { void main() {
MethodChannelClxMapPoiSearch platform = MethodChannelClxMapPoiSearch(); MethodChannelClxMapPoiSearch platform = MethodChannelClxMapPoiSearch();
......
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:clx_map_poi_search/clx_map_poi_search.dart'; import 'package:clx_map_poi_search/clx_map_poi_search.dart';
import 'package:clx_map_poi_search/clx_map_poi_search_platform_interface.dart'; import 'package:clx_map_poi_search/clx_map_poi_search_platform_interface.dart';
import 'package:clx_map_poi_search/clx_map_poi_search_method_channel.dart'; import 'package:clx_map_poi_search/core/clx_map_poi_search_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockClxMapPoiSearchPlatform class MockClxMapPoiSearchPlatform
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论