From 1a0c6f7282d1ec09d2dbd4dde925b15c33636b5e Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 16:34:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=81=94=E7=9B=9F=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=9B=20=E8=B7=AF=E5=BE=84=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/store/store_view/store_info.dart | 4 ++-- lib/union/location_map_page.dart | 20 +++++++++++++++++--- lib/union/union_list.dart | 10 +++++----- lib/union/union_page.dart | 1 - 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart index afcbc336..5aff71d7 100644 --- a/lib/store/store_view/store_info.dart +++ b/lib/store/store_view/store_info.dart @@ -298,8 +298,8 @@ class _StoreInfoView extends State { text: "$e", backgroup: Color(0xFFFF7A1A), padding: EdgeInsets.only( - left: 2.w, - right: 2.w, + left: 4.w, + right: 4.w, ), fontSize: 10.sp, textColor: Colors.white, diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index 1ae4158a..dde6fbe5 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; @@ -162,7 +163,7 @@ class _LocationMap extends State with WidgetsBindingObserver { Expanded( child: Container( //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: BMFTextureMapWidget( + child: (Platform.isAndroid) ? BMFTextureMapWidget( mapOptions: BMFMapOptions( center: BMFCoordinate( double.tryParse(widget.arguments["lat"]), @@ -174,7 +175,20 @@ class _LocationMap extends State with WidgetsBindingObserver { zoomLevel: 15, ), onBMFMapCreated: onMapCreated, - )), + ) : + BMFMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), flex: 3, ), navigationState == 0 @@ -460,7 +474,7 @@ class _LocationMap extends State with WidgetsBindingObserver { ? 'assets/image/traffic_texture_unknown.png' : 'assets/image/traffic_texture_smooth.png' ], - width: 16, + width: 16.w.toInt(), lineDashType: BMFLineDashType.LineDashTypeNone, lineCapType: BMFLineCapType.LineCapButt, lineJoinType: BMFLineJoinType.LineJoinRound); diff --git a/lib/union/union_list.dart b/lib/union/union_list.dart index d0a4448f..d4d4ed08 100644 --- a/lib/union/union_list.dart +++ b/lib/union/union_list.dart @@ -195,7 +195,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { Widget buildStoreItem(Store store, position) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 12.h), - padding: EdgeInsets.all(12.h), + padding: EdgeInsets.symmetric(horizontal:12.w,vertical: 12.h), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(6)), @@ -208,7 +208,6 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { ) ]), width: double.infinity, - // height: 235.h, child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -307,7 +306,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { SizedBox(height: store.businessService == "" ? 40.h : 23.h), if (storeList[position].productShow != null) Container( - height: 120.h, + height: 100.h, child: ListView.builder( padding: EdgeInsets.zero, itemCount: @@ -343,9 +342,9 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { child: Container( decoration: BoxDecoration( color: Color(0xFFF65720), - borderRadius: BorderRadius.circular(1), + borderRadius: BorderRadius.circular(2), ), - padding: EdgeInsets.all(2), + padding: EdgeInsets.symmetric(vertical:2.h,horizontal:3.w), margin: EdgeInsets.only(right: 10.w), child: Text( "$e", @@ -365,6 +364,7 @@ class _UnionList extends State with AutomaticKeepAliveClientMixin { width: 74.h, margin: EdgeInsets.only(right: 8.w), child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ MImage( diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 3bcb69bd..d1cb3c36 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -109,7 +109,6 @@ class UnionPageState extends State } }); queryIpInfo(); - // loadFinish(showLoading: false); } startLocation() async { From ed2fa1640969bbfacce4eb7578486102eff1eb79 Mon Sep 17 00:00:00 2001 From: huixiang_app <953969641@qq.com> Date: Tue, 5 Sep 2023 20:41:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=BC=A9=E6=94=BE=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/union/location_map_page.dart | 76 +++++++++++++++++++------------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/lib/union/location_map_page.dart b/lib/union/location_map_page.dart index dde6fbe5..17e5c619 100644 --- a/lib/union/location_map_page.dart +++ b/lib/union/location_map_page.dart @@ -163,32 +163,33 @@ class _LocationMap extends State with WidgetsBindingObserver { Expanded( child: Container( //BMFMapWidget 组件会自动默认沾满全屏,并且挡住所有遮盖物 ,BMFTextureMapWidget不会强制遮盖其他控件。 - child: (Platform.isAndroid) ? BMFTextureMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), - ), - showZoomControl: false, - showMapScaleBar: false, - rotateEnabled: false, - zoomLevel: 15, - ), - onBMFMapCreated: onMapCreated, - ) : - BMFMapWidget( - mapOptions: BMFMapOptions( - center: BMFCoordinate( - double.tryParse(widget.arguments["lat"]), - double.tryParse(widget.arguments["lng"]), - ), - showZoomControl: false, - showMapScaleBar: false, - rotateEnabled: false, - zoomLevel: 15, - ), - onBMFMapCreated: onMapCreated, - )), + child: (Platform.isAndroid) + ? BMFTextureMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + ) + : BMFMapWidget( + mapOptions: BMFMapOptions( + center: BMFCoordinate( + double.tryParse(widget.arguments["lat"]), + double.tryParse(widget.arguments["lng"]), + ), + showZoomControl: false, + showMapScaleBar: false, + rotateEnabled: false, + zoomLevel: 15, + ), + onBMFMapCreated: onMapCreated, + )), flex: 3, ), navigationState == 0 @@ -306,8 +307,9 @@ class _LocationMap extends State with WidgetsBindingObserver { onTap: () { if (myCity == null) { // onOpenBaiduMap(); - SmartDialog.showToast("您定位服务未开启,请前往系统设置中开启定位服务", - alignment: Alignment.center); + SmartDialog.showToast( + "您定位服务未开启,请前往系统设置中开启定位服务", + alignment: Alignment.center); } else { navigationState = 1; if ((distance ?? 0) < 500) @@ -408,7 +410,8 @@ class _LocationMap extends State with WidgetsBindingObserver { } void onOpenBaiduMap() async { - launch("baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); + launch( + "baidumap://map/marker?location=${storeInfo.latitude},${storeInfo.longitude}&title=${storeInfo.storeName}&content=${storeInfo.storeName}&traffic=on&src=andr.baidu.openAPIdemo&coord_type=gcj02"); } //調取百度地圖APP @@ -452,7 +455,7 @@ class _LocationMap extends State with WidgetsBindingObserver { } updateMapLine(List coordinates, int needHours, int needMinutes, - double needDistance) { + double needDistance) async { try { //刪除之前的創建的點和綫 _mapController.cleanAllMarkers(); @@ -499,12 +502,23 @@ class _LocationMap extends State with WidgetsBindingObserver { draggable: false, ); _mapController.addMarker(terminalBmfMarker); - _mapController.setVisibleMapRectWithPadding( + SmartDialog.showToast( + "${startLocation.longitude} ${startLocation.latitude} ${endLocation.longitude} ${endLocation.latitude}", + alignment: Alignment.center); + bool tryFlag = await _mapController.setVisibleMapRectWithPadding( visibleMapBounds: BMFCoordinateBounds( northeast: startLocation, southwest: endLocation), animated: true, insets: EdgeInsets.only(top: 500, bottom: 200, left: 200, right: 200)); + if (!tryFlag) { + tryFlag = await _mapController.setVisibleMapBounds( + BMFCoordinateBounds(northeast: startLocation, southwest: endLocation), + true, + ); + if (!tryFlag) + SmartDialog.showToast("还是不行", alignment: Alignment.center); + } hours = needHours == 0 ? "" : "$needHours小时"; minutes = needMinutes == 0 ? "" : "$needMinutes分钟";