Browse Source

文章评论及点赞更改;

点赞数量后端接口需要更改;
null_safety
w-R 3 years ago
parent
commit
05f41d0e6d
  1. BIN
      assets/image/2x/icon_address_location.png
  2. BIN
      assets/image/icon_address_location.png
  3. 3
      ios/Runner/AppDelegate.mm
  4. 132
      lib/address/address_map_page.dart
  5. 2
      lib/home/home_page.dart
  6. 4
      lib/integral/integral_page.dart
  7. 2
      lib/login/login_page.dart
  8. 2
      lib/main.dart
  9. 2
      lib/mine/mine_page.dart
  10. 2
      lib/order/store_selector_page.dart
  11. 92
      lib/retrofit/data/memberCommentList.dart
  12. 16
      lib/retrofit/retrofit_api.dart
  13. 76
      lib/retrofit/retrofit_api.g.dart
  14. 372
      lib/union/store_details_page.dart
  15. 9
      lib/union/union_page.dart

BIN
assets/image/2x/icon_address_location.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 13 KiB

BIN
assets/image/icon_address_location.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 13 KiB

3
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<FlutterBinaryMessenger> *)controller];
@ -81,6 +81,7 @@
if ([method isEqual:@"action"]) {
if (remoteNotification != NULL) {
result(remoteNotification[@"custom"]);
remoteNotification = nil;
}
result(@"");
}

132
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<AddressMapPage> {
.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<AddressMapPage> {
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<dynamic> 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<AddressMapPage> {
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<AddressMapPage> {
}
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<AddressMapPage> {
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<AddressMapPage> {
startLocation();
},
child: Container(
width: 32.w,
height: 32.h,
width: 32,
height: 32,
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),

2
lib/home/home_page.dart

@ -83,7 +83,7 @@ class _HomePage extends State<HomePage> 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) {

4
lib/integral/integral_page.dart

@ -43,7 +43,7 @@ class _IntegralPage extends State<IntegralPage> {
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<IntegralPage> {
SmartDialog.show(
widget: SignInWidget("${signInfo.signInList.length + 1}",
"${signInfo.rewardList[signInfo.signInList.length]}"));
} else {
SmartDialog.dismiss();
}
}

2
lib/login/login_page.dart

@ -274,7 +274,7 @@ class _MyLoginPageState extends State<LoginPage> 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);

2
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);
}

2
lib/mine/mine_page.dart

@ -99,7 +99,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
List<Rank> 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();

2
lib/order/store_selector_page.dart

@ -119,7 +119,7 @@ class _StoreSelectorPage extends State<StoreSelectorPage> {
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();

92
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<String, dynamic> 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,
};
}

16
lib/retrofit/retrofit_api.dart

@ -297,4 +297,20 @@ abstract class ApiService {
@GET("/app-msg/{id}")
Future<BaseData> queryMsg(@Path("id") String id);
////
@GET("/information/likes/{id}")
Future<BaseData> informationLikes(@Path("id") String id);
///
@POST("/memberComment")
Future<BaseData> memberComment(@Body() Map<String, dynamic> param);
///
@POST("/memberComment/list")
Future<BaseData> memberCommentList(@Body() Map<String, dynamic> param);
////
@GET("/memberComment/likes/{id}")
Future<BaseData> commentLike(@Path("id") String id);
}

76
lib/retrofit/retrofit_api.g.dart

@ -817,4 +817,80 @@ class _ApiService implements ApiService {
final value = BaseData.fromJson(_result.data);
return value;
}
@override
Future<BaseData> informationLikes(id) async {
ArgumentError.checkNotNull(id, 'id');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>('/information/likes/$id',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(_result.data);
return value;
}
@override
Future<BaseData> memberComment(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'/memberComment',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(_result.data);
return value;
}
@override
Future<BaseData> memberCommentList(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'/memberComment/list',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(_result.data);
return value;
}
@override
Future<BaseData> commentLike(id) async {
ArgumentError.checkNotNull(id, 'id');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>('/memberComment/likes/$id',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(_result.data);
return value;
}
}

372
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<StoreDetailsPage> {
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<StoreDetailsPage> {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryHtml();
queryMemberCommentList();
});
}
Activity activity;
Article article;
List<MemberCommentList> 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<StoreDetailsPage> {
});
}
//
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<StoreDetailsPage> {
child: Column(
children: [
Container(
color: Color(0xFFF7F7F7),
padding: EdgeInsets.all(12),
alignment: Alignment.centerLeft,
child: Text(
@ -187,13 +269,16 @@ class _StoreDetailsPage extends State<StoreDetailsPage> {
),
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<StoreDetailsPage> {
},
},
),
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<StoreDetailsPage> {
);
}
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();

9
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<UnionPage>
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<UnionPage>
),
],
),
SizedBox(
height: 4.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
@ -665,6 +661,9 @@ class _UnionPage extends State<UnionPage>
),
],
),
SizedBox(
height: 4.h,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

Loading…
Cancel
Save