Browse Source

new

wr_2024_invoice
zsw 7 months ago
parent
commit
80cb35ee66
  1. 2
      android/app/build.gradle
  2. BIN
      android/app/libs/uniMPSDK-release.aar
  3. 27
      android/app/src/main/AndroidManifest.xml
  4. 16
      android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt
  5. 4
      android/build.gradle
  6. 6
      android/gradle.properties
  7. 7
      android/gradle/wrapper/gradle-wrapper.properties
  8. 191
      ios/Podfile.lock
  9. 44
      ios/Runner.xcodeproj/project.pbxproj
  10. 22
      ios/Runner/Info.plist
  11. 339
      lib/address/address_map_page.dart
  12. 5
      lib/community/community_view/home_class.dart
  13. 5
      lib/community/headlines/activity_top_list.dart
  14. 7
      lib/community/headlines/headlines_collection.dart
  15. 94
      lib/home/home_view/quick_order.dart
  16. 4
      lib/main.dart
  17. 26
      lib/main_page.dart
  18. 8
      lib/mine/mine_shop_details.dart
  19. 6
      lib/mine/vip_detail_page.dart
  20. 12
      lib/mine/vip_pay_code.dart
  21. 6
      lib/order/store_selector_page.dart
  22. 4
      lib/retrofit/business_api.dart
  23. 16
      lib/retrofit/data/latlng.dart
  24. 4
      lib/retrofit/data/store_info.dart
  25. 3
      lib/retrofit/min_api.dart
  26. 10
      lib/retrofit/retrofit_api.dart
  27. 20
      lib/retrofit/retrofit_api.g.dart
  28. 50
      lib/settlement/settlement.dart
  29. 27
      lib/settlement/settlement_view/distribution.dart
  30. 11
      lib/store/shopping/shopping_cart/shopping_cart_page.dart
  31. 1
      lib/store/shopping/shopping_home/classify_list.dart
  32. 1
      lib/store/shopping/shopping_home/search_page.dart
  33. 15
      lib/store/store_order.dart
  34. 4
      lib/store/store_view/shop_car.dart
  35. 77
      lib/store/store_view/store_info.dart
  36. 2412
      lib/union/location_map_page.dart
  37. 7
      lib/union/union_list.dart
  38. 62
      lib/union/union_page.dart
  39. 239
      lib/union/union_view/store_info.dart
  40. 17
      lib/utils/flutter_utils.dart
  41. 141
      lib/utils/gps_utils.dart
  42. 193
      lib/utils/location.dart
  43. 256
      pubspec.lock
  44. 9
      pubspec.yaml

2
android/app/build.gradle

@ -106,7 +106,7 @@ android {
defaultConfig { defaultConfig {
applicationId "com.zsw.huixiang" applicationId "com.zsw.huixiang"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 31
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName

BIN
android/app/libs/uniMPSDK-release.aar

Binary file not shown.

27
android/app/src/main/AndroidManifest.xml

@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.zsw.huixiang"> package="com.zsw.huixiang">
<!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>--> <!-- <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>-->
@ -36,7 +37,6 @@
<application <application
android:label="海峡姐妹" android:label="海峡姐妹"
android:name=".HxApplication"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@ -102,35 +102,12 @@
android:name="com.yalantis.ucrop.UCropActivity" android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity
android:name="io.dcloud.PandoraEntryActivity"
android:configChanges="orientation|keyboardHidden|screenSize|mcc|mnc|fontScale|keyboard"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:permission="com.miui.securitycenter.permission.AppPermissionsEditor"
android:screenOrientation="user"
android:theme="@style/DCloudTheme"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<action android:name="android.intent.action.VIEW" />
<data android:scheme="h56131bcf" />
</intent-filter>
</activity>
<service android:name="com.amap.api.location.APSService"/> <service android:name="com.amap.api.location.APSService"/>
<meta-data
android:name="dcloud_appkey"
android:value="" />
<meta-data <meta-data
android:name="com.amap.api.v2.apikey" android:name="com.amap.api.v2.apikey"
android:value="f39d1daa020a56f208eb2519f63e9534"/> android:value="f39d1daa020a56f208eb2519f63e9534"/>
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="cdM5EPFACARrrHRjCwUEoYuzIlfFWdYP" />
<meta-data <meta-data
android:name="flutterEmbedding" android:name="flutterEmbedding"
android:value="2" /> android:value="2" />

16
android/app/src/main/kotlin/com/zsw/huixiang/HxApplication.kt

@ -1,16 +0,0 @@
package com.zsw.huixiang
import android.app.Application
import com.baidu.mapapi.base.BmfMapApplication
class HxApplication : BmfMapApplication() {
override fun onCreate() {
super.onCreate()
}
}

4
android/build.gradle

@ -8,11 +8,13 @@ buildscript {
url 'https://maven.aliyun.com/repository/jcenter' url 'https://maven.aliyun.com/repository/jcenter'
} }
maven { maven {
allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public' url 'http://maven.aliyun.com/nexus/content/groups/public'
} }
// google() // google()
// jcenter() // jcenter()
maven { maven {
allowInsecureProtocol = true
url "http://mvn.mob.com/android" url "http://mvn.mob.com/android"
} }
maven { url "https://www.jitpack.io" } maven { url "https://www.jitpack.io" }
@ -43,11 +45,13 @@ allprojects {
url 'https://maven.aliyun.com/repository/jcenter' url 'https://maven.aliyun.com/repository/jcenter'
} }
maven { maven {
allowInsecureProtocol = true
url 'http://maven.aliyun.com/nexus/content/groups/public' url 'http://maven.aliyun.com/nexus/content/groups/public'
} }
// google() // google()
// jcenter() // jcenter()
maven { maven {
allowInsecureProtocol = true
url "http://mvn.mob.com/android" url "http://mvn.mob.com/android"
} }
maven { url "https://www.jitpack.io" } maven { url "https://www.jitpack.io" }

6
android/gradle.properties

@ -1,6 +1,8 @@
#org.gradle.jvmargs=-Xmx1536M #org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4096m #org.gradle.jvmargs=-Xmx4096m
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
MobSDK.mobEnv=x MobSDK.mobEnv=x
MobSDK.spEdition=FP MobSDK.spEdition=FP
android.injected.testOnly=false
org.gradle.jvmargs=-Xmx4096m --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED

7
android/gradle/wrapper/gradle-wrapper.properties vendored

@ -1,10 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
#distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
systemProp.http.proxyHost=proxy.com
systemProp.http.proxyPort=8080

191
ios/Podfile.lock

@ -14,38 +14,14 @@ PODS:
- AFNetworking/Serialization (4.0.1) - AFNetworking/Serialization (4.0.1)
- AFNetworking/UIKit (4.0.1): - AFNetworking/UIKit (4.0.1):
- AFNetworking/NSURLSession - AFNetworking/NSURLSession
- BaiduMapKit/Base (6.5.1)
- BaiduMapKit/Map (6.5.1):
- BaiduMapKit/Base
- BaiduMapKit/Search (6.5.1):
- BaiduMapKit/Base
- BaiduMapKit/Utils (6.5.1):
- BaiduMapKit/Base
- BMKLocationKit (2.0.4)
- emoji_picker_flutter (0.0.1): - emoji_picker_flutter (0.0.1):
- Flutter - Flutter
- Flutter (1.0.0) - Flutter (1.0.0)
- flutter_baidu_mapapi_base (3.1.0):
- BaiduMapKit/Utils (= 6.5.1)
- Flutter
- flutter_baidu_mapapi_map (3.1.0):
- BaiduMapKit/Map (= 6.5.1)
- Flutter
- flutter_baidu_mapapi_base
- flutter_baidu_mapapi_search (3.1.0):
- BaiduMapKit/Search (= 6.5.1)
- Flutter
- flutter_baidu_mapapi_base
- flutter_baidu_mapapi_utils (3.1.0):
- BaiduMapKit/Utils (= 6.5.1)
- Flutter
- flutter_baidu_mapapi_base
- flutter_bmflocation (2.0.1):
- BMKLocationKit (~> 2.0.4)
- Flutter
- fluwx (0.0.1): - fluwx (0.0.1):
- Flutter - Flutter
- mob_sharesdk/ShareSDKPlatforms/WeChatFull - "OpenWeChatSDK (~> 1.9.2+1)"
- geolocator (6.2.0):
- Flutter
- image_gallery_saver (1.5.0): - image_gallery_saver (1.5.0):
- Flutter - Flutter
- image_pickers (0.0.1): - image_pickers (0.0.1):
@ -60,103 +36,13 @@ PODS:
- mob_sharesdk/ShareSDKExtension (4.4.15): - mob_sharesdk/ShareSDKExtension (4.4.15):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/DingTalk (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Douyin (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Dropbox (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Evernote (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Facebook (4.4.15): - mob_sharesdk/ShareSDKPlatforms/Facebook (4.4.15):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Flickr (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/GooglePlus (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Instagram (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Instapaper (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Kakao (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/KuaiShou (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Line (4.4.15): - mob_sharesdk/ShareSDKPlatforms/Line (4.4.15):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/LinkedIn (4.4.15): - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Messenger (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/MingDao (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Oasis (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Pinterest (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Pocket (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/QQ (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Reddit (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/SinaWeibo (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/SMS (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/SnapChat (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Telegram (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/TikTok (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Twitter (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/VKontakte (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WeChatFull (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WeWork (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/Yixin (4.4.15):
- mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKPlatforms/YouDaoNote (4.4.15):
- mob_sharesdk/ShareSDK - mob_sharesdk/ShareSDK
- MOBFoundation (>= 3.2.9) - MOBFoundation (>= 3.2.9)
- mob_sharesdk/ShareSDKUI (4.4.15): - mob_sharesdk/ShareSDKUI (4.4.15):
@ -165,6 +51,7 @@ PODS:
- MOBFoundation (3.2.49) - MOBFoundation (3.2.49)
- number_precision (0.0.1): - number_precision (0.0.1):
- Flutter - Flutter
- "OpenWeChatSDK (1.9.9+1)"
- package_info (0.0.1): - package_info (0.0.1):
- Flutter - Flutter
- path_provider (0.0.1): - path_provider (0.0.1):
@ -183,39 +70,9 @@ PODS:
- Flutter - Flutter
- mob_sharesdk - mob_sharesdk
- mob_sharesdk/ShareSDKExtension - mob_sharesdk/ShareSDKExtension
- mob_sharesdk/ShareSDKPlatforms/DingTalk
- mob_sharesdk/ShareSDKPlatforms/Douyin
- mob_sharesdk/ShareSDKPlatforms/Dropbox
- mob_sharesdk/ShareSDKPlatforms/Evernote
- mob_sharesdk/ShareSDKPlatforms/Facebook - mob_sharesdk/ShareSDKPlatforms/Facebook
- mob_sharesdk/ShareSDKPlatforms/Flickr
- mob_sharesdk/ShareSDKPlatforms/GooglePlus
- mob_sharesdk/ShareSDKPlatforms/Instagram
- mob_sharesdk/ShareSDKPlatforms/Instapaper
- mob_sharesdk/ShareSDKPlatforms/Kakao
- mob_sharesdk/ShareSDKPlatforms/KuaiShou
- mob_sharesdk/ShareSDKPlatforms/Line - mob_sharesdk/ShareSDKPlatforms/Line
- mob_sharesdk/ShareSDKPlatforms/LinkedIn - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite
- mob_sharesdk/ShareSDKPlatforms/Messenger
- mob_sharesdk/ShareSDKPlatforms/MingDao
- mob_sharesdk/ShareSDKPlatforms/Oasis
- mob_sharesdk/ShareSDKPlatforms/Pinterest
- mob_sharesdk/ShareSDKPlatforms/Pocket
- mob_sharesdk/ShareSDKPlatforms/QQ
- mob_sharesdk/ShareSDKPlatforms/Reddit
- mob_sharesdk/ShareSDKPlatforms/SinaWeibo
- mob_sharesdk/ShareSDKPlatforms/SMS
- mob_sharesdk/ShareSDKPlatforms/SnapChat
- mob_sharesdk/ShareSDKPlatforms/Telegram
- mob_sharesdk/ShareSDKPlatforms/TikTok
- mob_sharesdk/ShareSDKPlatforms/Twitter
- mob_sharesdk/ShareSDKPlatforms/VKontakte
- mob_sharesdk/ShareSDKPlatforms/WatermelonVideo
- mob_sharesdk/ShareSDKPlatforms/WeChatFull
- mob_sharesdk/ShareSDKPlatforms/WeWork
- mob_sharesdk/ShareSDKPlatforms/WhatsApp
- mob_sharesdk/ShareSDKPlatforms/Yixin
- mob_sharesdk/ShareSDKPlatforms/YouDaoNote
- mob_sharesdk/ShareSDKUI - mob_sharesdk/ShareSDKUI
- SSZipArchive (2.4.3) - SSZipArchive (2.4.3)
- thumbnails (0.0.1): - thumbnails (0.0.1):
@ -247,12 +104,8 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`) - emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- flutter_baidu_mapapi_base (from `.symlinks/plugins/flutter_baidu_mapapi_base/ios`)
- flutter_baidu_mapapi_map (from `.symlinks/plugins/flutter_baidu_mapapi_map/ios`)
- flutter_baidu_mapapi_search (from `.symlinks/plugins/flutter_baidu_mapapi_search/ios`)
- flutter_baidu_mapapi_utils (from `.symlinks/plugins/flutter_baidu_mapapi_utils/ios`)
- flutter_bmflocation (from `.symlinks/plugins/flutter_bmflocation/ios`)
- fluwx (from `.symlinks/plugins/fluwx/ios`) - fluwx (from `.symlinks/plugins/fluwx/ios`)
- geolocator (from `.symlinks/plugins/geolocator/ios`)
- image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`) - image_gallery_saver (from `.symlinks/plugins/image_gallery_saver/ios`)
- image_pickers (from `.symlinks/plugins/image_pickers/ios`) - image_pickers (from `.symlinks/plugins/image_pickers/ios`)
- number_precision (from `.symlinks/plugins/number_precision/ios`) - number_precision (from `.symlinks/plugins/number_precision/ios`)
@ -275,10 +128,9 @@ DEPENDENCIES:
SPEC REPOS: SPEC REPOS:
https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git: https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git:
- AFNetworking - AFNetworking
- BaiduMapKit
- BMKLocationKit
- mob_sharesdk - mob_sharesdk
- MOBFoundation - MOBFoundation
- OpenWeChatSDK
- SDWebImage - SDWebImage
- SSZipArchive - SSZipArchive
- TPNS-iOS - TPNS-iOS
@ -291,18 +143,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/emoji_picker_flutter/ios" :path: ".symlinks/plugins/emoji_picker_flutter/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
flutter_baidu_mapapi_base:
:path: ".symlinks/plugins/flutter_baidu_mapapi_base/ios"
flutter_baidu_mapapi_map:
:path: ".symlinks/plugins/flutter_baidu_mapapi_map/ios"
flutter_baidu_mapapi_search:
:path: ".symlinks/plugins/flutter_baidu_mapapi_search/ios"
flutter_baidu_mapapi_utils:
:path: ".symlinks/plugins/flutter_baidu_mapapi_utils/ios"
flutter_bmflocation:
:path: ".symlinks/plugins/flutter_bmflocation/ios"
fluwx: fluwx:
:path: ".symlinks/plugins/fluwx/ios" :path: ".symlinks/plugins/fluwx/ios"
geolocator:
:path: ".symlinks/plugins/geolocator/ios"
image_gallery_saver: image_gallery_saver:
:path: ".symlinks/plugins/image_gallery_saver/ios" :path: ".symlinks/plugins/image_gallery_saver/ios"
image_pickers: image_pickers:
@ -340,28 +184,23 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58 AFNetworking: 3bd23d814e976cd148d7d44c3ab78017b744cd58
BaiduMapKit: f227cfb43581e91466fb4f1344f655eab5788777
BMKLocationKit: 688d8e1194980b96fc9a6585c0eb42e62fbaf780
emoji_picker_flutter: df19dac03a2b39ac667dc8d1da939ef3a9e21347 emoji_picker_flutter: df19dac03a2b39ac667dc8d1da939ef3a9e21347
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_baidu_mapapi_base: cb406be78c3a949fb58a45dc6627f139d580bd37 fluwx: 79c66b6d795ab8208262ada215d9e60388cfe492
flutter_baidu_mapapi_map: 81c4e6e93dc668e311d9b521421deaf292390434 geolocator: f5e3de65e241caba7ce3e8a618803387bda73384
flutter_baidu_mapapi_search: 13a360334e91abea0bcf820546b2ef4548e42e08
flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1
flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf
fluwx: a24006296e7ca601e8544e12bd6269497fae23e6
image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2 image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2
image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773 image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773
mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0 mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0
MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8 MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8
number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8 number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8
OpenWeChatSDK: ea48e9db20645f78128db9091893910280b8e4b1
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86
SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3 SDWebImage: e5cc87bf736e60f49592f307bdf9e157189298a3
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472 shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
sharesdk_plugin: b105d82bed39e1d229591999058ab1e12ff95001 sharesdk_plugin: f29a6f471ae1c253e96636d62106c3f8d793948c
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad
tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5 tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
@ -378,4 +217,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: f8bac8842dd5d4f36a3709c129ae7a2ccd5be619 PODFILE CHECKSUM: f8bac8842dd5d4f36a3709c129ae7a2ccd5be619
COCOAPODS: 1.13.0 COCOAPODS: 1.15.2

44
ios/Runner.xcodeproj/project.pbxproj

@ -10,7 +10,6 @@
0558860326BD10CA00FB1CFE /* test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0558860226BD10CA00FB1CFE /* test.swift */; }; 0558860326BD10CA00FB1CFE /* test.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0558860226BD10CA00FB1CFE /* test.swift */; };
05C5426F26BBE8FE00D26AC2 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F373269581F600237A5E /* CoreLocation.framework */; }; 05C5426F26BBE8FE00D26AC2 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F373269581F600237A5E /* CoreLocation.framework */; };
05C5427126BBE93600D26AC2 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05C5427026BBE93600D26AC2 /* AdSupport.framework */; }; 05C5427126BBE93600D26AC2 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05C5427026BBE93600D26AC2 /* AdSupport.framework */; };
05C5427426BCE3AC00D26AC2 /* BMKLocationKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05C5427326BCE3AC00D26AC2 /* BMKLocationKit.framework */; };
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
6EE8F3582695818800237A5E /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F3572695818800237A5E /* JavaScriptCore.framework */; }; 6EE8F3582695818800237A5E /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6EE8F3572695818800237A5E /* JavaScriptCore.framework */; };
@ -145,7 +144,6 @@
6EE8F35C2695819500237A5E /* CoreMedia.framework in Frameworks */, 6EE8F35C2695819500237A5E /* CoreMedia.framework in Frameworks */,
6EE8F3582695818800237A5E /* JavaScriptCore.framework in Frameworks */, 6EE8F3582695818800237A5E /* JavaScriptCore.framework in Frameworks */,
C9444B3318AB7FB815E97950 /* libPods-Runner.a in Frameworks */, C9444B3318AB7FB815E97950 /* libPods-Runner.a in Frameworks */,
05C5427426BCE3AC00D26AC2 /* BMKLocationKit.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -358,7 +356,6 @@
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
120EAF7195D9AB3BB1E8FA2B /* [CP] Copy Pods Resources */, 120EAF7195D9AB3BB1E8FA2B /* [CP] Copy Pods Resources */,
8C1FAACB8CAD66760F3893D3 /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -452,23 +449,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin\n";
}; };
8C1FAACB8CAD66760F3893D3 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;
@ -657,6 +637,7 @@
"\"${PODS_ROOT}/Headers/Private/fluwx\"", "\"${PODS_ROOT}/Headers/Private/fluwx\"",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "海峡姐妹";
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -669,7 +650,7 @@
"$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu", "$(PROJECT_DIR)/Runner/baidu",
); );
MARKETING_VERSION = 3.2.28; MARKETING_VERSION = 3.2.29;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
@ -677,11 +658,6 @@
"-l\"c++\"", "-l\"c++\"",
"-l\"image_pickers\"", "-l\"image_pickers\"",
"-l\"path_provider\"", "-l\"path_provider\"",
"-l\"flutter_bmflocation\"",
"-l\"flutter_baidu_mapapi_utils\"",
"-l\"flutter_baidu_mapapi_search\"",
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"wakelock\"", "-l\"wakelock\"",
@ -860,6 +836,7 @@
"\"${PODS_ROOT}/Headers/Private/fluwx\"", "\"${PODS_ROOT}/Headers/Private/fluwx\"",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "海峡姐妹";
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -872,7 +849,7 @@
"$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu", "$(PROJECT_DIR)/Runner/baidu",
); );
MARKETING_VERSION = 3.2.28; MARKETING_VERSION = 3.2.29;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
@ -880,11 +857,6 @@
"-l\"c++\"", "-l\"c++\"",
"-l\"image_pickers\"", "-l\"image_pickers\"",
"-l\"path_provider\"", "-l\"path_provider\"",
"-l\"flutter_bmflocation\"",
"-l\"flutter_baidu_mapapi_utils\"",
"-l\"flutter_baidu_mapapi_search\"",
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"wakelock\"", "-l\"wakelock\"",
@ -954,6 +926,7 @@
"\"${PODS_ROOT}/Headers/Private/fluwx\"", "\"${PODS_ROOT}/Headers/Private/fluwx\"",
); );
INFOPLIST_FILE = Runner/Info.plist; INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "海峡姐妹";
IPHONEOS_DEPLOYMENT_TARGET = 11.0; IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = ( LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)", "$(inherited)",
@ -966,7 +939,7 @@
"$(PROJECT_DIR)/baidu", "$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu", "$(PROJECT_DIR)/Runner/baidu",
); );
MARKETING_VERSION = 3.2.28; MARKETING_VERSION = 3.2.29;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = ( OTHER_LDFLAGS = (
"$(inherited)", "$(inherited)",
@ -974,11 +947,6 @@
"-l\"c++\"", "-l\"c++\"",
"-l\"image_pickers\"", "-l\"image_pickers\"",
"-l\"path_provider\"", "-l\"path_provider\"",
"-l\"flutter_bmflocation\"",
"-l\"flutter_baidu_mapapi_utils\"",
"-l\"flutter_baidu_mapapi_search\"",
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"wakelock\"", "-l\"wakelock\"",

22
ios/Runner/Info.plist

@ -7,7 +7,7 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key> <key>CFBundleDisplayName</key>
<string>一心回鄉</string> <string>海峡姐妹</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string> <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -95,9 +95,9 @@
<string>lineauth</string> <string>lineauth</string>
<string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>line3rdp.$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>alipay</string> <string>alipay</string>
<string>iosamap</string> <string>iosamap</string>
<string>qqmap</string> <string>qqmap</string>
<string>baidumap</string> <string>baidumap</string>
</array> </array>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
@ -136,20 +136,22 @@
<string>拍视频需要录音权限</string> <string>拍视频需要录音权限</string>
<key>NSMotionUsageDescription</key> <key>NSMotionUsageDescription</key>
<string>是否允许访问运行</string> <string>是否允许访问运行</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>请允许App保存图片到相册</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>打开相册</string> <string>打开相册</string>
<key>NSSpeechRecognitionUsageDescription</key> <key>NSSpeechRecognitionUsageDescription</key>
<string>是否允许语音识别</string> <string>是否允许语音识别</string>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>请允许App保存图片到相册</string>
<key>UIApplicationSceneManifest</key> <key>UIApplicationSceneManifest</key>
<dict> <dict>
<key>UIApplicationSupportsMultipleScenes</key> <key>UIApplicationSupportsMultipleScenes</key>
<false/> <false/>
</dict> </dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UIBackgroundModes</key> <key>UIBackgroundModes</key>
<array> <array>
<string>remote-notification</string> <string>location</string>
</array> </array>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
@ -178,11 +180,5 @@
<string>https://hx.lotus-wallet.com/app/</string> <string>https://hx.lotus-wallet.com/app/</string>
<key>io.flutter.embedded_views_preview</key> <key>io.flutter.embedded_views_preview</key>
<string>YES</string> <string>YES</string>
<key>UIBackgroundModes</key>
<array>
<string>location</string>
</array>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict> </dict>
</plist> </plist>

339
lib/address/address_map_page.dart

@ -8,16 +8,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart' as PH;
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -29,23 +27,10 @@ class AddressMapPage extends StatefulWidget {
} }
class _AddressMapPage extends State<AddressMapPage> { class _AddressMapPage extends State<AddressMapPage> {
//
void _loadCustomData() async {
setState(() {
_mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0);
});
}
LocationFlutterPlugin aMapFlutterLocation;
String city = "武汉市"; String city = "武汉市";
String keyWord = ""; String keyWord = "";
@override
void dispose() {
super.dispose();
aMapFlutterLocation.stopLocation();
}
ApiService apiService; ApiService apiService;
@override @override
@ -55,90 +40,33 @@ class _AddressMapPage extends State<AddressMapPage> {
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), apiService = ApiService(Dio(),
context: context, token: value.getString('token')), context: context, token: value.getString('token')),
}); },);
if (aMapFlutterLocation == null) { LocationInstance.getInstance().startLocation(context, (Position result) {
aMapFlutterLocation = LocationFlutterPlugin();
}
aMapFlutterLocation.singleLocationCallback(callback: (BaiduLocation result){
print("event: $result"); print("event: $result");
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {
city = result.city; latLng = Position(latitude: result.latitude, longitude: result.longitude);
BMFCoordinate latLng = BMFCoordinate(result.latitude, result.longitude); LocationInstance.getInstance().getAddress(result.latitude, result.longitude).then((value) {
BMFCalculateUtils.coordConvert( if (value != null) {
coordinate: latLng, city = value.city;
fromType: BMF_COORD_TYPE.COMMON,
toType: BMF_COORD_TYPE.BD09LL)
.then((value) {
saveLatLng(value);
if (_mapController != null) {
this.latLng = Platform.isIOS ? value : latLng;
addMarker();
_mapController.updateMapOptions(
BMFMapOptions(
center: latLng,
zoomLevel: 15,
showZoomControl: false,
showMapScaleBar: false,
rotateEnabled: false,
),
);
} }
searchPoi(latLng);
}); });
saveLatLng(result);
searchPoi(latLng);
} }
}); });
_setLocOption();
getLatLng();
startLocation(); startLocation();
} }
/// android端和ios端定位参数 Position center = Position();
void _setLocOption() {
/// android
BaiduLocationAndroidOption androidOption = new BaiduLocationAndroidOption();
androidOption.setCoorType("GCJ02"); //
androidOption.setIsNeedAltitude(true); //
androidOption.setIsNeedAddress(true); //
androidOption.setIsNeedLocationPoiList(true); // poi信息
androidOption.setIsNeedNewVersionRgc(true); // rgc信息
androidOption.setIsNeedLocationDescribe(true); //
androidOption.setOpenGps(true); // 使gps
androidOption.setLocationMode(BMFLocationMode.hightAccuracy); //
androidOption.setScanspan(0); //
androidOption.setCoordType(BMFLocationCoordType.gcj02);
Map androidMap = androidOption.getMap();
/// ios
BaiduLocationIOSOption iosOption = new BaiduLocationIOSOption();
iosOption.setIsNeedNewVersionRgc(true); // rgc信息
iosOption.setBMKLocationCoordinateType(
"BMKLocationCoordinateTypeGCJ02"); //
iosOption.setActivityType(BMFActivityType.automotiveNavigation); //
iosOption.setLocationTimeout(10); //
iosOption.setDesiredAccuracy(BMFDesiredAccuracy.best); //
iosOption.setReGeocodeTimeout(10); //
iosOption.setDistanceFilter(1000); //
iosOption.setAllowsBackgroundLocationUpdates(true); //
iosOption.setPauseLocUpdateAutomatically(true); //
iosOption.coordType = BMFLocationCoordType.gcj02;
Map iosMap = iosOption.getMap();
aMapFlutterLocation.prepareLoc(androidMap, iosMap);
}
List<Address> poiList; List<Address> poiList;
searchPoi(BMFCoordinate latLng) async { searchPoi(Position latLng) async {
keyWord = textEditingController.text; keyWord = textEditingController.text;
print("keyWord: ${keyWord}"); print("keyWord: ${keyWord}");
var addressPoi = await apiService.searchPoi( var addressPoi = await apiService.searchPoi("${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1);
"${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1);
//,;:['pois'],['entrances'] //,;:['pois'],['entrances']
List<dynamic> poi = addressPoi['pois']??addressPoi['entrances']; List<dynamic> poi = addressPoi['pois']??addressPoi['entrances'];
poiList = poi poiList = poi
@ -159,54 +87,31 @@ class _AddressMapPage extends State<AddressMapPage> {
})) }))
.toList(); .toList();
setState(() {}); setState(() {});
// BMFPoiNearbySearch bmfPoiNearbySearch = BMFPoiNearbySearch();
// bmfPoiNearbySearch.onGetPoiNearbySearchResult(
// callback: (BMFPoiSearchResult result, BMFSearchErrorCode errorCode) {
// // if ((DateTime.now().millisecondsSinceEpoch - time) > 2000) {
// result.poiInfoList.map((e) => print("sssssssssss:${e.toMap()}"));
// poiList = result.poiInfoList;
// print("object112221: ${poiList.length}");
// setState(() {
// time = DateTime.now().millisecondsSinceEpoch;
// });
// // }
// });
// bmfPoiNearbySearch.poiNearbySearch(BMFPoiNearbySearchOption(
// keywords: [" "],
// tags: ["小区","住宅","地标","建筑"],
// radius: 100000,
// location: latLng,
// pageSize: 20,
// pageIndex: 0,
// isRadiusLimit: true,
// ));
} }
int time = 0; int time = 0;
startLocation() async { startLocation() async {
if (!(await Permission.locationWhenInUse.serviceStatus.isEnabled)) { if (!(await PH.Permission.locationWhenInUse.serviceStatus.isEnabled)) {
enableLocation(); enableLocation();
return; return;
} }
if (await PH.Permission.location.isPermanentlyDenied) {
if (await Permission.location.isPermanentlyDenied) {
requestDialog(); requestDialog();
} else if (await Permission.location.isGranted) { } else if (await PH.Permission.location.isGranted) {
// EasyLoading.show(status: S.of(context).zhengzaijiazai); // EasyLoading.show(status: S.of(context).zhengzaijiazai);
aMapFlutterLocation.startLocation(); center = await Geolocator.getCurrentPosition();
Future.delayed(Duration(seconds: 6), () { Future.delayed(Duration(seconds: 6), () {
EasyLoading.dismiss(); EasyLoading.dismiss();
}); });
} else if (await Permission.location.isUndetermined) { } else if (await PH.Permission.location.isUndetermined) {
await Permission.location.request(); await PH.Permission.location.request();
} else { } else {
if (Platform.isIOS) { if (Platform.isIOS) {
// //
requestDialog(); requestDialog();
} else { } else {
await Permission.location.request(); await PH.Permission.location.request();
} }
} }
} }
@ -222,11 +127,12 @@ class _AddressMapPage extends State<AddressMapPage> {
S.of(context).dakaidingwei, S.of(context).dakaidingwei,
(result) async { (result) async {
if (result) { if (result) {
final AndroidIntent intent = AndroidIntent( // final AndroidIntent intent = AndroidIntent(
action: 'action_location_source_settings', // action: 'action_location_source_settings',
package: "com.zsw.huixiang"); // package: "com.zsw.huixiang");
await intent.launch(); // await intent.launch();
// startLocation(); // startLocation();
Geolocator.openLocationSettings();
} }
}, },
heightRatioWithWidth: 0.82, heightRatioWithWidth: 0.82,
@ -246,8 +152,8 @@ class _AddressMapPage extends State<AddressMapPage> {
S.of(context).kaiqiquanxian, S.of(context).kaiqiquanxian,
(result) async { (result) async {
if (result) { if (result) {
await openAppSettings(); await PH.openAppSettings();
if (await Permission.location.isGranted) { if (await PH.Permission.location.isGranted) {
startLocation(); startLocation();
} }
} }
@ -257,180 +163,45 @@ class _AddressMapPage extends State<AddressMapPage> {
}); });
} }
BMFMapController _mapController;
BMFCoordinate bmfCoordinate;
void onMapCreated(BMFMapController controller) {
controller.setMapRegionDidChangeCallback(callback: (status) {
BMFMapStatus bmfMapStatus = status;
print("status: ${bmfMapStatus.toMap()}");
if (bmfCoordinate != null &&
bmfCoordinate.longitude == status.targetGeoPt.longitude &&
bmfCoordinate.latitude == status.targetGeoPt.latitude) {
if ((DateTime.now().millisecondsSinceEpoch - time) > 1000) {
center = status.targetGeoPt;
searchPoi(center);
time = DateTime.now().millisecondsSinceEpoch;
}
} else {
bmfCoordinate = status.targetGeoPt;
}
});
setState(() {
_mapController = controller;
_mapController.showUserLocation(true);
_loadCustomData();
addMarker();
});
}
BMFCoordinate latLng;
BMFMarker bmfMarker;
addMarker() { Position latLng;
if (latLng == null) return;
if (bmfMarker == null && _mapController != null) {
print("map_wid: ${MediaQuery.of(context).size.width}");
print("map_hei: ${MediaQuery.of(context).size.height}");
bmfMarker = BMFMarker(
position: latLng,
screenPointToLock: BMFPoint(
(Platform.isIOS
? MediaQuery.of(context).size.width
: window.physicalSize.width) /
2,
Platform.isIOS
? MediaQuery.of(context).size.height
: window.physicalSize.height / 4),
isLockedToScreen: true,
centerOffset: BMFPoint(0.5, 0.7),
enabled: false,
icon: "assets/image/icon_address_location.webp",
draggable: false,
);
_mapController.addMarker(bmfMarker);
}
bmfMarker.updateIsLockedToScreen(
true,
BMFPoint(
(Platform.isIOS
? MediaQuery.of(context).size.width
: window.physicalSize.width) /
2,
(Platform.isIOS
? MediaQuery.of(context).size.height
: window.physicalSize.height) /
4));
}
saveLatLng(BMFCoordinate latLng) async { saveLatLng(Position latLng) async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("latitude", "${latLng.latitude}");
await prefs.setString("longitude", "${latLng.longitude}"); await prefs.setString("longitude", "${latLng.longitude}");
} }
getLatLng() async {
SharedPreferences.getInstance().then((value) => {
setState(() {
if (_mapController != null) {
_mapController.updateMapOptions(
BMFMapOptions(
center: BMFCoordinate(
double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude")),
),
zoomLevel: 15,
showZoomControl: false,
showMapScaleBar: false,
rotateEnabled: false,
),
);
}
})
});
}
BMFMapWidget map;
BMFCoordinate center = BMFCoordinate(30.553111, 114.342366);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Column( body: Column(
children: [ children: [
searchWidget(), searchWidget(),
Expanded( // Expanded(
child: Stack( // child: InkWell(
children: [ // onTap: () {
Container( // startLocation();
child: BMFMapWidget( // },
mapOptions: BMFMapOptions( // child: Container(
center: BMFCoordinate(30.553111, 114.342366), // width: 32,
zoomLevel: 15, // height: 32,
showZoomControl: false, // padding: EdgeInsets.all(8),
showMapScaleBar: false, // decoration: BoxDecoration(
rotateEnabled: false, // borderRadius: BorderRadius.circular(16),
), // color: Colors.white,
onBMFMapCreated: onMapCreated, // ),
// onCameraMoveEnd: (cameraPosition) { // child: Image.asset(
// center = cameraPosition.target; // "assets/image/icon_address_location_action.webp",
// searchPoi(center); // width: 16.w,
// }, // height: 16.h,
// onCameraMove: (cameraPosition) { // ),
// center = cameraPosition.target; // ),
// setState(() {}); // ),
// }, // flex: 1,
// markers: [Marker(position: center)].toSet(), // ),
// touchPoiEnabled: true,
// scrollGesturesEnabled: true,
// customStyleOptions: _customStyleOptions,
// gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>[
// Factory<OneSequenceGestureRecognizer>(
// () => EagerGestureRecognizer())
// ].toSet(),
),
),
// Center(
// child: IgnorePointer(
// child: Container(
// margin: EdgeInsets.only(bottom: 44.h),
// child: Image.asset(
// "assets/image/icon_address_location.webp",
// width: 66.w,
// height: 75.h,
// ),
// ),
// ),
// ),
Positioned(
right: 17,
bottom: 16,
child: InkWell(
onTap: () {
startLocation();
},
child: Container(
width: 32,
height: 32,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white,
),
child: Image.asset(
"assets/image/icon_address_location_action.webp",
width: 16.w,
height: 16.h,
),
),
),
),
],
),
flex: 1,
),
Expanded( Expanded(
child: Container( child: Container(
child: ListView.separated( child: ListView.separated(
@ -501,14 +272,16 @@ class _AddressMapPage extends State<AddressMapPage> {
padding: EdgeInsets.fromLTRB(10, 6, 16, 6), padding: EdgeInsets.fromLTRB(10, 6, 16, 6),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(4)), borderRadius: BorderRadius.all(
Radius.circular(4),
),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withAlpha(12), color: Colors.black.withAlpha(12),
offset: Offset(0, 3), offset: Offset(0, 3),
blurRadius: 14, blurRadius: 14,
spreadRadius: 0, spreadRadius: 0,
) ),
], ],
), ),
child: Row( child: Row(

5
lib/community/community_view/home_class.dart

@ -1,9 +1,10 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/collect_class_list.dart'; import 'package:huixiang/retrofit/data/collect_class_list.dart';
import 'package:huixiang/retrofit/data/course_list.dart'; import 'package:huixiang/retrofit/data/course_list.dart';
import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -23,7 +24,7 @@ class HomeClass extends StatefulWidget {
class _HomeClass extends State<HomeClass> { class _HomeClass extends State<HomeClass> {
ApiService apiService; ApiService apiService;
BMFCoordinate latLng; Position latLng;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();

5
lib/community/headlines/activity_top_list.dart

@ -1,9 +1,10 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -22,7 +23,7 @@ class ActivityTopList extends StatefulWidget {
class _ActivityTopList extends State<ActivityTopList> { class _ActivityTopList extends State<ActivityTopList> {
ApiService apiService; ApiService apiService;
BMFCoordinate latLng; Position latLng;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();

7
lib/community/headlines/headlines_collection.dart

@ -1,16 +1,13 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/collect_class_list.dart';
import 'package:huixiang/retrofit/data/course_list.dart';
import 'package:huixiang/retrofit/data/headlines_list.dart'; import 'package:huixiang/retrofit/data/headlines_list.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/new_people_reward.dart';
class HeadlinesCollection extends StatefulWidget { class HeadlinesCollection extends StatefulWidget {
final List<HeadlinesList> headlines; final List<HeadlinesList> headlines;
@ -26,7 +23,7 @@ class HeadlinesCollection extends StatefulWidget {
class _HeadlinesCollection extends State<HeadlinesCollection> { class _HeadlinesCollection extends State<HeadlinesCollection> {
ApiService apiService; ApiService apiService;
BMFCoordinate latLng; Position latLng;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();

94
lib/home/home_view/quick_order.dart

@ -1,13 +1,11 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/store/scan.dart'; import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
@ -19,7 +17,7 @@ import 'package:huixiang/view_widget/item_title.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart' as PH;
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class QuickOrder extends StatefulWidget { class QuickOrder extends StatefulWidget {
@ -32,9 +30,9 @@ class QuickOrder extends StatefulWidget {
class _QuickOrder extends State<QuickOrder> { class _QuickOrder extends State<QuickOrder> {
ApiService apiService; ApiService apiService;
List<Store> storeList; List<Store> storeList;
BMFCoordinate latLng; Position latLng;
BMFMapController _mapController; // BMFMapController _mapController;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();
@override @override
@ -45,11 +43,8 @@ class _QuickOrder extends State<QuickOrder> {
} }
/// ///
queryStore(latitude, longitude, province, city, district, searchKey) async { queryStore(latitude, longitude, searchKey) async {
BaseData<List<Store>> baseData = await apiService.queryStore({ BaseData<List<Store>> baseData = await apiService.queryStore({
// "city": city,
// "district": district,
// "province": province,
"latitude": latitude, "latitude": latitude,
"longitude": longitude, "longitude": longitude,
"searchKey": searchKey "searchKey": searchKey
@ -68,74 +63,61 @@ class _QuickOrder extends State<QuickOrder> {
token: value.getString('token'), token: value.getString('token'),
showLoading: false), showLoading: false),
if (value.containsKey("latitude") && if (value.containsKey("latitude") &&
value.containsKey("longitude") && value.containsKey("longitude"))
value.containsKey("province") &&
value.containsKey("city") &&
value.containsKey("district"))
{ {
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), latLng = Position(
double.tryParse(value.getString("longitude"))), latitude: double.tryParse(value.getString("latitude")),
longitude: double.tryParse(value.getString("longitude")),
),
queryStore( queryStore(
value.getString("latitude"), value.getString("latitude"),
value.getString("longitude"), value.getString("longitude"),
value.getString("province"),
value.getString("city"),
value.getString("district"),
editingController.text, editingController.text,
), ),
setState(() { setState(() {
if (_mapController != null) { // if (_mapController != null) {
_mapController.updateMapOptions(BMFMapOptions( // _mapController.updateMapOptions(BMFMapOptions(
center: latLng, // center: latLng,
zoomLevel: 15, // zoomLevel: 15,
)); // ));
} // }
}) })
} }
else else
{ {
queryStore("", "", "", "", "", editingController.text), queryStore("", "", editingController.text),
} }
}, },
); );
} }
startLocation() async { startLocation() async {
Location.getInstance().startLocation(context, (BaiduLocation result){ LocationInstance.getInstance().startLocation(context, (Position result){
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {
print("location: $result"); print("location: $result");
latLng = BMFCoordinate(result.latitude, result.longitude); latLng = Position(
BMFCalculateUtils.coordConvert( latitude: result.latitude,
coordinate: latLng, longitude: result.longitude,
fromType: BMF_COORD_TYPE.BD09LL, );
toType: BMF_COORD_TYPE.COMMON) LocationInstance.getInstance().getAddress(latLng.latitude, latLng.longitude).then((r) {
.then((value) { if (r != null) {
this.latLng = value; saveLatLng(latLng, r.province, r.city, r.area);
saveLatLng( }
value, result.province, result.city, result.district);
print("union: Location result ${value.latitude} " LocationInstance.getInstance().stopLocation();
"${value.longitude}");
Location.getInstance().stopLocation();
queryStore( queryStore(
"${value.latitude}", "${latLng.latitude}",
"${value.longitude}", "${latLng.longitude}",
result.province,
result.city,
result.district,
editingController.text); editingController.text);
if (_mapController != null) return r;
_mapController.updateMapOptions(BMFMapOptions(
center: value,
zoomLevel: 15,
));
}); });
} }
}).then((value) {}); }).then((value) {});
} }
saveLatLng(BMFCoordinate latLng, province, city, district) async { saveLatLng(Position latLng, province, city, district) async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("latitude", "${latLng.latitude}");
await prefs.setString("longitude", "${latLng.longitude}"); await prefs.setString("longitude", "${latLng.longitude}");
@ -363,7 +345,7 @@ class _QuickOrder extends State<QuickOrder> {
/// ///
toScan() async { toScan() async {
if (await Permission.camera.isPermanentlyDenied) { if (await PH.Permission.camera.isPermanentlyDenied) {
showCupertinoDialog( showCupertinoDialog(
context: context, context: context,
builder: (context) { builder: (context) {
@ -374,13 +356,13 @@ class _QuickOrder extends State<QuickOrder> {
S.of(context).kaiqiquanxian, S.of(context).kaiqiquanxian,
(result) async { (result) async {
if (result) { if (result) {
await openAppSettings(); await PH.openAppSettings();
} }
}, },
heightRatioWithWidth: 0.82, heightRatioWithWidth: 0.82,
); );
}); });
} else if (await Permission.camera.isGranted) { } else if (await PH.Permission.camera.isGranted) {
// http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512
// //
// http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432
@ -407,7 +389,7 @@ class _QuickOrder extends State<QuickOrder> {
); );
} }
} else { } else {
await Permission.camera.request(); await PH.Permission.camera.request();
} }
} }
} }

4
lib/main.dart

@ -351,8 +351,8 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
VipBalancePage(arguments: arguments), VipBalancePage(arguments: arguments),
'/router/exchange_order_details': (context, {arguments}) => '/router/exchange_order_details': (context, {arguments}) =>
ExchangeOrderDetailPage(), ExchangeOrderDetailPage(),
'/router/location_map': (context, {arguments}) => // '/router/location_map': (context, {arguments}) =>
LocationMap(arguments: arguments), // LocationMap(arguments: arguments),
'/router/settlement': (context, {arguments}) => '/router/settlement': (context, {arguments}) =>
Settlement(arguments: arguments), Settlement(arguments: arguments),
'/router/integral_detailed_page': (context, {arguments}) => '/router/integral_detailed_page': (context, {arguments}) =>

26
lib/main_page.dart

@ -3,8 +3,6 @@ import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
@ -241,19 +239,19 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
); );
SharesdkPlugin.regist(shareSDKRegister); SharesdkPlugin.regist(shareSDKRegister);
LocationFlutterPlugin myLocPlugin = LocationFlutterPlugin(); // LocationFlutterPlugin myLocPlugin = LocationFlutterPlugin();
// // // //
myLocPlugin.setAgreePrivacy(true); // myLocPlugin.setAgreePrivacy(true);
BMFMapSDK.setAgreePrivacy(true); // BMFMapSDK.setAgreePrivacy(true);
if (Platform.isIOS) { // if (Platform.isIOS) {
myLocPlugin.authAK("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); // myLocPlugin.authAK("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR");
BMFMapSDK.setApiKeyAndCoordType( // BMFMapSDK.setApiKeyAndCoordType(
'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR', // 'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR',
BMF_COORD_TYPE.BD09LL, // BMF_COORD_TYPE.BD09LL,
); // );
} else if (Platform.isAndroid) { // } else if (Platform.isAndroid) {
BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL); // BMFMapSDK.setCoordType(BMF_COORD_TYPE.BD09LL);
} // }
if (Platform.isAndroid) { if (Platform.isAndroid) {
xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler( xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler(

8
lib/mine/mine_shop_details.dart

@ -1,8 +1,7 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
@ -13,7 +12,6 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart'; import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
import 'package:huixiang/utils/painter_bg.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
@ -45,7 +43,7 @@ class _MineShopDetails extends State<MineShopDetails> {
super.dispose(); super.dispose();
refreshController.dispose(); refreshController.dispose();
consumeRefreshController.dispose(); consumeRefreshController.dispose();
Location.getInstance().stopLocation(); LocationInstance.getInstance().stopLocation();
} }
@override @override
@ -89,7 +87,7 @@ class _MineShopDetails extends State<MineShopDetails> {
startLocation() async { startLocation() async {
// EasyLoading.show(status: S.current.zhengzaijiazai); // EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance().startLocation(context, (BaiduLocation result){ LocationInstance.getInstance().startLocation(context, (Position result){
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {

6
lib/mine/vip_detail_page.dart

@ -1,8 +1,8 @@
import 'package:barcode_widget/barcode_widget.dart'; import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/product.dart';
@ -37,7 +37,7 @@ class _VipDetailPage extends State<VipDetailPage> {
void dispose() { void dispose() {
super.dispose(); super.dispose();
refreshController.dispose(); refreshController.dispose();
Location.getInstance().stopLocation(); LocationInstance.getInstance().stopLocation();
} }
@override @override
@ -51,7 +51,7 @@ class _VipDetailPage extends State<VipDetailPage> {
startLocation() async { startLocation() async {
// EasyLoading.show(status: S.current.zhengzaijiazai); // EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance().startLocation(context, (BaiduLocation result) { LocationInstance.getInstance().startLocation(context, (Position result) {
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {

12
lib/mine/vip_pay_code.dart

@ -1,30 +1,18 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'package:barcode_widget/barcode_widget.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/product.dart';
import 'package:huixiang/retrofit/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/utils/painter_bg.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:qr_flutter/qr_flutter.dart'; import 'package:qr_flutter/qr_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../retrofit/data/user_info.dart'; import '../retrofit/data/user_info.dart';
import '../view_widget/classic_header.dart';
class VipPayCode extends StatefulWidget { class VipPayCode extends StatefulWidget {
@override @override

6
lib/order/store_selector_page.dart

@ -1,13 +1,7 @@
import 'dart:io';
import 'package:android_intent_plus/android_intent.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';

4
lib/retrofit/business_api.dart

@ -2,7 +2,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:dio_log/interceptor/dio_log_interceptor.dart'; // import 'package:dio_log/interceptor/dio_log_interceptor.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -95,7 +95,7 @@ abstract class BusinessApiService {
responseType: ResponseType.json, responseType: ResponseType.json,
baseUrl: baseUrl, baseUrl: baseUrl,
); );
dio.interceptors.add(DioLogInterceptor()); // dio.interceptors.add(DioLogInterceptor());
dio.interceptors.add( dio.interceptors.add(
InterceptorsWrapper(onRequest: (RequestOptions options) { InterceptorsWrapper(onRequest: (RequestOptions options) {
debugPrint("\n======================= 请求数据 ======================="); debugPrint("\n======================= 请求数据 =======================");

16
lib/retrofit/data/latlng.dart

@ -0,0 +1,16 @@
//
// class Latlng {
//
//
// /// Latitude in degrees
// final double latitude;
//
// /// Longitude, in degrees
// final double longitude;
//
//
// Latlng(this.latitude, this.longitude);
//
// }

4
lib/retrofit/data/store_info.dart

@ -125,7 +125,7 @@ class StoreInfo {
'couponVOList': this.couponVOList, 'couponVOList': this.couponVOList,
'createTime': this.createTime, 'createTime': this.createTime,
'createUser': this.createUser, 'createUser': this.createUser,
'deliveryInfo': this.deliveryInfo.toJson(), 'deliveryInfo': this.deliveryInfo != null ? this.deliveryInfo.toJson() : null,
'pickupType':this.pickupType.toJson(), 'pickupType':this.pickupType.toJson(),
'district': this.district, 'district': this.district,
'headMobile': this.headMobile, 'headMobile': this.headMobile,
@ -150,7 +150,7 @@ class StoreInfo {
'remark': this.remark, 'remark': this.remark,
'shipAddress': this.shipAddress, 'shipAddress': this.shipAddress,
'storeName': this.storeName, 'storeName': this.storeName,
'storeTable': this.storeTable.toJson(), 'storeTable': this.storeTable != null ? this.storeTable.toJson() : null,
'tenantCode': this.tenantCode, 'tenantCode': this.tenantCode,
'updateTime': this.updateTime, 'updateTime': this.updateTime,
'updateUser': this.updateUser, 'updateUser': this.updateUser,

3
lib/retrofit/min_api.dart

@ -27,8 +27,9 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.dart'; part 'min_api.g.dart';
const localBaseUrl = "http://192.168.10.78:8765/app/";/// // const localBaseUrl = "http://192.168.10.54:8765/app/";///
// const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";/// // const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///
const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

10
lib/retrofit/retrofit_api.dart

@ -66,8 +66,9 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart'; part 'retrofit_api.g.dart';
const localBaseUrl = "http://192.168.10.54:8766/app/";/// // const localBaseUrl = "http://192.168.10.54:8766/app/";///
// const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";/// // const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///
const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线
const ipBaseUrl = "http://whois.pconline.com.cn"; const ipBaseUrl = "http://whois.pconline.com.cn";
@ -183,11 +184,14 @@ abstract class ApiService {
@Part(name: "folderId") int folderId, bool isVideo); @Part(name: "folderId") int folderId, bool isVideo);
/// ///
@GET( @GET("https://restapi.amap.com/v3/place/around?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location={lat},{lng}&keywords={keywords}&offset={size}&page={page}&extensions=all")
"https://restapi.amap.com/v3/place/around?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location={lat},{lng}&keywords={keywords}&offset={size}&page={page}&extensions=all")
Future<dynamic> searchPoi(@Path("lat") String lat, @Path("lng") String lng, Future<dynamic> searchPoi(@Path("lat") String lat, @Path("lng") String lng,
@Path("keywords") String keywords, int size, int page); @Path("keywords") String keywords, int size, int page);
///
@GET("https://restapi.amap.com/v3/geocode/regeo?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location={lat},{lng}&extensions=base")
Future<dynamic> geocodeRegeo(@Path("lat") String lat, @Path("lng") String lng);
/// ///
@POST("/auth/platform/memberLogin") @POST("/auth/platform/memberLogin")
Future<BaseData> memberLogin(@Body() Map<String, dynamic> param); Future<BaseData> memberLogin(@Body() Map<String, dynamic> param);

20
lib/retrofit/retrofit_api.g.dart

@ -72,6 +72,26 @@ class _ApiService implements ApiService {
return value; return value;
} }
@override
Future<dynamic> geocodeRegeo(lat, lng) async {
ArgumentError.checkNotNull(lat, 'lat');
ArgumentError.checkNotNull(lng, 'lng');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request(
'https://restapi.amap.com/v3/geocode/regeo?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location=${lng},${lat}&extensions=base',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = _result.data;
return value;
}
@override @override
Future<BaseData> memberLogin(param) async { Future<BaseData> memberLogin(param) async {
ArgumentError.checkNotNull(param, 'param'); ArgumentError.checkNotNull(param, 'param');

50
lib/settlement/settlement.dart

@ -5,17 +5,17 @@ import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart'; import 'package:fluwx/fluwx.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity_details.dart'; import 'package:huixiang/retrofit/data/activity_details.dart';
import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/down_order.dart'; import 'package:huixiang/retrofit/data/down_order.dart';
import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/retrofit/data/launch_join_act.dart'; import 'package:huixiang/retrofit/data/launch_join_act.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/min_order_info.dart';
@ -401,9 +401,9 @@ class _Settlement extends State<Settlement> {
BaseData<List<Address>> baseDate = BaseData<List<Address>> baseDate =
await minService.queryAddress().catchError((error) {}); await minService.queryAddress().catchError((error) {});
BMFCoordinate bmfCoordinate = BMFCoordinate( Position bmfCoordinate = Position(
double.tryParse(storeInfo.latitude), latitude: double.tryParse(storeInfo.latitude),
double.tryParse(storeInfo.longitude), longitude: double.tryParse(storeInfo.longitude),
); );
if (baseDate != null && baseDate.isSuccess) { if (baseDate != null && baseDate.isSuccess) {
setState(() { setState(() {
@ -411,26 +411,26 @@ class _Settlement extends State<Settlement> {
}); });
for (int i = 1; i < baseDate.data.length; i++) { for (int i = 1; i < baseDate.data.length; i++) {
Address address1 = baseDate.data[i]; Address address1 = baseDate.data[i];
Position coordinate = Position( // COMMON->BD09LL
BMFCoordinate coordinate = await BMFCalculateUtils.coordConvert( longitude: double.tryParse(address.longitude),
coordinate: BMFCoordinate( latitude: double.tryParse(address.latitude),
double.tryParse(address.longitude), );
double.tryParse(address.latitude), Position coordinate1 = Position(// COMMON->BD09LL
), longitude: double.tryParse(address1.longitude),
fromType: BMF_COORD_TYPE.COMMON, latitude: double.tryParse(address1.latitude),
toType: BMF_COORD_TYPE.BD09LL); );
BMFCoordinate coordinate1 = await BMFCalculateUtils.coordConvert( double mi = Geolocator.distanceBetween(
coordinate: BMFCoordinate( bmfCoordinate.latitude,
double.tryParse(address1.longitude), bmfCoordinate.longitude,
double.tryParse(address1.latitude), coordinate.latitude,
), coordinate.longitude,
fromType: BMF_COORD_TYPE.COMMON, );
toType: BMF_COORD_TYPE.BD09LL); double mi1 = Geolocator.distanceBetween(
bmfCoordinate.latitude,
double mi = await BMFCalculateUtils.getLocationDistance( bmfCoordinate.longitude,
bmfCoordinate, coordinate); coordinate1.latitude,
double mi1 = await BMFCalculateUtils.getLocationDistance( coordinate1.longitude,
bmfCoordinate, coordinate1); );
if (mi1 < mi) { if (mi1 < mi) {
address = address1; address = address1;
} }

27
lib/settlement/settlement_view/distribution.dart

@ -1,11 +1,9 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -44,7 +42,7 @@ class _DistributionMode extends State<DistributionMode> {
"assets/svg/dingdan_wuliu.svg", "assets/svg/dingdan_wuliu.svg",
]; ];
BMFCoordinate myLatLng; Position myLatLng;
String distance = "0"; String distance = "0";
int selectedBtn = 0; int selectedBtn = 0;
@ -57,24 +55,29 @@ class _DistributionMode extends State<DistributionMode> {
/// ///
void startLocation() async { void startLocation() async {
Location.getInstance().startLocation(context, (BaiduLocation result) { LocationInstance.getInstance().startLocation(context, (Position result) {
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {
print("location: $result"); print("location: $result");
myLatLng = BMFCoordinate(result.latitude, result.longitude); myLatLng = Position(latitude: result.latitude, longitude: result.longitude);
calculate(); calculate();
Location.getInstance().stopLocation(); LocationInstance.getInstance().stopLocation();
} }
}); });
} }
calculate() async { calculate() async {
BMFCoordinate bmfCoordinate = BMFCoordinate( Position bmfCoordinate = Position(
double.tryParse(widget.storeInfo.latitude), latitude: double.tryParse(widget.storeInfo.latitude),
double.tryParse(widget.storeInfo.longitude), longitude: double.tryParse(widget.storeInfo.longitude),
); );
distance = await AppUtils.calculateDistance(bmfCoordinate, myLatLng); distance = "${Geolocator.distanceBetween(
bmfCoordinate.latitude,
bmfCoordinate.longitude,
myLatLng.latitude,
myLatLng.longitude,
)}";
setState(() {}); setState(() {});
} }

11
lib/store/shopping/shopping_cart/shopping_cart_page.dart

@ -112,13 +112,14 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
cartSkuItem.selected = selected; cartSkuItem.selected = selected;
shopCarTemp["selected"] = selected; shopCarTemp["selected"] = selected;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData baseDate = await minService.shoppingCartSingle(shopCarTemp); BaseData baseDate = await minService.shoppingCartSingle(shopCarTemp).catchError((error){});
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
setState(() { queryShopCar();
queryShopCar(); refreshController.refreshCompleted();
}); } else {
queryShopCar();
refreshController.refreshFailed();
} }
refreshController.refreshFailed();
} }
final SwiperController controller = SwiperController(); final SwiperController controller = SwiperController();

1
lib/store/shopping/shopping_home/classify_list.dart

@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:huixiang/retrofit/data/shopping_home_config.dart'; import 'package:huixiang/retrofit/data/shopping_home_config.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';

1
lib/store/shopping/shopping_home/search_page.dart

@ -1,6 +1,5 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';

15
lib/store/store_order.dart

@ -912,8 +912,21 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (shopCartKey != null) { if (shopCartKey != null) {
shopCartKey.currentState.setState(() {}); shopCartKey.currentState.setState(() {});
} }
setState(() {}); } else {
this.shopCarGoods = await queryShopCar();
if (shopCartKey != null) {
shopCartKey.currentState.setState(() {});
}
if (baseDate != null
&& baseDate.msg != null
&& baseDate.msg != "") {
SmartDialog.showToast(
"${baseDate.msg}",
alignment: Alignment.center,
);
}
} }
setState(() {});
return this.shopCarGoods; return this.shopCarGoods;
} }

4
lib/store/store_view/shop_car.dart

@ -80,7 +80,9 @@ class _ShopCar extends State<ShopCar> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
widget.shopingCar.shoppingCartSkuItemList.clear(); if (widget.shopingCar.shoppingCartSkuItemList != null) {
widget.shopingCar.shoppingCartSkuItemList.clear();
}
state(() {}); state(() {});
widget.clearShopCar(); widget.clearShopCar();
}, },

77
lib/store/store_view/store_info.dart

@ -1,10 +1,14 @@
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -168,15 +172,7 @@ class _StoreInfoView extends State<StoreInfoView> {
GestureDetector( GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
Navigator.of(context).pushNamed( showMapSelect();
'/router/location_map',
arguments: {
"lat": widget.storeInfo.latitude,
"lng": widget.storeInfo.longitude,
"storeInfo":widget.storeInfo,
"distance":widget.distance
},
);
}, },
child:Container( child:Container(
color: Colors.transparent, color: Colors.transparent,
@ -193,15 +189,7 @@ class _StoreInfoView extends State<StoreInfoView> {
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
if(widget.storeInfo.longitude != null && widget.storeInfo.latitude != null){ if(widget.storeInfo.longitude != null && widget.storeInfo.latitude != null){
Navigator.of(context).pushNamed( showMapSelect();
'/router/location_map',
arguments: {
"lat": widget.storeInfo.latitude,
"lng": widget.storeInfo.longitude,
"storeInfo":widget.storeInfo,
"distance":widget.distance
},
);
}else{ }else{
return; return;
} }
@ -307,4 +295,57 @@ class _StoreInfoView extends State<StoreInfoView> {
)) ))
.toList(); .toList();
} }
showMapSelect() {
showCupertinoModalPopup(
context: context,
builder: (context) {
return CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
child: Text(
"使用高德地图导航",
style: TextStyle(
fontWeight: MyFontWeight.regular,
),
),
onPressed: () {
onOpenBaiduMap();
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).quxiao,
style: TextStyle(
color: Colors.blue,
),),
isDestructiveAction: true,
),
);
});
}
void onOpenBaiduMap() async {
LocationInstance.getInstance().startLocation(context, (locationData) {
String url = "${Platform.isIOS ? 'ios' : 'android'}amap://path?sourceApplication=haixia&sid="
"&slat=${locationData.latitude.toStringAsFixed(8)}&slon=${locationData.longitude.toStringAsFixed(8)}&sname=&did=&dlat=${widget.storeInfo.latitude}&dlon=${widget.storeInfo.longitude}&dname=&dev=0&t=0";
launch(url).then((value) {
if (!value) {
SmartDialog.showToast(
"未检测到安装高德地图",
alignment: Alignment.center,
);
}
});
});
}
} }

2412
lib/union/location_map_page.dart

File diff suppressed because it is too large Load Diff

7
lib/union/union_list.dart

@ -1,10 +1,11 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/latlng.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
@ -23,7 +24,7 @@ import '../view_widget/round_button.dart';
class UnionList extends StatefulWidget { class UnionList extends StatefulWidget {
final String serviceType; final String serviceType;
final BMFCoordinate latLng; final Position latLng;
final String searchKey; final String searchKey;
final String city; final String city;
@ -39,7 +40,7 @@ class UnionList extends StatefulWidget {
class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin { class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
List<Store> storeList; List<Store> storeList;
BMFCoordinate latLng; Position latLng;
final RefreshController _refreshController = RefreshController(); final RefreshController _refreshController = RefreshController();
int networkStatus = 0; int networkStatus = 0;

62
lib/union/union_page.dart

@ -4,11 +4,12 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/ip_data.dart'; import 'package:huixiang/retrofit/data/ip_data.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/union/union_list.dart'; import 'package:huixiang/union/union_list.dart';
@ -19,7 +20,6 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:visibility_detector/visibility_detector.dart'; import 'package:visibility_detector/visibility_detector.dart';
import '../view_widget/location_tips.dart'; import '../view_widget/location_tips.dart';
@ -44,7 +44,7 @@ class UnionPageState extends State<UnionPage>
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
TabController tabController; TabController tabController;
BMFCoordinate latLng; Position latLng;
String areaName; String areaName;
List<GlobalKey> _allKey = []; List<GlobalKey> _allKey = [];
bool _isShowLocalTips = false; bool _isShowLocalTips = false;
@ -58,9 +58,9 @@ class UnionPageState extends State<UnionPage>
void dispose() { void dispose() {
super.dispose(); super.dispose();
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
if (Location.getInstance() != null && // if (LocationInstance.getInstance() != null &&
Location.getInstance().aMapFlutterLocation != null) // LocationInstance.getInstance().location != null)
Location.getInstance().aMapFlutterLocation.stopLocation(); // LocationInstance.getInstance().location.stopLocation();
} }
@override @override
@ -117,30 +117,27 @@ class UnionPageState extends State<UnionPage>
getLocation({bool showLoading = true}) async { getLocation({bool showLoading = true}) async {
if(showLoading) if(showLoading)
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black,
);
bool powerFlag = false; bool powerFlag = false;
// bool finallyFlag = false; // bool finallyFlag = false;
try { try {
Future.delayed(Duration(seconds: 5), () { powerFlag = await LocationInstance.getInstance().startLocation(context,
// if (!finallyFlag) (Position result) async {
Location.getInstance().stopLocation();
});
powerFlag = await Location.getInstance().startLocation(context,
(BaiduLocation result) async {
if (result != null && if (result != null &&
result.latitude != null && result.latitude != null &&
result.longitude != null) { result.longitude != null) {
print("location: $result"); print("location: $result");
latLng = BMFCoordinate(result.latitude, result.longitude); latLng = Position(
latLng = await BMFCalculateUtils.coordConvert( latitude: result.latitude,
coordinate: latLng, longitude: result.longitude,
fromType: BMF_COORD_TYPE.BD09LL, );
toType: BMF_COORD_TYPE.COMMON); Address address = await LocationInstance.getInstance().getAddress(result.latitude, result.longitude);
await saveLatLng( if (address != null) {
latLng, result.province, result.city, result.district); await saveLatLng(latLng, address.province, address.city, address.area);
print("union: Location result ${latLng.latitude} " }
"${latLng.longitude}"); LocationInstance.getInstance().stopLocation();
Location.getInstance().stopLocation();
} else { } else {
await getLatLng(); await getLatLng();
} }
@ -159,7 +156,7 @@ class UnionPageState extends State<UnionPage>
} }
} }
saveLatLng(BMFCoordinate latLng, province, city, district) async { saveLatLng(Position latLng, province, city, district) async {
SharedPreferences prefs = await SharedPreferences.getInstance(); SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("latitude", "${latLng.latitude}");
await prefs.setString("longitude", "${latLng.longitude}"); await prefs.setString("longitude", "${latLng.longitude}");
@ -175,14 +172,18 @@ class UnionPageState extends State<UnionPage>
tempLatLng.containsKey("province") && tempLatLng.containsKey("province") &&
tempLatLng.containsKey("city") && tempLatLng.containsKey("city") &&
tempLatLng.containsKey("district")) { tempLatLng.containsKey("district")) {
latLng = BMFCoordinate(double.tryParse(tempLatLng.getString("latitude")), latLng = Position(
double.tryParse(tempLatLng.getString("longitude"))); latitude: double.tryParse(tempLatLng.getString("latitude")),
longitude: double.tryParse(tempLatLng.getString("longitude")),
);
} }
} }
queryIpInfo() async { queryIpInfo() async {
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black,
);
try { try {
ApiService apiIpService = ApiService(Dio(), context: context, isIp: true); ApiService apiIpService = ApiService(Dio(), context: context, isIp: true);
IpData baseData = await apiIpService.getIpInfo().catchError((onError) {}); IpData baseData = await apiIpService.getIpInfo().catchError((onError) {});
@ -197,8 +198,9 @@ class UnionPageState extends State<UnionPage>
loadFinish({bool showLoading = true}) { loadFinish({bool showLoading = true}) {
if (showLoading) if (showLoading)
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); maskType: EasyLoadingMaskType.black,
);
_allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()]; _allKey = [GlobalKey(), GlobalKey(), GlobalKey(), GlobalKey()];
setState(() {}); setState(() {});
} }

239
lib/union/union_view/store_info.dart

@ -1,10 +1,14 @@
import 'dart:io';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
@ -108,10 +112,10 @@ class _StoreInfos extends State<StoreInfos> {
S.of(context).yingyeshijian(widget.storeInfo == null S.of(context).yingyeshijian(widget.storeInfo == null
? "" ? ""
: (widget.storeInfo.openStartTime == null && : (widget.storeInfo.openStartTime == null &&
widget.storeInfo.openEndTime == null) widget.storeInfo.openEndTime == null)
? S.of(context).quantian ? S.of(context).quantian
: "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} " : "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} "
"- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"), "- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"),
style: TextStyle( style: TextStyle(
color: Color(0xFF353535), color: Color(0xFF353535),
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -144,12 +148,7 @@ class _StoreInfos extends State<StoreInfos> {
widget.storeInfo.longitude == null || widget.storeInfo.longitude == null ||
widget.storeInfo.latitude == "" || widget.storeInfo.latitude == "" ||
widget.storeInfo.longitude == "") return; widget.storeInfo.longitude == "") return;
Navigator.of(context) showMapSelect();
.pushNamed('/router/location_map', arguments: {
"lat": widget.storeInfo.latitude,
"lng": widget.storeInfo.longitude,
"storeName": widget.storeInfo.storeName,
});
}, },
child: Image.asset( child: Image.asset(
"assets/image/icon_union_location.webp", "assets/image/icon_union_location.webp",
@ -177,175 +176,6 @@ class _StoreInfos extends State<StoreInfos> {
], ],
), ),
); );
// return AspectRatio(
// aspectRatio: 1,
// child: Container(
// margin: EdgeInsets.fromLTRB(16, 20, 16, 8),
// padding: EdgeInsets.fromLTRB(10, 20, 10, 14),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(8),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(25),
// offset: Offset(0, 1),
// blurRadius: 12,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// AspectRatio(
// aspectRatio: 1.8,
// child: buildSwiper(),
// ),
// Expanded(
// child: Container(
// margin: EdgeInsets.only(
// left: 10.w,
// right: 10.w,
// top: 16.h,
// ),
// child: Column(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Expanded(
// child: Container(
// alignment:
// Alignment.centerLeft,
// child: Text(
// widget.storeInfo != null
// ? widget.storeInfo.storeName
// : "",
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// fontSize: 16.sp,
// color: Colors.black,
// fontWeight: MyFontWeight.medium,
// ),
// ),
// ),
// ),
// Text(
// S.of(context).ren(
// widget.storeInfo != null
// ? widget.storeInfo
// .perCapitaConsumption
// : "",
// ),
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// fontSize: 14.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF353535),
// ),
// ),
// ],
// ),
// Text(
// widget.storeInfo != null
// ? widget.storeInfo.address
// : "",
// maxLines: 2,
// textAlign: TextAlign.justify,
// style: TextStyle(
// color: Color(0xFF353535),
// fontWeight: MyFontWeight.regular,
// fontSize: 12.sp,
// ),
// ),
// Row(
// children: itemServer(
// widget.storeInfo != null
// ? widget.storeInfo.businessService
// : "",
// ),
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.end,
// children: [
// Expanded(
// child: Text(
// S.of(context).yingyeshijian(widget.storeInfo ==
// null
// ? ""
// : (widget.storeInfo.openStartTime ==
// null &&
// widget.storeInfo
// .openEndTime ==
// null)
// ? S.of(context).quantian
// : "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} "
// "- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"),
// style: TextStyle(
// color: Color(0xFF353535),
// fontWeight: MyFontWeight.regular,
// fontSize: 12.sp,
// ),
// ),
// ),
// SizedBox(
// width: 16.w,
// ),
// InkWell(
// onTap: () {
// if (widget.storeInfo == null ||
// widget.storeInfo.latitude ==
// null ||
// widget.storeInfo.longitude ==
// null ||
// widget.storeInfo.latitude == "" ||
// widget.storeInfo.longitude == "")
// return;
// Navigator.of(context).pushNamed(
// '/router/location_map',
// arguments: {
// "lat": widget.storeInfo.latitude,
// "lng":
// widget.storeInfo.longitude,
// "storeName":
// widget.storeInfo.storeName,
// });
// },
// child: Image.asset(
// "assets/image/icon_union_location.webp",
// width: 24.w,
// height: 24.h,
// ),
// ),
// SizedBox(
// width: 16.w,
// ),
// InkWell(
// onTap: () {
// showCallMobile();
// },
// child: Image.asset(
// "assets/image/icon_union_call.webp",
// width: 24,
// height: 24,
// ),
// ),
// ],
// ),
// ],
// ),
// ),
// flex: 1,
// ),
// ],
// ),
// ),
// );
} }
Widget buildSwiper() { Widget buildSwiper() {
@ -444,4 +274,55 @@ class _StoreInfos extends State<StoreInfos> {
throw 'Could not launch $url'; throw 'Could not launch $url';
} }
} }
showMapSelect() {
showCupertinoModalPopup(
context: context,
builder: (context) {
return CupertinoActionSheet(
actions: [
CupertinoActionSheetAction(
child: Text(
"使用高德地图导航",
style: TextStyle(
fontWeight: MyFontWeight.regular,
),
),
onPressed: () {
onOpenBaiduMap();
Navigator.of(context).pop();
},
isDefaultAction: true,
isDestructiveAction: false,
),
],
cancelButton: CupertinoActionSheetAction(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).quxiao,
style: TextStyle(
color: Colors.blue,
),),
isDestructiveAction: true,
),
);
});
}
void onOpenBaiduMap() async {
LocationInstance.getInstance().startLocation(context, (locationData) {
String url = "${Platform.isIOS ? 'ios' : 'android'}amap://path?sourceApplication=haixia&sid="
"&slat=${locationData.latitude.toStringAsFixed(8)}&slon=${locationData.longitude.toStringAsFixed(8)}&sname=&did=&dlat=${widget.storeInfo.latitude}&dlon=${widget.storeInfo.longitude}&dname=&dev=0&t=0";
launch(url).then((value) {
if (!value) {
SmartDialog.showToast(
"未检测到安装高德地图",
alignment: Alignment.center,
);
}
});
});
}
} }

17
lib/utils/flutter_utils.dart

@ -3,20 +3,10 @@ import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
class AppUtils { class AppUtils {
///线
static Future<String> calculateDistance(
BMFCoordinate bmfCoordinate, BMFCoordinate myLatLng, {bool isMi = false}) async {
double mi =
await BMFCalculateUtils.getLocationDistance(bmfCoordinate, myLatLng);
NumberFormat numberFormat = NumberFormat("#.#");
return "${numberFormat.format(mi / (isMi ? 1 :1000))}";
}
/// ///
@ -78,13 +68,6 @@ class AppUtils {
return resString; return resString;
} }
///()
static Future<BMFCoordinate> coordConvert(BMFCoordinate latLng) async {
return BMFCalculateUtils.coordConvert(
coordinate: latLng,
fromType: BMF_COORD_TYPE.COMMON,
toType: BMF_COORD_TYPE.BD09LL);
}
static bool isPhone(mobile) { static bool isPhone(mobile) {
RegExp exp = RegExp( RegExp exp = RegExp(

141
lib/utils/gps_utils.dart

@ -0,0 +1,141 @@
import 'dart:math';
class GpsUtil {
static const num pi = 3.1415926535897932384626;
static const num x_pi = 3.14159265358979324 * 3000.0 / 180.0;
static const num a = 6378245.0;
static const num ee = 0.00669342162296594323;
static num transformLat(num x, num y) {
num ret = -100.0 +
2.0 * x +
3.0 * y +
0.2 * y * y +
0.1 * x * y +
0.2 * sqrt(x.abs());
ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * sin(y * pi) + 40.0 * sin(y / 3.0 * pi)) * 2.0 / 3.0;
ret += (160.0 * sin(y / 12.0 * pi) + 320 * sin(y * pi / 30.0)) * 2.0 / 3.0;
return ret;
}
static num transformLon(num x, num y) {
num ret =
300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * sqrt(x.abs());
ret += (20.0 * sin(6.0 * x * pi) + 20.0 * sin(2.0 * x * pi)) * 2.0 / 3.0;
ret += (20.0 * sin(x * pi) + 40.0 * sin(x / 3.0 * pi)) * 2.0 / 3.0;
ret +=
(150.0 * sin(x / 12.0 * pi) + 300.0 * sin(x / 30.0 * pi)) * 2.0 / 3.0;
return ret;
}
static List<num> transform(num lat, num lon) {
if (outOfChina(lat, lon)) {
return [lat, lon];
}
num dLat = transformLat(lon - 105.0, lat - 35.0);
num dLon = transformLon(lon - 105.0, lat - 35.0);
num radLat = lat / 180.0 * pi;
num magic = sin(radLat);
magic = 1 - ee * magic * magic;
num sqrtMagic = sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
num mgLat = lat + dLat;
num mgLon = lon + dLon;
return [mgLat, mgLon];
}
static bool outOfChina(num lat, num lon) {
if (lon < 72.004 || lon > 137.8347) return true;
if (lat < 0.8293 || lat > 55.8271) return true;
return false;
}
/// 84 to (GCJ-02) World Geodetic System ==> Mars Geodetic System
///
/// @param lat
/// @param lon
/// @return
static List<num> gps84_To_Gcj02(num lat, num lon) {
if (outOfChina(lat, lon)) {
return [lat, lon];
}
num dLat = transformLat(lon - 105.0, lat - 35.0);
num dLon = transformLon(lon - 105.0, lat - 35.0);
num radLat = lat / 180.0 * pi;
num magic = sin(radLat);
magic = 1 - ee * magic * magic;
num sqrtMagic = sqrt(magic);
dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
num mgLat = lat + dLat;
num mgLon = lon + dLon;
return [mgLat, mgLon];
}
/// * (GCJ-02) to 84 * * @param lon * @param lat * @return
static List<num> gcj02_To_Gps84(num lat, num lon) {
List<num> gps = transform(lat, lon);
num lontitude = lon * 2 - gps[1];
num latitude = lat * 2 - gps[0];
return [latitude, lontitude];
}
/// (GCJ-02) (BD-09) GCJ-02 BD-09
///
/// @param lat
/// @param lon
static List<num> gcj02_To_Bd09(num lat, num lon) {
num x = lon, y = lat;
num z = sqrt(x * x + y * y) + 0.00002 * sin(y * x_pi);
num theta = atan2(y, x) + 0.000003 * cos(x * x_pi);
num tempLon = z * cos(theta) + 0.0065;
num tempLat = z * sin(theta) + 0.006;
List<num> gps = [tempLat, tempLon];
return gps;
}
/// * (GCJ-02) (BD-09) * * BD-09 GCJ-02
/// @param lat
/// @param lon
/// @return
static List<num> bd09_To_Gcj02(num lat, num lon) {
num x = lon - 0.0065, y = lat - 0.006;
num z = sqrt(x * x + y * y) - 0.00002 * sin(y * x_pi);
num theta = atan2(y, x) - 0.000003 * cos(x * x_pi);
num tempLon = z * cos(theta);
num tempLat = z * sin(theta);
List<num> gps = [tempLat, tempLon];
return gps;
}
/// gps84转为bd09
///
/// @param lat
/// @param lon
/// @return
static List<num> gps84_To_bd09(num lat, num lon) {
List<num> gcj02 = gps84_To_Gcj02(lat, lon);
List<num> bd09 = gcj02_To_Bd09(gcj02[0], gcj02[1]);
return bd09;
}
static List<num> bd09_To_gps84(num lat, num lon) {
List<num> gcj02 = bd09_To_Gcj02(lat, lon);
List<num> gps84 = gcj02_To_Gps84(gcj02[0], gcj02[1]);
//
gps84[0] = retain6(gps84[0]);
gps84[1] = retain6(gps84[1]);
return gps84;
}
///
///
/// @param num
/// @return
static num retain6(num n) {
return num.parse(n.toStringAsFixed(6));
}
}

193
lib/utils/location.dart

@ -1,112 +1,60 @@
import 'dart:io'; import 'package:dio/dio.dart';
import 'package:android_intent_plus/android_intent.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:geolocator/geolocator.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart' as PH;
import 'font_weight.dart'; import 'font_weight.dart';
BaiduLocationAndroidOption initAndroidOptions() { class LocationInstance {
BaiduLocationAndroidOption options = BaiduLocationAndroidOption( static LocationInstance _instance;
//
locationMode: BMFLocationMode.hightAccuracy,
//
isNeedAddress: true,
//
isNeedAltitude: false,
// poi信息
isNeedLocationPoiList: false,
// rgc信息
isNeedNewVersionRgc: false,
//
isNeedLocationDescribe: true,
// 使gps
openGps: true,
//
locationPurpose: BMFLocationPurpose.signIn,
//
coordType: BMFLocationCoordType.bd09ll,
// int类型ms
// 00
scanspan: 0);
return options;
}
BaiduLocationIOSOption initIOSOptions() {
BaiduLocationIOSOption options = BaiduLocationIOSOption(
//
coordType: BMFLocationCoordType.bd09ll,
//
locationTimeout: 10,
//
reGeocodeTimeout: 10,
// automotiveNavigation
activityType: BMFActivityType.automotiveNavigation,
// best
desiredAccuracy: BMFDesiredAccuracy.best,
// rgc数据
isNeedNewVersionRgc: false,
//
pausesLocationUpdatesAutomatically: false,
// ,
//
allowsBackgroundLocationUpdates: false,
//
distanceFilter: 10,
);
return options;
}
class Location {
static Location _instance;
Location._internal() { LocationInstance._internal() {}
aMapFlutterLocation = LocationFlutterPlugin();
}
static Location getInstance() { static LocationInstance getInstance() {
if (_instance == null) { if (_instance == null) {
_instance = Location._internal(); _instance = LocationInstance._internal();
} }
return _instance; return _instance;
} }
LocationFlutterPlugin aMapFlutterLocation;
Future<bool> startLocation( Future<bool> startLocation(
context, Function(BaiduLocation result) locationCallback) async { context, Function(Position locationData) locationCallback) async {
aMapFlutterLocation.prepareLoc( LocationPermission permissionStatus = await Geolocator.checkPermission();
initAndroidOptions().getMap(), initIOSOptions().getMap()); if (permissionStatus == LocationPermission.denied) {
var permissionStatus = await Permission.location.status; permissionStatus = await Geolocator.requestPermission();
if (!permissionStatus.isGranted) { }
if (permissionStatus.isUndetermined) if (permissionStatus == LocationPermission.denied) {
showTipsAlertDialog(context); showTipsAlertDialog(context);
return false;
}
if (permissionStatus == LocationPermission.deniedForever) {
showTipsAlertDialog(context);
return false; return false;
} else { }
aMapFlutterLocation.singleLocationCallback( if (permissionStatus == LocationPermission.whileInUse ||
callback: (BaiduLocation result) { permissionStatus == LocationPermission.always) {
locationCallback.call(result); bool isNext = true;
Future.delayed(Duration(seconds: 5), () {
if (isNext) {
EasyLoading.dismiss();
}
}); });
if (Platform.isIOS) { Position locationData = await Geolocator.getCurrentPosition();
await aMapFlutterLocation.singleLocation({ isNext = false;
'isReGeocode': true, locationCallback.call(locationData);
'isNetworkState': true,
});
} else if (Platform.isAndroid) {
await aMapFlutterLocation.startLocation();
}
return true;
} }
return true;
} }
void stopLocation() { void stopLocation() {}
if (aMapFlutterLocation != null) aMapFlutterLocation.stopLocation();
}
enableLocation(context) { enableLocation(context) {
showCupertinoDialog( showCupertinoDialog(
@ -119,10 +67,12 @@ class Location {
S.of(context).dakaidingwei, S.of(context).dakaidingwei,
(result) async { (result) async {
if (result) { if (result) {
final AndroidIntent intent = AndroidIntent( // final AndroidIntent intent = AndroidIntent(
action: 'action_location_source_settings', // action: 'action_location_source_settings',
package: "com.zsw.huixiang"); // package: "com.zsw.huixiang",
await intent.launch(); // );
// await intent.launch();
Geolocator.openLocationSettings();
// startLocation(); // startLocation();
} }
}, },
@ -132,7 +82,7 @@ class Location {
); );
} }
requestDialog(context, Function(BaiduLocation result) locationCallback) { requestDialog(context, Function(Position result) locationCallback) {
showCupertinoDialog( showCupertinoDialog(
context: context, context: context,
builder: (context) { builder: (context) {
@ -143,8 +93,11 @@ class Location {
S.of(context).kaiqiquanxian, S.of(context).kaiqiquanxian,
(result) async { (result) async {
if (result) { if (result) {
await openAppSettings(); await PH.openAppSettings();
if (await Permission.location.isGranted) { if ((await Geolocator.checkPermission()) ==
LocationPermission.whileInUse ||
(await Geolocator.checkPermission()) ==
LocationPermission.always) {
startLocation(context, locationCallback); startLocation(context, locationCallback);
} }
} }
@ -218,7 +171,7 @@ class Location {
); );
}, },
); );
await Permission.location.request(); Geolocator.requestPermission();
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
@ -292,8 +245,11 @@ class Location {
), ),
), ),
onTap: () async { onTap: () async {
await openAppSettings(); await PH.openAppSettings();
if (await Permission.location.isGranted) if ((await Geolocator.checkPermission()) ==
LocationPermission.whileInUse ||
(await Geolocator.checkPermission()) ==
LocationPermission.always)
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
@ -325,4 +281,45 @@ class Location {
}, },
); );
} }
///线
static Future<String> calculateDistance(
Position bmfCoordinate, Position myLatLng,
{bool isMi = false}) async {
double mi = Geolocator.distanceBetween(
bmfCoordinate.latitude,
bmfCoordinate.longitude,
myLatLng.latitude,
myLatLng.longitude,
);
NumberFormat numberFormat = NumberFormat("#.#");
return "${numberFormat.format(mi / (isMi ? 1 : 1000))}";
}
// ///()
// static Future<Latlng> coordConvert(Latlng latLng) async {
// return BMFCalculateUtils.coordConvert(
// coordinate: latLng,
// fromType: BMF_COORD_TYPE.COMMON,
// toType: BMF_COORD_TYPE.BD09LL);
// }
Future<Address> getAddress(double lat, double lang) async {
var result = await ApiService(Dio()).geocodeRegeo("$lat", "$lang");
print("address_result: $result");
if (result["status"] == 1 &&
result["regeocode"] != null &&
result["regeocode"]["addressComponent"] != null) {
Address address = Address.fromJson({
"address": result["regeocode"]["formatted_address"],
"area": result['regeocode']["addressComponent"]["district"],
"city": result['regeocode']["addressComponent"]["city"],
"latitude": lat,
"longitude": lang,
"province": result['regeocode']["addressComponent"]["province"],
});
return address;
}
return null;
}
} }

256
pubspec.lock

File diff suppressed because it is too large Load Diff

9
pubspec.yaml

@ -41,18 +41,15 @@ dependencies:
permission_handler: ^5.0.1+1 permission_handler: ^5.0.1+1
flutter_bmflocation: 3.2.1 geolocator: ^6.2.1
flutter_baidu_mapapi_base: 3.2.0 # location: ^3.2.4
flutter_baidu_mapapi_map: 3.2.1
flutter_baidu_mapapi_search: 3.2.0
flutter_baidu_mapapi_utils: 3.2.0
dio: ^3.0.10 dio: ^3.0.10
rxdart: ^0.26.0 rxdart: ^0.26.0
retrofit: ^1.3.4+1 retrofit: ^1.3.4+1
json_annotation: ^3.1.1 json_annotation: ^3.1.1
logger: ^2.0.2+1 logger: ^2.0.2+1
dio_log: ^1.3.5 # dio_log: ^1.3.5
pin_input_text_field: ^4.1.2 pin_input_text_field: ^4.1.2
android_intent_plus: ^1.0.2 android_intent_plus: ^1.0.2

Loading…
Cancel
Save