diff --git a/assets/image/2x/icon_address_location.png b/assets/image/2x/icon_address_location.png index 4985477d..a53449d1 100644 Binary files a/assets/image/2x/icon_address_location.png and b/assets/image/2x/icon_address_location.png differ diff --git a/assets/image/icon_address_location.png b/assets/image/icon_address_location.png index df185b36..a53449d1 100644 Binary files a/assets/image/icon_address_location.png and b/assets/image/icon_address_location.png differ diff --git a/ios/Runner/AppDelegate.mm b/ios/Runner/AppDelegate.mm index 005f3a64..4e2d7e3b 100644 --- a/ios/Runner/AppDelegate.mm +++ b/ios/Runner/AppDelegate.mm @@ -72,7 +72,7 @@ }]; // 消息内容获取 - NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; + __block NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; NSLog(@"notification dic: %@", remoteNotification); FlutterMethodChannel* bridgeAppChannel = [FlutterMethodChannel methodChannelWithName:@"bridge" binaryMessenger:(NSObject *)controller]; @@ -81,6 +81,7 @@ if ([method isEqual:@"action"]) { if (remoteNotification != NULL) { result(remoteNotification[@"custom"]); + remoteNotification = nil; } result(@""); } diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart index 5b9b153a..2a96c872 100644 --- a/lib/address/address_map_page.dart +++ b/lib/address/address_map_page.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:io'; +import 'dart:ui'; import 'package:android_intent_plus/android_intent.dart'; import 'package:dio/dio.dart'; @@ -82,7 +83,7 @@ class _AddressMapPage extends State { .then((value) { saveLatLng(value); if (_mapController != null) { - this.latLng = value; + this.latLng = Platform.isIOS ? value : latLng; addMarker(); _mapController.updateMapOptions( BMFMapOptions( @@ -141,43 +142,50 @@ class _AddressMapPage extends State { searchPoi(BMFCoordinate latLng) async { keyWord = textEditingController.text; - - 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 - .map((e) => Address.fromJson({ - "address": e.address, - "area": e.name, - "city": e.city, - "province": e.province, - "latitude": e.pt.latitude, - "longitude": e.pt.longitude, - "cityInfo": e.name, - "id": "", - "mid": "", - "phone": "", - "tag": "", - "username": "", - "isDefault": true, - })) - .toList(); - print("object112221: ${poiList.length}"); - setState(() { - time = DateTime.now().millisecondsSinceEpoch; - }); - // } - }); - bmfPoiNearbySearch.poiNearbySearch(BMFPoiNearbySearchOption( - keywords: ["all"], - radius: 100000, - location: latLng, - pageSize: 20, - pageIndex: 0, - isRadiusLimit: true, - )); + print("keyWord: ${keyWord}"); + var addressPoi = await apiService.searchPoi( + "${latLng.latitude}", "${latLng.longitude}", keyWord, 20, 1); + List poi = addressPoi['pois']; + poiList = poi + .map((e) => Address.fromJson({ + "address": e["address"] is List ? "" : e["address"], + "area": e["adname"], + "city": e["cityname"], + "province": e["pname"], + "latitude": e["location"].toString().split(",")[0], + "longitude": e["location"].toString().split(",")[1], + "cityInfo": e["name"], + "id": "", + "mid": "", + "phone": "", + "tag": "", + "username": "", + "isDefault": true, + })) + .toList(); + 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; @@ -191,7 +199,7 @@ class _AddressMapPage extends State { if (await Permission.location.isPermanentlyDenied) { requestDialog(); } else if (await Permission.location.isGranted) { - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); aMapFlutterLocation.startLocation(); Future.delayed(Duration(seconds: 6), () { SmartDialog.dismiss(); @@ -255,17 +263,28 @@ class _AddressMapPage extends State { } BMFMapController _mapController; + BMFCoordinate bmfCoordinate; void onMapCreated(BMFMapController controller) { controller.setMapRegionDidChangeCallback(callback: (status) { - center = status.targetGeoPt; - searchPoi(center); + 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(); }); @@ -282,20 +301,33 @@ class _AddressMapPage extends State { bmfMarker = BMFMarker( position: latLng, - screenPointToLock: BMFPoint(MediaQuery.of(context).size.width / 2, - MediaQuery.of(context).size.height / 4), + 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.9), + centerOffset: BMFPoint(0.5, 0.7), enabled: false, - icon: "assets/image/icon_map_marker.png", + icon: "assets/image/icon_address_location.png", draggable: false, ); _mapController.addMarker(bmfMarker); } bmfMarker.updateIsLockedToScreen( true, - BMFPoint(MediaQuery.of(context).size.width / 2, - MediaQuery.of(context).size.height / 4)); + 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 { @@ -379,8 +411,8 @@ class _AddressMapPage extends State { startLocation(); }, child: Container( - width: 32.w, - height: 32.h, + width: 32, + height: 32, padding: EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart index 2a8160ce..b5e766c0 100644 --- a/lib/home/home_page.dart +++ b/lib/home/home_page.dart @@ -83,7 +83,7 @@ class _HomePage extends State with AutomaticKeepAliveClientMixin { Founder founder; queryHome() async { - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); BaseData baseData = await apiService.queryBanner({ "model": {"type": "HOME_PAGE"}, }).catchError((onError) { diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart index f007ee62..656a85b5 100644 --- a/lib/integral/integral_page.dart +++ b/lib/integral/integral_page.dart @@ -43,7 +43,7 @@ class _IntegralPage extends State { token: value.getString("token"), showLoading: false); userinfo = UserInfo.fromJson(jsonDecode(value.getString("user"))); - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); querySignInfo(); }); } @@ -511,6 +511,8 @@ class _IntegralPage extends State { SmartDialog.show( widget: SignInWidget("${signInfo.signInList.length + 1}", "${signInfo.rewardList[signInfo.signInList.length]}")); + } else { + SmartDialog.dismiss(); } } diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart index 2ed589eb..e891ef0b 100644 --- a/lib/login/login_page.dart +++ b/lib/login/login_page.dart @@ -274,7 +274,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin { "capcha": code, "mobile": mobile, }; - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); BaseData value = await client.memberLogin(param).catchError((error) { print(error); SmartDialog.showToast("$error", alignment: Alignment.center); diff --git a/lib/main.dart b/lib/main.dart index c18695fe..b0a4e8e7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -120,7 +120,7 @@ initSdk() async { if(Platform.isIOS){ LocationFlutterPlugin.setApiKey("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); BMFMapSDK.setApiKeyAndCoordType( - '7IACaFNxOX2EMauupIZisjI8XSxe09ER', BMF_COORD_TYPE.BD09LL); + 'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR', BMF_COORD_TYPE.COMMON); } else if(Platform.isAndroid) { BMFMapSDK.setCoordType(BMF_COORD_TYPE.COMMON); } diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 368ee822..331e035f 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -99,7 +99,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { List ranks = []; queryUserInfo() async { - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); BaseData rankData = await apiService.rankList(); if (rankData != null && rankData.isSuccess) { ranks.clear(); diff --git a/lib/order/store_selector_page.dart b/lib/order/store_selector_page.dart index 3dd8027f..5282beb3 100644 --- a/lib/order/store_selector_page.dart +++ b/lib/order/store_selector_page.dart @@ -119,7 +119,7 @@ class _StoreSelectorPage extends State { if (await Permission.location.isPermanentlyDenied) { requestDialog(); } else if (await Permission.location.isGranted) { - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); aMapFlutterLocation.startLocation(); Future.delayed(Duration(seconds: 6), () { SmartDialog.dismiss(); diff --git a/lib/retrofit/data/memberCommentList.dart b/lib/retrofit/data/memberCommentList.dart new file mode 100644 index 00000000..c6f61edb --- /dev/null +++ b/lib/retrofit/data/memberCommentList.dart @@ -0,0 +1,92 @@ + +/// content : "" +/// createTime : "" +/// createUser : "0" +/// hidden : true +/// id : "0" +/// isDelete : 0 +/// likes : 0 +/// mid : "0" +/// parentContent : "" +/// parentId : "0" +/// parentMid : "0" +/// parentUserAvatarUrl : "" +/// parentUserName : "" +/// relationalId : "0" +/// relationalType : 0 +/// updateTime : "" +/// updateUser : "0" +/// userAvatarUrl : "" +/// username : "" + +class MemberCommentList { + String content; + String createTime; + String createUser; + bool hidden; + String id; + int isDelete; + int likes; + String mid; + String parentContent; + String parentId; + String parentMid; + String parentUserAvatarUrl; + String parentUserName; + String relationalId; + int relationalType; + String updateTime; + String updateUser; + String userAvatarUrl; + String username; + bool isFabulous; + + static MemberCommentList fromMap(Map map) { + if (map == null) return null; + MemberCommentList listBean = MemberCommentList(); + listBean.content = map['content']; + listBean.createTime = map['createTime']; + listBean.createUser = map['createUser']; + listBean.hidden = map['hidden']; + listBean.id = map['id']; + listBean.isDelete = map['isDelete']; + listBean.likes = map['likes']; + listBean.mid = map['mid']; + listBean.parentContent = map['parentContent']; + listBean.parentId = map['parentId']; + listBean.parentMid = map['parentMid']; + listBean.parentUserAvatarUrl = map['parentUserAvatarUrl']; + listBean.parentUserName = map['parentUserName']; + listBean.relationalId = map['relationalId']; + listBean.relationalType = map['relationalType']; + listBean.updateTime = map['updateTime']; + listBean.updateUser = map['updateUser']; + listBean.userAvatarUrl = map['userAvatarUrl']; + listBean.username = map['username']; + listBean.isFabulous = map['isFabulous']; + return listBean; + } + + Map toJson() => { + "content": content, + "createTime": createTime, + "createUser": createUser, + "hidden": hidden, + "id": id, + "isDelete": isDelete, + "likes": likes, + "mid": mid, + "parentContent": parentContent, + "parentId": parentId, + "parentMid": parentMid, + "parentUserAvatarUrl": parentUserAvatarUrl, + "parentUserName": parentUserName, + "relationalId": relationalId, + "relationalType": relationalType, + "updateTime": updateTime, + "updateUser": updateUser, + "userAvatarUrl": userAvatarUrl, + "username": username, + "isFabulous": isFabulous, + }; +} \ No newline at end of file diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 3f560aa5..c6c0f772 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -297,4 +297,20 @@ abstract class ApiService { @GET("/app-msg/{id}") Future queryMsg(@Path("id") String id); + ///给文章/活动点赞 + @GET("/information/likes/{id}") + Future informationLikes(@Path("id") String id); + + ///发布评论 + @POST("/memberComment") + Future memberComment(@Body() Map param); + + ///查询评论列表 + @POST("/memberComment/list") + Future memberCommentList(@Body() Map param); + + ///给文章/活动点赞 + @GET("/memberComment/likes/{id}") + Future commentLike(@Path("id") String id); + } diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 5b770fec..a9ebc20c 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -817,4 +817,80 @@ class _ApiService implements ApiService { final value = BaseData.fromJson(_result.data); return value; } + + @override + Future informationLikes(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/information/likes/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson(_result.data); + return value; + } + + @override + Future memberComment(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/memberComment', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson(_result.data); + return value; + } + + @override + Future memberCommentList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/memberComment/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson(_result.data); + return value; + } + + @override + Future commentLike(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/memberComment/likes/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson(_result.data); + return value; + } } diff --git a/lib/union/store_details_page.dart b/lib/union/store_details_page.dart index 0105c8a8..eeefe061 100644 --- a/lib/union/store_details_page.dart +++ b/lib/union/store_details_page.dart @@ -5,12 +5,16 @@ import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/image_render.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:huixiang/retrofit/data/memberCommentList.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/share_dialog.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:sharesdk_plugin/sharesdk_defines.dart'; import 'package:sharesdk_plugin/sharesdk_interface.dart'; @@ -36,10 +40,15 @@ class StoreDetailsPage extends StatefulWidget { class _StoreDetailsPage extends State { ApiService apiService; + RefreshController _refreshController; + bool isLiked = false; + int commentTotal = 0; + var commentTextController = TextEditingController(); @override void initState() { super.initState(); + _refreshController = RefreshController(); if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); @@ -47,23 +56,26 @@ class _StoreDetailsPage extends State { apiService = ApiService(Dio(), context: context, token: value.getString("token")); queryHtml(); + queryMemberCommentList(); }); } Activity activity; Article article; + List memberList = []; queryHtml() async { BaseData baseData = await apiService.informationInfo( widget.arguments["activityId"] ?? widget.arguments["articleId"]); if (baseData != null && baseData.isSuccess) { - if (widget.arguments.containsKey("activityId")) { - activity = Activity.fromJson(baseData.data); - } else if (widget.arguments.containsKey("articleId")) { - article = Article.fromJson(baseData.data); - } - setState(() {}); + setState(() { + if (widget.arguments.containsKey("activityId")) { + activity = Activity.fromJson(baseData.data); + } else if (widget.arguments.containsKey("articleId")) { + article = Article.fromJson(baseData.data); + } + }); } } @@ -124,6 +136,75 @@ class _StoreDetailsPage extends State { }); } + //评论列表 + queryMemberCommentList() async { + BaseData baseData = await apiService.memberCommentList({ + "pageNum": 1, + "pageSize": 100, + "relationalId": + widget.arguments["activityId"] ?? widget.arguments["articleId"], + "relationalType": 1 + }).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + PageInfo pageInfo = PageInfo.fromJson(baseData.data); + _refreshController.refreshCompleted(); + setState(() { + commentTotal = pageInfo.size; + memberList = + pageInfo.list.map((e) => MemberCommentList.fromMap(e)).toList(); + }); + } + } + + //评论点赞 + queryCommentLike(String id) async { + BaseData baseData = + await apiService.commentLike(id).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + memberList.forEach((element) { + if (element.id == id) { + element.likes += 1; + element.isFabulous = true; + } + }); + }); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + //给文章/活动点赞 + queryInformationLikes() async { + BaseData baseData = + await apiService.commentLike(widget.arguments["activityId"] ?? widget.arguments["articleId"]).catchError((onError) {}); + if (baseData != null && baseData.isSuccess) { + setState(() { + isLiked = true; + }); + } else { + SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + } + } + + //发布评论 + queryMemberComment(String content) async { + BaseData baseData = await apiService.memberComment({ + "content":content, + "parentId":0, + "relationalId":widget.arguments["activityId"] ?? widget.arguments["articleId"], + "relationalType": 1 + }).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + commentTextController.text = ""; + queryMemberCommentList(); + } + } + @override Widget build(BuildContext context) { return Scaffold( @@ -157,6 +238,7 @@ class _StoreDetailsPage extends State { child: Column( children: [ Container( + color: Color(0xFFF7F7F7), padding: EdgeInsets.all(12), alignment: Alignment.centerLeft, child: Text( @@ -187,13 +269,16 @@ class _StoreDetailsPage extends State { ), onTap: () { if (activity != null) { - if (widget.arguments["source"] != null - && widget.arguments["source"] == activity.storeId) { + if (widget.arguments["source"] != null && + widget.arguments["source"] == activity.storeId) { Navigator.of(context).pop(); } else { Navigator.of(context).pushNamed( '/router/union_detail_page', - arguments: {"id": activity.storeId, "source": widget.arguments["activityId"]}); + arguments: { + "id": activity.storeId, + "source": widget.arguments["activityId"] + }); } } }, @@ -271,6 +356,131 @@ class _StoreDetailsPage extends State { }, }, ), + Container( + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0) + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.all(16), + child: Row( + children: [ + Text("评论(${commentTotal.toString()})", + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0xff1A1A1A))), + SizedBox( + width: 16.w, + ), + Text("喜欢(${article?.likes??activity?.likes??"0"})", + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0xff1A1A1A))), + ], + ), + ), + ListView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemCount: memberList != null ? memberList.length : 0, + scrollDirection: Axis.vertical, + itemBuilder: (context, position) { + return GestureDetector( + onTap: () {}, + child: commentItem(memberList[position],position,memberList.length), + ); + }, + ), + ], + ), + ), + SizedBox( + height: 12.h, + ), + Container( + padding: EdgeInsets.all(16), + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0) + ], + borderRadius: new BorderRadius.only( + topLeft: Radius.circular(8.0), + topRight: Radius.circular(8.0), + ), + ), + child: Row( + children: [ + Expanded( + flex: 1, + child: Container( + decoration: new BoxDecoration( + color: Color(0xffF2F2F2), + borderRadius: BorderRadius.circular(2.0)), + child: Column( + children: [ + Container( + margin: const EdgeInsets.fromLTRB(4, 0, 4, 0), + alignment: Alignment.topLeft, + child: TextField( + maxLines: 8, + minLines: 1, + controller: commentTextController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: "留下您精彩的评论吧~", + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xffCDCCCC), + ), + ), + ), + ), + ], + ), + ), + ), + Padding( + padding: EdgeInsets.only(left: 20.w, right: 20.w), + child: GestureDetector( + onTap: (){ + var commentText = commentTextController.text; + if (commentText == "") { + return; + } + queryMemberComment(commentText); + }, + child:Text( + "发送", + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0XFF1A1A1A)), + ), + ), + ), + GestureDetector(onTap: (){ + queryInformationLikes(); + },child: Image.asset(isLiked?"assets/image/icon_like.png":"assets/image/icon_like_h.png"),) + ], + ), + ), ], ), ), @@ -329,6 +539,150 @@ class _StoreDetailsPage extends State { ); } + Widget commentItem(MemberCommentList memberList,int index,int max) { + return Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ClipOval( + child: Image.network( + memberList.userAvatarUrl, + fit: BoxFit.cover, + width: 40.w, + height: 40.h, + ), + clipBehavior: Clip.hardEdge, + ), + SizedBox( + width: 12.w, + ), + Expanded( + child: Container( + height: 60.h, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text.rich( + TextSpan(children: [ + TextSpan( + text: memberList.username, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 14.sp, + color: Colors.black), + ), + ]), + textDirection: TextDirection.ltr, + ), + Text( + memberList.createTime, + overflow: TextOverflow.ellipsis, + maxLines: 2, + style: TextStyle( + fontSize: 12.sp, + color: Color(0xff808080), + ), + ), + ], + ), + ), + flex: 1, + ), + Container( + alignment: Alignment.topRight, + child: Row( + children: [ + GestureDetector( + onTap: () { + queryCommentLike(memberList.id); + }, + child: Image.asset( + !(memberList.isFabulous ?? false) + ? "assets/image/icon_like_h.png" + : "assets/image/icon_like.png", + width: 16.w, + height: 16.h, + ), + ), + Text( + memberList.likes.toString(), + style: TextStyle( + fontSize: 12.sp, color: Color(0xff1A1A1A)), + ), + ], + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.only(left: 68, right: 16), + child: Align( + alignment: Alignment.centerLeft, + child: Text( + memberList.content, + style: TextStyle(fontSize: 14.sp, color: Color(0xff1A1A1A)), + ), + ), + ), + SizedBox( + height: 12.h, + ), + if(memberList.parentContent != null) + Container( + width: double.infinity, + margin: EdgeInsets.only(left: 68.w, right: 16.w), + decoration: new BoxDecoration( + color: Color(0xffF2F2F2), + borderRadius: BorderRadius.circular(2.0), + ), + child: Padding( + padding: EdgeInsets.only(left: 4.w, top: 4.h, bottom: 4.h), + child: Row( + children: [ + Text( + memberList.parentUserName??"", + style: TextStyle(fontSize: 12.sp, color: Color(0xff808080)), + ), + Text( + memberList.parentContent ?? "", + style: TextStyle(fontSize: 12.sp, color: Color(0xff808080)), + ), + ], + ), + ), + ), + if (index == max - 1) + Container( + height: 63.h, + decoration: BoxDecoration( + color: Color(0xffF2F2F2), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0) + ], + ), + margin: EdgeInsets.only(top: 30.h), + alignment: Alignment.center, + child: Text( + "-已显示全部评论-", + style: TextStyle(fontSize: 14.sp, color: Color(0xff353535)), + ), + ), + ], + ), + ); + } + @override void dispose() { if (chewieAudioController != null) chewieAudioController.dispose(); diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 74bd2220..7d6aea9c 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -25,7 +25,6 @@ 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'; @@ -366,7 +365,7 @@ class _UnionPage extends State requestDialog(); refreshController.refreshCompleted(); } else if (await Permission.location.isGranted) { - SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai, animationDurationTemp: Duration(seconds: 1)); aMapFlutterLocation.startLocation(); Future.delayed(Duration(seconds: 6), () { SmartDialog.dismiss(); @@ -624,9 +623,6 @@ class _UnionPage extends State ), ], ), - SizedBox( - height: 4.h, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, @@ -665,6 +661,9 @@ class _UnionPage extends State ), ], ), + SizedBox( + height: 4.h, + ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start,