diff --git a/assets/image/2x/icon_mine_card.png b/assets/image/2x/icon_mine_card.png index 37288409..be0cc359 100644 Binary files a/assets/image/2x/icon_mine_card.png and b/assets/image/2x/icon_mine_card.png differ diff --git a/assets/image/2x/icon_mine_order.png b/assets/image/2x/icon_mine_order.png index 7514b127..5752cefa 100644 Binary files a/assets/image/2x/icon_mine_order.png and b/assets/image/2x/icon_mine_order.png differ diff --git a/assets/image/3x/icon_mine_card.png b/assets/image/3x/icon_mine_card.png index 1eb7adb3..64e99792 100644 Binary files a/assets/image/3x/icon_mine_card.png and b/assets/image/3x/icon_mine_card.png differ diff --git a/assets/image/3x/icon_mine_order.png b/assets/image/3x/icon_mine_order.png index 5692ca31..edabd917 100644 Binary files a/assets/image/3x/icon_mine_order.png and b/assets/image/3x/icon_mine_order.png differ diff --git a/assets/image/icon_mine_card.png b/assets/image/icon_mine_card.png index 3ca94d36..fef2da70 100644 Binary files a/assets/image/icon_mine_card.png and b/assets/image/icon_mine_card.png differ diff --git a/assets/image/icon_mine_order.png b/assets/image/icon_mine_order.png index bdac70dc..24030435 100644 Binary files a/assets/image/icon_mine_order.png and b/assets/image/icon_mine_order.png differ diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart index cb69a73f..8b7b0a08 100644 --- a/lib/home/points_mall_page.dart +++ b/lib/home/points_mall_page.dart @@ -440,8 +440,9 @@ class _PointsMallPage extends State borderRadius: BorderRadius.only(topRight: Radius.circular(4)), child: Image.asset( "assets/image/icon_hot_right_top.png", - width: 36, - height: 36, + width: 36.w, + height: 36.h, + fit: BoxFit.cover, ), ), ), diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index 7a1e3a5d..6e6aaa60 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -249,11 +249,12 @@ class _IntegralPage extends State { task.name, style: TextStyle( fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), SizedBox( - width: 7, + height: 7.h, ), Row( children: [ @@ -272,6 +273,7 @@ class _IntegralPage extends State { "${task.complateNum ?? task.conplateNum}/${task.limitDay}"), style: TextStyle( fontSize: 12.sp, + fontWeight: FontWeight.w400, color: Color(0xFF727272), ), ), @@ -291,7 +293,7 @@ class _IntegralPage extends State { radius: 12, fontSize: 14.sp, fontWeight: FontWeight.bold, - padding: EdgeInsets.fromLTRB(12.w, 2.h, 12.w, 2.h), + padding: EdgeInsets.fromLTRB(12.w, 4.h, 12.w, 4.h), ) ], ), @@ -320,7 +322,7 @@ class _IntegralPage extends State { style: TextStyle( color: Color(0xFF353535), fontSize: 14.sp, - fontWeight: FontWeight.bold), + fontWeight: FontWeight.w500), ), SizedBox( height: 10.h, @@ -331,7 +333,8 @@ class _IntegralPage extends State { S.of(context).shenmijifendali, style: TextStyle( color: Color(0xFF727272), - fontSize: 12.sp, + fontWeight: FontWeight.bold, + fontSize: 10.sp, ), ), ), @@ -374,7 +377,7 @@ class _IntegralPage extends State { ? Colors.white : Color(0xFF353535), fontSize: 14.sp, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, ), ), Container( @@ -441,6 +444,9 @@ class _IntegralPage extends State { fontSize: 16.sp, color: Color(0xFF353535)), ), + SizedBox( + height: 10.h, + ), Text( S.of(context).lianxuqiandaolingqushuangbeijifen, style: TextStyle( @@ -471,6 +477,8 @@ class _IntegralPage extends State { child: Container( alignment: Alignment.center, child: RoundButton( + width: 106, + height: 34, text: (signInfo != null && signInfo.todayHasSignin) ? S.of(context).yiqiandao : S.of(context).lijiqiandao, @@ -479,6 +487,7 @@ class _IntegralPage extends State { ? Colors.grey : Color(0xFF32A060), fontSize: 16.sp, + fontWeight: FontWeight.w400, padding: EdgeInsets.fromLTRB(16.w, 6.h, 16.w, 6.h), radius: 4, ), @@ -499,7 +508,9 @@ class _IntegralPage extends State { BaseData baseData = await apiService.signIn(); if (baseData != null && baseData.isSuccess) { querySignInfo(); - SmartDialog.show(widget: SignInWidget("${signInfo.signInList.length + 1}", "${signInfo.rewardList[signInfo.signInList.length]}")); + SmartDialog.show( + widget: SignInWidget("${signInfo.signInList.length + 1}", + "${signInfo.rewardList[signInfo.signInList.length]}")); } } @@ -519,7 +530,7 @@ class _IntegralPage extends State { Text( signInfo != null ? "${signInfo.point}" : "0", style: TextStyle( - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, fontSize: 21.sp, color: Colors.white, ), @@ -531,6 +542,7 @@ class _IntegralPage extends State { S.of(context).wodejifenzhi, style: TextStyle( fontSize: 12.sp, + fontWeight: FontWeight.w400, color: Color(0xFFF2F2F2), ), ) @@ -548,7 +560,8 @@ class _IntegralPage extends State { Navigator.of(context) .pushNamed('/router/mine_vip_level_page', arguments: { "rankLevel": rankLevel, - "createTime": (userinfo != null) ? "${userinfo.createTime}" : "", + "createTime": + (userinfo != null) ? "${userinfo.createTime}" : "", "points": (userinfo != null) ? int.tryParse(userinfo.points) : 0, }); @@ -562,7 +575,7 @@ class _IntegralPage extends State { ? "${signInfo.rank.rankName.replaceAll("会员", "")}" : "", style: TextStyle( - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w500, fontSize: 21.sp, color: Colors.white, ), @@ -578,6 +591,7 @@ class _IntegralPage extends State { S.of(context).wodehuiyuandengji, style: TextStyle( fontSize: 12.sp, + fontWeight: FontWeight.w400, color: Color(0xFFF2F2F2), ), ), diff --git a/lib/integral_store/integral_store_details_page.dart b/lib/integral_store/integral_store_details_page.dart index f5e665ca..927c67b2 100644 --- a/lib/integral_store/integral_store_details_page.dart +++ b/lib/integral_store/integral_store_details_page.dart @@ -102,16 +102,15 @@ class _IntegralStoreDetailsPage extends State { assetUriMatcher(): assetImageRender(), networkSourceMatcher(extension: "svg"): svgNetworkImageRender(), - networkSourceMatcher(): - networkImageRender( - loadingWidget: () { - // return Image.asset("assets/image/default_1.png",); - return Container(); - }, - // mapUrl: (url) { - // print("objectUrl: $url"); - // return "$url?imageMogr2/format/webp/blur/1x0/quality/75"; - // } + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + // return Image.asset("assets/image/default_1.png",); + return Container(); + }, + // mapUrl: (url) { + // print("objectUrl: $url"); + // return "$url?imageMogr2/format/webp/blur/1x0/quality/75"; + // } ), }, ), @@ -225,6 +224,7 @@ class _IntegralStoreDetailsPage extends State { : S.of(context).yiduihuanjian("${goods.sales}"), style: TextStyle( fontSize: 10.sp, + fontWeight: FontWeight.w400, color: Color(0xFFA29E9E), ), ), @@ -242,6 +242,7 @@ class _IntegralStoreDetailsPage extends State { goods == null ? "" : goods.description, style: TextStyle( fontSize: 12.sp, + fontWeight: FontWeight.w400, color: Color(0xFF727272), ), ), diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index acaa4207..5ebb9213 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -499,7 +499,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { Text( S.of(context).kaquan, style: TextStyle( - fontWeight: FontWeight.w600, + fontWeight: FontWeight.bold, fontSize: 16.sp, color: Color(0xFF353535), ), @@ -512,7 +512,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { width: 2.w, height: 32.h, margin: EdgeInsets.only(left: 20.w, right: 20.w), - color: Color(0xFFABABAB), + color: Color(0xFFF7F7F7), ), Expanded( flex: 1, diff --git a/lib/mine/mine_vip_level_page.dart b/lib/mine/mine_vip_level_page.dart index ac4873ad..f86c955b 100644 --- a/lib/mine/mine_vip_level_page.dart +++ b/lib/mine/mine_vip_level_page.dart @@ -135,6 +135,7 @@ class _MineVipLevelPage extends State { style: TextStyle( textBaseline: TextBaseline.alphabetic, fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), @@ -222,6 +223,7 @@ class _MineVipLevelPage extends State { style: TextStyle( textBaseline: TextBaseline.alphabetic, fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), @@ -249,6 +251,7 @@ class _MineVipLevelPage extends State { S.of(context).youhuiquanwufajileijifen, style: TextStyle( fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), @@ -278,6 +281,7 @@ class _MineVipLevelPage extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), @@ -289,6 +293,7 @@ class _MineVipLevelPage extends State { textAlign: TextAlign.center, style: TextStyle( fontSize: 14.sp, + fontWeight: FontWeight.w400, color: Color(0xFF353535), ), ), diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index e2f63fe3..352a8076 100644 --- a/lib/mine/vip_detail_page.dart +++ b/lib/mine/vip_detail_page.dart @@ -194,7 +194,7 @@ class _VipDetailPage extends State { fadeSrc: "assets/image/default_1.png", ), SizedBox( - width: 12.w, + width: 8.w, ), Expanded( child: Container( @@ -212,7 +212,7 @@ class _VipDetailPage extends State { vipCard != null ? vipCard.storeName : "", overflow: TextOverflow.ellipsis, style: TextStyle( - fontSize: 20.sp, + fontSize: 14.sp, fontWeight: FontWeight.bold, color: Colors.black, ), @@ -228,10 +228,10 @@ class _VipDetailPage extends State { TextSpan( children: [ TextSpan( - text: "会员卡", + text: S.of(context).huiyuanka, style: TextStyle( fontSize: 12.sp, - fontWeight: FontWeight.bold, + fontWeight: FontWeight.w400, color: Colors.black, ), ), @@ -263,7 +263,7 @@ class _VipDetailPage extends State { children: [ TextSpan( text: - "¥${vipCard != null ? vipCard.balance : ""}", + "¥ ${vipCard != null ? vipCard.balance : ""}", style: TextStyle( fontSize: 24.sp, fontWeight: FontWeight.w500, @@ -348,10 +348,10 @@ class _VipDetailPage extends State { child: Text( vipCard != null ? "${vipCard.id.substring(0, 4)} " - "${vipCard.id.substring(4, 8)} " - "${vipCard.id.substring(8, 12)} " - "${vipCard.id.substring(12, 16)} " - "${vipCard.id.substring(16, vipCard.id.length)}" + "${vipCard.id.substring(4, 8)} " + "${vipCard.id.substring(8, 12)} " + "${vipCard.id.substring(12, 16)} " + "${vipCard.id.substring(16, vipCard.id.length)}" : "", maxLines: 1, textAlign: TextAlign.center, @@ -361,11 +361,11 @@ class _VipDetailPage extends State { wordSpacing: vipCard == null ? 10 : (MediaQuery.of(context).size.width - 64.w) / - (((vipCard.id.length) * 4)), + (((vipCard.id.length) * 4)), letterSpacing: vipCard == null ? 8 : (MediaQuery.of(context).size.width - 64.w) / - (((vipCard.id.length) * 4)), + (((vipCard.id.length) * 4)), ), ), ), @@ -407,10 +407,11 @@ class _VipDetailPage extends State { ), )), GestureDetector( - onTap: (){ - Navigator.of(context).pushNamed('/router/union_detail_page',arguments: {"id": orderInfo.storeId}); + onTap: () { + Navigator.of(context).pushNamed('/router/union_detail_page', + arguments: {"id": orderInfo.storeId}); }, - child:Text( + child: Text( "查看", style: TextStyle( fontSize: 12.sp, @@ -469,7 +470,7 @@ class _VipDetailPage extends State { flex: 1, child: Text( (orderInfo.storeVO.openStartTime == null && - orderInfo.storeVO.openEndTime == null) + orderInfo.storeVO.openEndTime == null) ? S.of(context).quantian : "${orderInfo.storeVO.openStartTime.substring(0, orderInfo.storeVO.openStartTime.lastIndexOf(":"))}-${orderInfo.storeVO.openEndTime.substring(0, orderInfo.storeVO.openEndTime.lastIndexOf(":"))}", style: TextStyle( @@ -514,40 +515,40 @@ class _VipDetailPage extends State { return products .map( (e) => Container( - margin: EdgeInsets.symmetric(horizontal: 2.w), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - MImage( - e.skuImg, - width: 75.w, - height: 75.h, - fit: BoxFit.contain, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - SizedBox( - height: 4.h, - ), - if (isRemake) - Container( - width: 75.w, - child: Text( - e.productName, - maxLines: 1, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 10.sp, - color: Color(0xFF353535), - ), + margin: EdgeInsets.symmetric(horizontal: 2.w), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + MImage( + e.skuImg, + width: 75.w, + height: 75.h, + fit: BoxFit.contain, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), - ), - ], - ), - ), - ) + SizedBox( + height: 4.h, + ), + if (isRemake) + Container( + width: 75.w, + child: Text( + e.productName, + maxLines: 1, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 10.sp, + color: Color(0xFF353535), + ), + ), + ), + ], + ), + ), + ) .toList(); } } diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index 3e116642..30b045d5 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -721,7 +721,8 @@ class _UnionDetailsPage extends State { receiveVip() async { BaseData baseData = await apiService.minLogin(storeInfo.id); if (baseData != null && baseData.isSuccess) { - SmartDialog.showToast(S.of(context).lingquchenggong, alignment: Alignment.center); + SmartDialog.showToast(S.of(context).lingquchenggong, + alignment: Alignment.center); setState(() { isReceive = false; }); @@ -909,7 +910,8 @@ class _UnionDetailsPage extends State { _loginMin() async { if (storeInfo == null) return; if (!isEnable()) { - SmartDialog.showToast(S.of(context).zanbuzhichixianshangdiancan, alignment: Alignment.center); + SmartDialog.showToast(S.of(context).zanbuzhichixianshangdiancan, + alignment: Alignment.center); return; } BaseData baseData = await apiService.minLogin(storeInfo.id); diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 2629fd36..586b1c7c 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -1,14 +1,15 @@ import 'dart:io'; import 'dart:ui'; +import 'package:amap_flutter_location/amap_flutter_location.dart'; +import 'package:amap_flutter_location/amap_location_option.dart'; import 'package:android_intent_plus/android_intent.dart'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'; -import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; @@ -20,13 +21,15 @@ import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/item_title.dart'; +import 'package:amap_flutter_base/amap_flutter_base.dart'; +import 'package:amap_flutter_map/amap_flutter_map.dart'; import 'package:huixiang/view_widget/request_permission.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'dart:typed_data'; import 'package:flutter/rendering.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; class UnionPage extends StatefulWidget { @override @@ -38,15 +41,27 @@ class UnionPage extends StatefulWidget { class _UnionPage extends State with AutomaticKeepAliveClientMixin, WidgetsBindingObserver { //默认设置为不使用自定义地图,如果需要直接显示,在初始化是设置为true + CustomStyleOptions _customStyleOptions = CustomStyleOptions(false); //加载自定义地图样式 void _loadCustomData() async { + if (null == _customStyleOptions) { + _customStyleOptions = CustomStyleOptions(false); + } + ByteData styleByteData = + await rootBundle.load('assets/map_style/style.data'); + _customStyleOptions.styleData = styleByteData.buffer.asUint8List(); + ByteData styleExtraByteData = + await rootBundle.load('assets/map_style/style_extra.data'); + _customStyleOptions.styleExtraData = + styleExtraByteData.buffer.asUint8List(); + //如果需要加载完成后直接展示自定义地图,可以通过setState修改CustomStyleOptions的enable为true setState(() { - _mapController.setCustomMapStyle('assets/map_style/chatian.sty', 0); + _customStyleOptions.enabled = true; }); } - LocationFlutterPlugin aMapFlutterLocation; + AMapFlutterLocation aMapFlutterLocation; RefreshController refreshController = RefreshController(initialRefresh: false); @@ -55,6 +70,7 @@ class _UnionPage extends State super.dispose(); WidgetsBinding.instance.removeObserver(this); aMapFlutterLocation.stopLocation(); + aMapFlutterLocation.destroy(); refreshController.dispose(); } @@ -89,17 +105,19 @@ class _UnionPage extends State WidgetsBinding.instance.addObserver(this); if (aMapFlutterLocation == null) { - aMapFlutterLocation = LocationFlutterPlugin(); - aMapFlutterLocation.onResultCallback().listen((event) { + AMapFlutterLocation.setApiKey("f39d1daa020a56f208eb2519f63e9534", + "feaae7986201b571cace1b83728be5bb"); + aMapFlutterLocation = AMapFlutterLocation(); + aMapFlutterLocation.onLocationChanged().listen((event) { if (event != null && event["latitude"] != null && event["longitude"] != null) { print("location: $event"); if (event["latitude"] is String && event["longitude"] is String) { - latLng = BMFCoordinate(double.tryParse(event["latitude"]), + latLng = LatLng(double.tryParse(event["latitude"]), double.tryParse(event["longitude"])); } else { - latLng = BMFCoordinate(event["latitude"], event["longitude"]); + latLng = LatLng(event["latitude"], event["longitude"]); } saveLatLng( latLng, event["province"], event["city"], event["district"]); @@ -111,10 +129,12 @@ class _UnionPage extends State event["district"], editingController.text); if (_mapController != null) - _mapController.updateMapOptions(BMFMapOptions( - center: latLng, - zoomLevel: 15, - )); + _mapController.moveCamera( + CameraUpdate.newCameraPosition(CameraPosition( + target: latLng, + zoom: 15.0, + )), + ); } }); @@ -126,25 +146,15 @@ class _UnionPage extends State }); } - aMapFlutterLocation.prepareLoc({ - "coorType": "bd09ll", - "isNeedAddres": false, - "isNeedAltitude": false, - "isNeedLocationPoiList": false, - "isNeedLocationDescribe": false, - "isNeedNewVersionRgc": false, - "scanspan": 0, - "openGps": true, - "locationMode": 2, - }, { - "locationMode": "kCLLocationAccuracyBest", - "locationTimeout": 10, - "reGeocodeTimeout": 10, - "activityType": "CLActivityTypeAutomotiveNavigation", - "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", - "BMKLocationCoordinateType": "BMKLocationCoordinateTypeBMK09LL", - "isNeedNewVersionRgc": false, - }); + aMapFlutterLocation.setLocationOption(AMapLocationOption( + needAddress: true, + onceLocation: true, + locationMode: AMapLocationMode.Hight_Accuracy, + desiredAccuracy: DesiredAccuracy.HundredMeters, + desiredLocationAccuracyAuthorizationMode: + AMapLocationAccuracyAuthorizationMode.FullAndReduceAccuracy, + pausesLocationUpdatesAutomatically: true, + )); _loadCustomData(); @@ -152,9 +162,9 @@ class _UnionPage extends State startLocation(); } - BMFCoordinate latLng; + LatLng latLng; - saveLatLng(BMFCoordinate latLng, province, city, district) async { + saveLatLng(LatLng latLng, province, city, district) async { SharedPreferences prefs = await SharedPreferences.getInstance(); await prefs.setString("latitude", "${latLng.latitude}"); await prefs.setString("longitude", "${latLng.longitude}"); @@ -176,7 +186,7 @@ class _UnionPage extends State value.containsKey("city") && value.containsKey("district")) { - latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), + latLng = LatLng(double.tryParse(value.getString("latitude")), double.tryParse(value.getString("longitude"))), queryStore( value.getString("latitude"), @@ -188,10 +198,14 @@ class _UnionPage extends State ), setState(() { if (_mapController != null) { - _mapController.updateMapOptions(BMFMapOptions( - center: latLng, - zoomLevel: 15, - )); + _mapController.moveCamera( + CameraUpdate.newCameraPosition( + CameraPosition( + target: latLng, + zoom: 15.0, + ), + ), + ); } }) } @@ -221,7 +235,7 @@ class _UnionPage extends State storeList = (baseData.data as List) .map((e) => Store.fromJson(e)) .toList(); - // buildMarker(); + buildMarker(); refreshController.refreshCompleted(); if (mounted) setState(() {}); } else { @@ -229,20 +243,34 @@ class _UnionPage extends State } } - // buildMarker() async { - // markers.clear(); - // markers.addAll(storeList.map((element) => BMFMarker( - // position: BMFCoordinate(double.tryParse(element.latitude), - // double.tryParse(element.longitude)), - // centerOffset: BMFPoint(0.5, 0.9), - // enabled: false, - // icon: "assets/image/icon_map_marker.png", - // draggable: false, - // ))); - // if (mounted) setState(() {}); - // } - // - // List markers = []; + RepaintBoundary repaintBoundary; + + buildMarker() async { + markers.clear(); + + BitmapDescriptor bitmapDescriptor = await BitmapDescriptor.fromAssetImage( + ImageConfiguration( + bundle: DefaultAssetBundle.of(context), + devicePixelRatio: MediaQuery.of(context)?.devicePixelRatio ?? 1.0, + locale: Localizations.localeOf(context), + textDirection: Directionality.of(context), + size: Size(35.w, 35.h), + platform: defaultTargetPlatform, + ), + "assets/image/icon_map_marker.png"); + + markers.addAll(storeList.map((element) => Marker( + position: LatLng(double.tryParse(element.latitude), + double.tryParse(element.longitude)), + anchor: Offset(0.5, 0.9), + clickable: false, + icon: bitmapDescriptor, + infoWindowEnable: true, + ))); + if (mounted) setState(() {}); + } + + List markers = []; @override Widget build(BuildContext context) { @@ -262,7 +290,7 @@ class _UnionPage extends State PreferredSize( preferredSize: Size(double.infinity, 52.h), child: Container( - padding: EdgeInsets.only(top: 6.h), + padding: EdgeInsets.only(top: 26.5.h), color: Color(0xFFFAFAFA), child: ItemTitle( text: S.of(context).jingbilianmenghuiyuandian, @@ -278,17 +306,24 @@ class _UnionPage extends State // headerSliverBuilder: (context, inner) { // return [ // SliverOverlapAbsorber( - // sliver: buildSliverAppBar(BMFMapWidget( - // mapOptions: BMFMapOptions( - // center: BMFCoordinate(30.553111, 114.342366), - // zoomLevel: 12, + // sliver: buildSliverAppBar(AMapWidget( + // initialCameraPosition: CameraPosition( + // target: LatLng(30.553111, 114.342366), + // zoom: 12.0, // ), - // onBMFMapCreated: onMapCreated, - // // customStyleOptions: _customStyleOptions, - // // gestureRecognizers: >[ - // // Factory( - // // () => EagerGestureRecognizer()), - // // ].toSet(), + // onMapCreated: onMapCreated, + // apiKey: aMapApiKeys, + // touchPoiEnabled: true, + // markers: markers.toSet(), + // scrollGesturesEnabled: true, + // customStyleOptions: _customStyleOptions, + // onPoiTouched: (poiTouch) { + // FocusScope.of(context).requestFocus(FocusNode()); + // }, + // gestureRecognizers: >[ + // Factory( + // () => EagerGestureRecognizer()), + // ].toSet(), // )), // handle: // NestedScrollView.sliverOverlapAbsorberHandleFor(context), @@ -333,7 +368,7 @@ class _UnionPage extends State itemCount: storeList == null ? 0 : storeList.length, // padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h), padding: EdgeInsets.only( - top: 8.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), + top: 17.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { return GestureDetector( @@ -425,10 +460,10 @@ class _UnionPage extends State }); } - BMFMapController _mapController; + AMapController _mapController; TextEditingController editingController = TextEditingController(); - void onMapCreated(BMFMapController controller) { + void onMapCreated(AMapController controller) { _mapController = controller; } @@ -438,17 +473,16 @@ class _UnionPage extends State margin: EdgeInsets.fromLTRB(16.w, 40, 16.w, 0), padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(4)), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - ), + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(4)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ]), child: TextField( textInputAction: TextInputAction.search, onEditingComplete: () { @@ -479,81 +513,81 @@ class _UnionPage extends State ); } - // Widget buildSliverAppBar(BMFMapWidget map) { - // return SliverAppBar( - // // 滑上去时搜索隐藏 - // // floating: true, - // // snap: true, - // pinned: true, - // backgroundColor: Color(0xFFFAFAFA), - // elevation: 0, - // automaticallyImplyLeading: false, - // title: Container( - // height: 36.h, - // margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), - // padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), - // decoration: BoxDecoration( - // color: Colors.white, - // borderRadius: BorderRadius.all(Radius.circular(4)), - // boxShadow: [ - // BoxShadow( - // color: Colors.black.withAlpha(12), - // offset: Offset(0, 3), - // blurRadius: 14, - // spreadRadius: 0, - // ) - // ]), - // child: TextField( - // textInputAction: TextInputAction.search, - // onEditingComplete: () { - // startLocation(); - // }, - // controller: editingController, - // cursorHeight: 30.h, - // decoration: InputDecoration( - // contentPadding: EdgeInsets.symmetric(vertical: 12.h), - // prefixIcon: Icon( - // Icons.search, - // size: 24, - // color: Colors.black, - // ), - // suffixIcon: InkWell( - // onTap: () { - // editingController.clear(); - // }, - // child: Icon( - // Icons.close, - // size: 19, - // color: Colors.grey, - // ), - // ), - // border: InputBorder.none, - // ), - // ), - // ), - // flexibleSpace: FlexibleSpaceBar( - // background: Container( - // child: map, - // ), - // ), - // expandedHeight: 375.h, - // bottom: PreferredSize( - // preferredSize: Size(double.infinity, 52.h), - // child: Container( - // padding: EdgeInsets.only(top: 6.h), - // color: Color(0xFFFAFAFA), - // child: ItemTitle( - // text: S.of(context).jingbilianmenghuiyuandian, - // imgPath: "assets/image/icon_union_store.png", - // ), - // ), - // ), - // ); - // } + Widget buildSliverAppBar(AMapWidget map) { + return SliverAppBar( + // 滑上去时搜索隐藏 + // floating: true, + // snap: true, + pinned: true, + backgroundColor: Color(0xFFFAFAFA), + elevation: 0, + automaticallyImplyLeading: false, + title: Container( + height: 36.h, + margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 0), + padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(4)), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 3), + blurRadius: 14, + spreadRadius: 0, + ) + ]), + child: TextField( + textInputAction: TextInputAction.search, + onEditingComplete: () { + startLocation(); + }, + controller: editingController, + cursorHeight: 30.h, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric(vertical: 12.h), + prefixIcon: Icon( + Icons.search, + size: 24, + color: Colors.black, + ), + suffixIcon: InkWell( + onTap: () { + editingController.clear(); + }, + child: Icon( + Icons.close, + size: 19, + color: Colors.grey, + ), + ), + border: InputBorder.none, + ), + ), + ), + flexibleSpace: FlexibleSpaceBar( + background: Container( + child: map, + ), + ), + expandedHeight: 375.h, + bottom: PreferredSize( + preferredSize: Size(double.infinity, 52.h), + child: Container( + padding: EdgeInsets.only(top: 6.h), + color: Color(0xFFFAFAFA), + child: ItemTitle( + text: S.of(context).jingbilianmenghuiyuandian, + imgPath: "assets/image/icon_union_store.png", + ), + ), + ), + ); + } Widget buildStoreItem(Store store, position) { return Container( - margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), + margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 16.h), padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h), decoration: BoxDecoration( color: Colors.white, @@ -617,9 +651,6 @@ class _UnionPage extends State ), ], ), - SizedBox( - height: 4.h, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, @@ -658,10 +689,6 @@ class _UnionPage extends State ), ], ), - // Expanded( - // child: Container(), - // flex: 1, - // ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/pubspec.lock b/pubspec.lock index 098718fd..6dc89927 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.5.0" + version: "2.6.1" barcode: dependency: transitive description: @@ -886,7 +886,7 @@ packages: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.2.19" + version: "0.3.0" timing: dependency: transitive description: @@ -1049,7 +1049,7 @@ packages: name: win32 url: "https://pub.flutter-io.cn" source: hosted - version: "2.0.5" + version: "2.2.5" xdg_directories: dependency: transitive description: @@ -1072,5 +1072,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.13.0 <3.0.0" flutter: ">=2.0.0"