Browse Source

Merge remote-tracking branch 'origin/remove_uniapp' into remove_uniapp

ff_new
fmk 3 years ago
parent
commit
923cc9a31c
  1. 24
      ios/Podfile.lock
  2. 5
      ios/Runner.xcodeproj/project.pbxproj
  3. 2
      ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  4. 136
      lib/community/community_child_list.dart
  5. 11
      lib/community/community_child_page.dart
  6. 1
      lib/community/community_details.dart
  7. 489
      lib/community/community_list.dart
  8. 5
      lib/community/community_page.dart
  9. 30
      lib/community/community_view/class_details_video.dart
  10. 7
      lib/community/community_view/community_dynamic.dart
  11. 10
      lib/community/headlines/article_list.dart
  12. 551
      lib/community/new_community_details.dart
  13. 18
      lib/community/photo_view_gallery_screen.dart
  14. 2
      lib/community/release_dynamic.dart
  15. 6
      lib/home/home_view/coupon.dart
  16. 6
      lib/home/home_view/featured_acticvity.dart
  17. 1
      lib/integral/integral_detailed_page.dart
  18. 5
      lib/main.dart
  19. 2
      lib/retrofit/retrofit_api.g.dart
  20. 8
      lib/settlement/settlement.dart
  21. 4
      lib/settlement/settlement_view/coupon.dart
  22. 2
      lib/settlement/settlement_view/settlement_coupon.dart
  23. 17
      lib/settlement/settlement_view/settlement_order_commodity.dart
  24. 100
      lib/store/store_order.dart
  25. 16
      lib/store/store_view/product_sku.dart
  26. 2
      lib/store/store_view/shop_goods.dart
  27. 7
      lib/store/store_view/store_order_list.dart
  28. 35
      lib/utils/ImgCachePath.dart
  29. 100
      lib/view_widget/custom_image.dart
  30. 2
      lib/view_widget/text_image_dialog.dart
  31. 51
      pubspec.lock
  32. 2
      pubspec.yaml

24
ios/Podfile.lock

@ -173,7 +173,7 @@ PODS:
- SDWebImage (5.12.1): - SDWebImage (5.12.1):
- SDWebImage/Core (= 5.12.1) - SDWebImage/Core (= 5.12.1)
- SDWebImage/Core (5.12.1) - SDWebImage/Core (5.12.1)
- shared_preferences (0.0.1): - shared_preferences_ios (0.0.1):
- Flutter - Flutter
- sharesdk_plugin (1.1.2): - sharesdk_plugin (1.1.2):
- Flutter - Flutter
@ -207,12 +207,12 @@ PODS:
- mob_sharesdk/ShareSDKPlatforms/Twitter - mob_sharesdk/ShareSDKPlatforms/Twitter
- mob_sharesdk/ShareSDKPlatforms/VKontakte - mob_sharesdk/ShareSDKPlatforms/VKontakte
- mob_sharesdk/ShareSDKPlatforms/WatermelonVideo - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo
- mob_sharesdk/ShareSDKPlatforms/WeChat_Lite
- mob_sharesdk/ShareSDKPlatforms/WhatsApp - mob_sharesdk/ShareSDKPlatforms/WhatsApp
- mob_sharesdk/ShareSDKPlatforms/Yixin - mob_sharesdk/ShareSDKPlatforms/Yixin
- mob_sharesdk/ShareSDKPlatforms/YouDaoNote - mob_sharesdk/ShareSDKPlatforms/YouDaoNote
- mob_sharesdk/ShareSDKRestoreScene - mob_sharesdk/ShareSDKRestoreScene
- mob_sharesdk/ShareSDKUI - mob_sharesdk/ShareSDKUI
- WechatOpenSDK_Fuck (~> 1.9.2)
- sqflite (0.0.2): - sqflite (0.0.2):
- Flutter - Flutter
- FMDB (>= 2.7.5) - FMDB (>= 2.7.5)
@ -248,7 +248,7 @@ DEPENDENCIES:
- path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider (from `.symlinks/plugins/path_provider/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- scan (from `.symlinks/plugins/scan/ios`) - scan (from `.symlinks/plugins/scan/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
- sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`) - sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- SSZipArchive (~> 2.4.2) - SSZipArchive (~> 2.4.2)
@ -298,8 +298,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler/ios" :path: ".symlinks/plugins/permission_handler/ios"
scan: scan:
:path: ".symlinks/plugins/scan/ios" :path: ".symlinks/plugins/scan/ios"
shared_preferences: shared_preferences_ios:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences_ios/ios"
sharesdk_plugin: sharesdk_plugin:
:path: ".symlinks/plugins/sharesdk_plugin/ios" :path: ".symlinks/plugins/sharesdk_plugin/ios"
sqflite: sqflite:
@ -321,13 +321,13 @@ SPEC CHECKSUMS:
AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce
BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8 BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8
BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db
flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16 flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16
flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d
flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a
flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c
fluwx: c192ef1ea3617badb813fa1a761ffc5c9c12208a fluwx: 02670633ce7509206f62b366e9734e7dda81e100
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451 image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451
mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c
@ -337,17 +337,17 @@ SPEC CHECKSUMS:
permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0
scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86
SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32
sharesdk_plugin: 5a59e49d2d5e55c8e8f67cc9ddf05172c2494a6b sharesdk_plugin: 31d5b9be9522985da8e3a90ff73f6e12e62f9049
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2 SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2
thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad thumbnails: df4b2db0d4030d134e7665da9c3060b0d78726fe
TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb
tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232
WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98 WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98
ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736

5
ios/Runner.xcodeproj/project.pbxproj

@ -674,7 +674,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1020; LastUpgradeCheck = 1300;
ORGANIZATIONNAME = ""; ORGANIZATIONNAME = "";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
@ -994,7 +994,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",
@ -1232,7 +1231,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",
@ -1361,7 +1359,6 @@
"-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"", "-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"", "-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"", "-l\"sqflite\"",
"-l\"sqlite3\"", "-l\"sqlite3\"",
"-l\"video_player\"", "-l\"video_player\"",

2
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1020" LastUpgradeVersion = "1300"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

136
lib/community/community_child_list.dart

@ -0,0 +1,136 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'community_list.dart';
class CommunityChildList extends StatefulWidget {
final String typeStr;
CommunityChildList(this.typeStr);
@override
State<StatefulWidget> createState() {
return _CommunityChildList();
}
}
class _CommunityChildList extends State<CommunityChildList> {
RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
ApiService apiService;
int pageNum = 1;
String userId;
bool isLoadMore = false;
List<ComunityComment> comments = [];
@override
void initState() {
super.initState();
_onRefresh();
}
_onRefresh() async {
setState(() {});
}
///
queryCommunity() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
userId = value.getString('userId');
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
if(isLoadMore){
pageNum += 1;
isLoadMore = false;
}else pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false,
"pageNum": pageNum,
"pageSize": 10,
"searchKey": ""
}).catchError((error) {
refreshController.refreshFailed();
refreshController.loadFailed();
});
refreshController.refreshCompleted();
refreshController.loadComplete();
if (baseData.isSuccess) {
if (pageNum == 1) {
comments.clear();
}
comments.addAll(baseData.data.list);
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime));
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
}
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: queryCommunity(),
builder: (context, position) {
return SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onLoading: () {
isLoadMore = true;
setState(() {});
},
scrollController: scrollController,
child: Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
// color: Color(0xFFF7F7F7),
// margin: EdgeInsets.only(top: 16.h),
child: Column(
children: [
CommunityList(
comments,
userId,
0,
isList: true,
exitFull: () {
setState(() {
_onRefresh();
});
},
),
],
),
),
),
),
);
},
);
}
}

11
lib/community/community_child_page.dart

@ -27,8 +27,9 @@ class CommunityChildPage extends StatefulWidget {
class _CommunityChildPage extends State<CommunityChildPage> { class _CommunityChildPage extends State<CommunityChildPage> {
RefreshController refreshController = RefreshController(); RefreshController refreshController = RefreshController();
ApiService apiService; ApiService apiService;
int pageNum = 0; int pageNum = 1;
String userId; String userId;
bool isLoadMore = false;
List<Article> articles = []; List<Article> articles = [];
@ -39,7 +40,6 @@ class _CommunityChildPage extends State<CommunityChildPage> {
} }
_onRefresh() async { _onRefresh() async {
pageNum = 0;
setState(() {}); setState(() {});
} }
@ -54,7 +54,11 @@ class _CommunityChildPage extends State<CommunityChildPage> {
token: value.getString("token"), token: value.getString("token"),
); );
} }
pageNum += 1; if(isLoadMore){
pageNum += 1;
isLoadMore = false;
}
else pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({ BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": widget.typeStr == "关注" ? true : false, "onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false, "onlyMe": false,
@ -113,6 +117,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
), ),
onRefresh: _onRefresh, onRefresh: _onRefresh,
onLoading: () { onLoading: () {
isLoadMore = true;
setState(() {}); setState(() {});
}, },
child: ListView.builder( child: ListView.builder(

1
lib/community/community_details.dart

@ -6,7 +6,6 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/member_comment_list.dart'; import 'package:huixiang/retrofit/data/member_comment_list.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';

489
lib/community/community_list.dart

@ -0,0 +1,489 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/community/photo_view_gallery_screen.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CommunityList extends StatefulWidget {
final List<ComunityComment> comments;
final String userId;
final int commentType;
final bool isList;
final Function exitFull;
CommunityList(
this.comments,
this.userId,
this.commentType,{
this.isList = false,
this.exitFull,
}
);
@override
State<StatefulWidget> createState() {
return _CommunityList();
}
}
class _CommunityList extends State<CommunityList> {
ApiService apiService;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(),
context: context, token: value.getString("token")),
});
}
////
_vipFollow(followId, isFollow) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
widget.exitFull();
SmartDialog.showToast(isFollow ? "关注成功" : "取关成功",
alignment: Alignment.center);
setState(() {});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
///
_deleteDynamic(id) async {
BaseData baseData = await apiService.deleteTrend(id);
if (baseData != null && baseData.isSuccess) {
widget.exitFull();
SmartDialog.showToast("删除成功", alignment: Alignment.center);
setState(() {});
} else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
Widget build(BuildContext context) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ListView.builder(
padding: EdgeInsets.zero,
itemCount: widget.comments.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/new_community_details', arguments: {
"commentsId": widget.comments[position].id,
"userId":widget.userId,
// exitFull: () {
// setState(() {});
// },
});
setState(() {});
},
child: communityItem(widget.comments[position], position),
);
},
),
],
));
}
///
Widget buildMedia(SubjectInfo subjectInfo, position) {
if (subjectInfo == null) {
return Container();
}
Widget itemWidget = Container();
if (subjectInfo.type == "image" && subjectInfo.images.length > 0) {
if (subjectInfo.images.length == 1) {
itemWidget = Container(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: subjectInfo.images, //list
index: 0, //index
)));
},
child: MImage(
subjectInfo.images[0],
fit: BoxFit.contain,
radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width/1.5,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
)),
);
} else {
itemWidget = GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: (subjectInfo.images.length == 2 ||
subjectInfo.images.length == 4)
? 2
: 3,
crossAxisSpacing: 12.w,
mainAxisSpacing: 12.w,
childAspectRatio: 1,
),
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return Container(
child: InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: subjectInfo.images, //list
index: position, //index
)));
},
child: MImage(
subjectInfo.images[position],
fit: BoxFit.cover,
aspectRatio: 1,
radius: BorderRadius.circular(1),
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
),
);
},
itemCount: subjectInfo.images.length,
);
}
} else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) {
itemWidget = Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width / 7 * 5,
color: Colors.black,
child: Stack(
children: [
Container(
width: double.infinity,
height: double.infinity,
child: MImage(
subjectInfo.video.replaceAll(".mp4", "_poster.jpg"),
fit: BoxFit.cover,
radius: BorderRadius.circular(2),
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
),
Center(
child: Icon(
Icons.play_circle_outline,
color: Colors.white,
size: 60,
),
),
],
),
);
}
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 16.h,
),
itemWidget,
],
);
}
Widget communityItem(ComunityComment comments, position) {
return Container(
width: double.infinity,
padding: EdgeInsets.all(16),
margin: EdgeInsets.only(bottom: 12),
color: Colors.white,
child: Column(
children: [
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 44,
child: Row(
children: [
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PhotoViewGalleryScreen(
images: [
(comments?.memberInfo?.avatar ?? "")
.isEmpty
? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"
: comments?.memberInfo?.avatar
], //list
index: 0, //index
),
));
},
child: MImage(
(comments?.memberInfo?.avatar ??
"https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"),
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
SizedBox(
width: 8,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
comments?.memberInfo?.nickname ?? "",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A),
),
),
Text(
comments?.createTime ?? "",
style: TextStyle(
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF808080),
),
),
],
),
],
),
),
if ((comments?.memberInfo?.mid ?? "") != (widget.userId))
GestureDetector(
onTap: () {
setState(() {
if (widget.commentType == 0) {
comments.selfFollow = !(comments.selfFollow ?? false);
_vipFollow(comments?.memberInfo?.mid,comments?.selfFollow ?? false);
} else {
showDeleteDialog(position);
}
});
},
child:
(widget.commentType == 0) ?
Container(
width: 56.w,
height: 25.h,
alignment: Alignment.center,
child: RoundButton(
height: 25.h,
backgroup: (comments?.selfFollow ?? false)
? Color(0xFFE6E6E6)
: Color(0xFF32A060),
textColor: (comments?.selfFollow ?? false)
? Color(0xFF808080)
: Colors.white,
text: (comments?.selfFollow ?? false)
? "已关注"
: "关注",
radius: 20,
icons: Icon(
(comments?.selfFollow ?? false)
? Icons.check
: Icons.add,
color: (comments?.selfFollow ?? false)
? Color(0xFF808080)
: Colors.white,
size: 15,
),
))
: Padding(
padding: EdgeInsets.all(20),
child: Icon(
Icons.close,
color: Colors.black,
size: 16,
),
),
),
],
),
SizedBox(
height: 12.h,
),
Text(
comments.subject ?? "",
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
),
),
buildMedia(comments?.subjectInfo, position),
// if (!widget.isDetails)
SizedBox(
height: 12.h,
),
// if (!comments.isDetails)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconText(
"${comments?.viewers ?? ""}",
space: 4.w,
leftImage: "assets/svg/liulanliang.svg",
iconSize: 16,
textStyle: TextStyle(
fontSize: 14.sp,
),
),
IconText(
"${comments.comments ?? 0}",
space: 4.w,
leftImage: "assets/svg/pinglun.svg",
iconSize: 16,
textStyle: TextStyle(
fontSize: 14.sp,
),
),
GestureDetector(
onTap: () {},
child: IconText(
"${comments.likes ?? 0}",
space: 4.w,
leftImage: "assets/svg/xihuan.svg",
iconSize: 16,
textStyle: TextStyle(
fontSize: 14.sp,
),
),
),
],
),
],
),
),
],
),
);
}
///
showDeleteDialog(index) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 130.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"确定要删除这条动态?",
style: TextStyle(
fontSize: 17.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(
height: 30.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: "取消",
textColor: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF32A060),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: "确定",
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
_deleteDynamic(widget.comments[index].id);
Navigator.of(context).pop();
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
}

5
lib/community/community_page.dart

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:huixiang/community/community_child_list.dart';
import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/community/community_child_page.dart';
import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
@ -20,6 +21,8 @@ class _CommunityPage extends State<CommunityPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TabController tabcontroller; TabController tabcontroller;
CommunityChildPage guanzhu,tuijian ;
List<String> lables = [ List<String> lables = [
"关注", "关注",
"推荐", "推荐",
@ -108,7 +111,7 @@ class _CommunityPage extends State<CommunityPage>
return CommunityCourse(); return CommunityCourse();
} }
else { else {
return CommunityChildPage(e); return CommunityChildList(e);
} }
}).toList(), }).toList(),
controller: tabcontroller, controller: tabcontroller,

30
lib/community/community_view/class_details_video.dart

@ -11,6 +11,7 @@ class ClassDetailsVideo extends StatefulWidget {
final bool isShowImg; final bool isShowImg;
final Function exitFull; final Function exitFull;
final String coverImg; final String coverImg;
final String videoUrl;
ClassDetailsVideo( ClassDetailsVideo(
{ {
@ -19,7 +20,8 @@ class ClassDetailsVideo extends StatefulWidget {
this.isShowImg, this.isShowImg,
this.exitFull, this.exitFull,
this.heightFun, this.heightFun,
this.coverImg this.coverImg,
this.videoUrl
}) : super(key: key); }) : super(key: key);
@override @override
@ -41,6 +43,9 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
SystemChrome.setPreferredOrientations([ SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp, DeviceOrientation.portraitUp,
]); ]);
if(widget.videoUrl != null){
initVideo(widget.videoUrl);
}
} }
@override @override
@ -91,14 +96,11 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
key: globalKey,child:videoWidget( key: globalKey,child:(videoPlayerController?.value?.isInitialized ?? false) ?videoWidget(
MediaQuery.of(context).size.width, MediaQuery.of(context).size.width,
videoPlayerController != null (MediaQuery.of(context).size.width/videoPlayerController.value.aspectRatio)-43,
? (MediaQuery.of(context).size.width) / widget.coverImg,
videoPlayerController.value.aspectRatio ):Container());
: MediaQuery.of(context).size.width / 2,
widget.coverImg,
));
} }
@override @override
@ -129,15 +131,16 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
? Container( ? Container(
color: Colors.black, color: Colors.black,
width: width, width: width,
// height: // height: width / 7 * 5,
height: width / 7 * 5, height: height,
child: chewies = Chewie( child: chewies = Chewie(
controller: chewieAudioController, controller: chewieAudioController,
), ),
) )
: Container( : Container(
width: width, width: width,
height:width / 7 * 5, // height:width / 7 * 5,
height: height,
)), )),
if (widget.isShowImg) if (widget.isShowImg)
GestureDetector( GestureDetector(
@ -150,7 +153,8 @@ class ClassDetailsVideoState extends State<ClassDetailsVideo> {
}, },
child: Container( child: Container(
width: width, width: width,
height: width / 7 * 5, // height: width / 7 * 5,
height: height,
color: Colors.black, color: Colors.black,
child: Stack( child: Stack(
children: [ children: [

7
lib/community/community_view/community_dynamic.dart

@ -185,7 +185,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
}, },
child: child:
MImage( MImage(
(widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg") + "?imageView2/1/w/200/h/200/format/jpg/q/75", (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"),
width: 44, width: 44,
height: 44, height: 44,
isCircle: true, isCircle: true,
@ -368,11 +368,10 @@ class _CommunityDynamic extends State<CommunityDynamic> {
); );
}, },
child: MImage( child: MImage(
cnt["images"][0].replaceAll(".jpg", ".jpg?imageView2/0/q/75"), cnt["images"][0],
fit: BoxFit.contain, fit: BoxFit.contain,
radius: BorderRadius.circular(2), radius: BorderRadius.circular(2),
width: MediaQuery.of(context).size.width/1.5, height:MediaQuery.of(context).size.width/1.5,
height:MediaQuery.of(context).size.width,
errorSrc: "assets/image/default_2_1.png", errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png",
)), )),

10
lib/community/headlines/article_list.dart

@ -1,20 +1,10 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/banner.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/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/hot_item.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';

551
lib/community/new_community_details.dart

@ -0,0 +1,551 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/community/photo_view_gallery_screen.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/member_comment_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/tips_dialog.dart';
import 'package:huixiang/web/web_view/comment_list.dart';
import 'package:huixiang/web/web_view/input_comment.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'dart:ui';
import 'community_view/class_details_video.dart';
class NewCommunityDetails extends StatefulWidget {
final Map<String, dynamic> arguments;
NewCommunityDetails({this.arguments});
@override
State<StatefulWidget> createState() {
return _NewCommunityDetails();
}
}
class _NewCommunityDetails extends State<NewCommunityDetails> with WidgetsBindingObserver {
ApiService apiService;
final GlobalKey commentKey = GlobalKey();
final GlobalKey videoKey = GlobalKey();
double height = 0;
final ScrollController scrollController = ScrollController();
bool isKeyBoardShow = false;
double commentHeight = 60.h;
var commentFocus = FocusNode();
String parenId = "0";
String hintText = S.current.liuxianinjingcaidepinglunba;
final GlobalKey inputKey = GlobalKey();
final TextEditingController commentTextController = TextEditingController();
int commentTotal = 0;
List<MemberCommentList> memberList = [];
bool isShowImg = true;
Article article;
String commentsId;
String userId;
@override
void initState() {
super.initState();
commentsId = widget.arguments["commentsId"];
userId = widget.arguments["userId"];
WidgetsBinding.instance.addObserver(this);
queryDetails(commentsId);
}
///
queryDetails(id) async {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
BaseData<Article> baseData = await apiService.informationInfo(id)
.catchError((onError) {
debugPrint(onError.toString());
});
if (baseData != null && baseData.isSuccess) {
setState(() {
article = baseData.data;
});
}
}
////
_vipFollow(followId, isFollow) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast(isFollow ? "关注成功" : "取关成功",
alignment: Alignment.center);
setState(() {});
} else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
@override
void didChangeMetrics() {
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return;
if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (isKeyBoardShow) {
FocusScope.of(context).requestFocus(FocusNode());
if (mounted)
setState(() {
hintText = S.current.liuxianinjingcaidepinglunba;
isKeyBoardShow = false;
});
}
} else {
if (mounted)
setState(() {
isKeyBoardShow = true;
});
}
});
}
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle.light,
child: Material(child: Scaffold(
appBar: MyAppBar(
title: "动态详情",
titleColor: Colors.black,
titleSize: 18.sp,
background: Colors.white,
leading: true,
leadingColor: Colors.black,
),
body: Container(
margin: EdgeInsets.only(top:2.h),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
Container(
padding: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: 44,
child: Row(
children: [
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: [
(article?.authorHeadImg ?? "")
.isEmpty
? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"
: article?.authorHeadImg
], //list
index: 0, //index
),
));
},
child: MImage(
(article?.authorHeadImg ??
""),
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
SizedBox(
width: 8,
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
article?.authorName ?? "",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF1A1A1A),
),
),
Text(
article?.createTime ?? "",
style: TextStyle(
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF808080),
),
),
],
),
],
),
),
if (article?.updateUser != userId)
GestureDetector(
onTap: () {
setState(() {
article.liked =
!(article.liked ?? false);
_vipFollow(article.updateUser,
article.liked ?? false);
});
},
child:
Container(
width: 56.w,
height: 25.h,
alignment: Alignment.center,
child: RoundButton(
height: 25.h,
backgroup: (article?.liked ?? false)
? Color(0xFFE6E6E6)
: Color(0xFF32A060),
textColor: (article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
text: (article?.liked ?? false)
? "已关注"
: "关注",
radius: 20,
icons: Icon(
(article?.liked ?? false)
? Icons.check
: Icons.add,
color: (article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
size: 15,
),
))
),
],
),
SizedBox(
height: 12.h,
),
Text(
article?.mainTitle ?? "",
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF1A1A1A),
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
),
),
buildMedia(article?.content),
],
),
),
CommentList(
commentKey,
article?.likes ?? 0,
commentsId,
4,
isKeyBoardShow,
_reply,
_delCommentTips,
12.sp,
requestApiFinish: (total){setState(() {
commentTotal = total;
});},
),
if (memberList == null || memberList.length == 0)
Container(
width: double.infinity,
alignment: Alignment.topCenter,
margin: EdgeInsets.only(top: 40),
padding: EdgeInsets.all(22.h),
child: Text(
S.of(context)
.zanwupinglun,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.bold,
color: Color(0xFFA0A0A0),
),
),
),
],
),
),
flex: 1,
),
///
InputComment(
inputKey,
hintText,
isKeyBoardShow,
commentFocus,
commentTextController,
_toComment,
_queryMemberComment,
_queryInformationLikes,
isLike: article?.liked ?? false,
),
],
),
),
),)
);
}
///
Widget buildMedia(String subjectInfo) {
if (subjectInfo == null || !subjectInfo.startsWith("{")) {
return Container();
}
var cnt = jsonDecode(subjectInfo);
Widget itemWidget = Container();
if (cnt["type"] == "image" &&
cnt["images"] != null &&
cnt["images"].length > 0) {
if (cnt["images"].length == 1) {
itemWidget = Container(
child: InkWell(
onTap: () {
// ImagePickers.previewImages(subjectInfo.images,0);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: cnt["images"], //list
index: 0, //index
),
),
);
},
child: MImage(
cnt["images"][0],
radius: BorderRadius.circular(2),
fit: BoxFit.contain,
width: MediaQuery.of(context).size.width / 1.5,
height: MediaQuery.of(context).size.width,
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
)),
);
} else {
itemWidget = GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount:
(cnt["images"].length == 2 || cnt["images"].length == 4)
? 2
: 3,
crossAxisSpacing: 12.w,
mainAxisSpacing: 12.w,
childAspectRatio: 1,
),
padding: EdgeInsets.zero,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return Container(
child: InkWell(
onTap: () {
// ImagePickers.previewImages(subjectInfo.images, position);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: cnt["images"], //list
index: position, //index
),
),
);
},
child: MImage(
cnt["images"][position],
fit: BoxFit.cover,
aspectRatio: 1,
radius: BorderRadius.circular(1),
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
),
);
},
itemCount: cnt["images"].length,
);
}
} else if (cnt["type"] == "video" &&
cnt["video"] != null &&
cnt["video"].isNotEmpty) {
itemWidget = Container(
child:ClassDetailsVideo(key:videoKey,exitFull: (){setState(() {});},
coverImg: cnt["video"].toString().replaceAll(".mp4", "_poster.jpg"),isShowImg: this.isShowImg,
changeShowImg: (isShowImg){setState(() {
this.isShowImg = isShowImg;
});},videoUrl: cnt["video"],
heightFun: (height) {
this.height =
height +
MediaQuery
.of(context)
.padding
.top +
kToolbarHeight +
24;
if (mounted) setState(() {});
},)
);
}
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 16.h,
),
itemWidget,
],
);
}
////
_queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes(commentsId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
commentKey.currentState.setState(() {});
setState(() {
if (article?.liked ?? false)
article?.likes -= 1;
else
article?.likes += 1;
article?.liked = !(article.liked ?? false);
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
///
_queryMemberComment(String content) async {
BaseData baseData = await apiService.memberComment({
"content": content,
"parentId": parenId,
"relationalId": commentsId,
"relationalType":4
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState;
state.queryMemberCommentList();
commentTextController.text = "";
FocusScope.of(context).unfocus();
_queryMemberCommentList();
}
}
///
_toComment() {
if (commentKey.currentContext == null) return;
RenderBox firstRenderBox = commentKey.currentContext.findRenderObject();
Offset first = firstRenderBox.localToGlobal(Offset.zero);
scrollController.animateTo(
first.dy +
scrollController.offset -
(kToolbarHeight + MediaQuery
.of(context)
.padding
.top),
duration: Duration(milliseconds: 300),
curve: Curves.easeIn,
);
}
contentHeight() {
double contentHeight = MediaQuery
.of(context)
.size
.height -
kToolbarHeight -
MediaQuery
.of(context)
.padding
.top -
160.h;
if ((contentHeight - 60.h) > (128.h * memberList.length)) {
commentHeight = contentHeight - (128.h * memberList.length);
}
}
///
_delCommentTips(memberComment) {
SmartDialog.show(widget: Tips(() {
delComment(memberComment);
}));
}
///
delComment(memberComment) async {
BaseData baseData = await apiService.delComment(memberComment.id);
if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState;
state.queryMemberCommentList();
}
}
///
_reply(memberComment) {
FocusScope.of(context).requestFocus(commentFocus);
parenId = memberComment.id;
hintText = S.of(context).huifu_("${memberComment.username}");
}
///
_queryMemberCommentList() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: sharedPreferences.getString("token"),
showLoading: false,
);
BaseData<PageInfo<MemberCommentList>> baseData =
await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId": commentsId,
"relationalType":4,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size;
memberList = baseData.data.list;
contentHeight();
if (mounted) setState(() {});
}
}
}

18
lib/community/photo_view_gallery_screen.dart

@ -1,6 +1,9 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart'; import 'package:huixiang/utils/ImgCachePath.dart';
import 'package:network_to_file_image/network_to_file_image.dart';
import 'package:photo_view/photo_view_gallery.dart'; import 'package:photo_view/photo_view_gallery.dart';
import 'package:path/path.dart' as p;
class PhotoViewGalleryScreen extends StatefulWidget { class PhotoViewGalleryScreen extends StatefulWidget {
List images=[]; List images=[];
@ -25,7 +28,10 @@ class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
super.initState(); super.initState();
currentIndex=widget.index; currentIndex=widget.index;
} }
File fileFromDocsDir(String filename) {
String pathName = p.join(ImgCachePath.instance.path, filename);
return File(pathName);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -41,8 +47,12 @@ class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
scrollPhysics: const BouncingScrollPhysics(), scrollPhysics: const BouncingScrollPhysics(),
builder: (BuildContext context, int index) { builder: (BuildContext context, int index) {
return PhotoViewGalleryPageOptions( return PhotoViewGalleryPageOptions(
imageProvider: NetworkImage(widget.images[index]), imageProvider: NetworkToFileImage(
url: widget.images[index],
file: fileFromDocsDir(widget.images[index].toString()
.replaceAll("https://pos.upload.gznl.top/", "").replaceAll("/", "")),
debug: true,
),
); );
}, },
itemCount: widget.images.length, itemCount: widget.images.length,

2
lib/community/release_dynamic.dart

@ -110,7 +110,7 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 14.sp, fontSize: 14.sp,
color: Colors.black, color: Color(0xFFA0A0A0),
), ),
),) ),)
], ],

6
lib/home/home_view/coupon.dart

@ -87,12 +87,12 @@ class _CouponView extends State<CouponView> {
Widget couponItem(Coupon coupon) { Widget couponItem(Coupon coupon) {
return Container( return Container(
width: 0.9.sw, width: 0.9,
height: 122.h, height: 122.h,
child: Stack( child: Stack(
children: [ children: [
Container( Container(
width: 0.9.sw, width: 0.9,
height: 122.h, height: 122.h,
child: SvgPicture.asset( child: SvgPicture.asset(
"assets/svg/youhuiquan_bg.svg", "assets/svg/youhuiquan_bg.svg",
@ -102,7 +102,7 @@ class _CouponView extends State<CouponView> {
), ),
), ),
Container( Container(
width: 0.9.sw, width: 0.9,
height: 122.h, height: 122.h,
child: Row( child: Row(
children: [ children: [

6
lib/home/home_view/featured_acticvity.dart

@ -119,9 +119,9 @@ class _FeaturedActivity extends State<FeaturedActivity> {
), ),
), ),
), ),
SizedBox( // SizedBox(
height: 5, // height: 5,
), // ),
// GestureDetector( // GestureDetector(
// onTap: () { // onTap: () {
// Navigator.of(context).pushNamed('/router/web_page', // Navigator.of(context).pushNamed('/router/web_page',

1
lib/integral/integral_detailed_page.dart

@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/my_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';

5
lib/main.dart

@ -55,6 +55,7 @@ import 'package:huixiang/store/store_order.dart';
import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/settlement/settlement.dart';
import 'package:huixiang/test_page.dart'; import 'package:huixiang/test_page.dart';
import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/union/location_map_page.dart';
import 'package:huixiang/utils/ImgCachePath.dart';
import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/web/web_page.dart';
import 'package:huixiang/union/union_details_page.dart'; import 'package:huixiang/union/union_details_page.dart';
@ -70,6 +71,7 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'community/community_view/class_details.dart'; import 'community/community_view/class_details.dart';
import 'community/headlines/headlines_column_details.dart'; import 'community/headlines/headlines_column_details.dart';
import 'community/new_community_details.dart';
import 'community/photo_view_gallery_screen.dart'; import 'community/photo_view_gallery_screen.dart';
import 'home/guide_page.dart'; import 'home/guide_page.dart';
import 'home/home_view/activity_list.dart'; import 'home/home_view/activity_list.dart';
@ -102,6 +104,7 @@ void main() async {
} else { } else {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} }
ImgCachePath();
initSdk(); initSdk();
bool isFirst = sharedPreferences.getBool("isFirst"); bool isFirst = sharedPreferences.getBool("isFirst");
@ -302,6 +305,8 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(), '/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(),
'/router/community_details': (context, {arguments}) => '/router/community_details': (context, {arguments}) =>
CommunityDetails(arguments: arguments), CommunityDetails(arguments: arguments),
'/router/new_community_details': (context, {arguments}) =>
NewCommunityDetails(arguments: arguments),
'/router/user_info_page': (context, {arguments}) => UserInfoPage(), '/router/user_info_page': (context, {arguments}) => UserInfoPage(),
'/router/recharge_page': (context, {arguments}) => RechargePage(), '/router/recharge_page': (context, {arguments}) => RechargePage(),
'/router/mine_wallet': (context, {arguments}) => MineWalletPage(), '/router/mine_wallet': (context, {arguments}) => MineWalletPage(),

2
lib/retrofit/retrofit_api.g.dart

@ -9,7 +9,7 @@ part of 'retrofit_api.dart';
class _ApiService implements ApiService { class _ApiService implements ApiService {
_ApiService(this._dio, {this.baseUrl}) { _ApiService(this._dio, {this.baseUrl}) {
ArgumentError.checkNotNull(_dio, '_dio'); ArgumentError.checkNotNull(_dio, '_dio');
baseUrl ??= 'http://192.168.10.142:8766/app/'; baseUrl ??= 'http://192.168.10.236:8766/app/';
} }
final Dio _dio; final Dio _dio;

8
lib/settlement/settlement.dart

@ -307,7 +307,9 @@ class _Settlement extends State<Settlement> {
} }
BaseData<WxPay> baseData = await minService BaseData<WxPay> baseData = await minService
.settlementWx(placeOrderFirst.toJson()) .settlementWx(placeOrderFirst.toJson())
.catchError((error) {}); .catchError((error) {
print(error);
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = baseData.data;
await registerWxApi( await registerWxApi(
@ -332,7 +334,9 @@ class _Settlement extends State<Settlement> {
} else { } else {
BaseData baseData = await minService BaseData baseData = await minService
.settlementApi(placeOrderFirst.toJson()) .settlementApi(placeOrderFirst.toJson())
.catchError((error) {}); .catchError((error) {
print(error);
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
} else { } else {

4
lib/settlement/settlement_view/coupon.dart

@ -171,8 +171,8 @@ class _CouponWidget extends State<CouponWidget> {
}, },
child: Image.asset( child: Image.asset(
widget.selected widget.selected
? "assets/image/icon_radio_unselected.png" ? "assets/image/icon_radio_selected.png"
: "assets/image/icon_radio_selected.png", : "assets/image/icon_radio_unselected.png",
width: 24, width: 24,
height: 24, height: 24,
), ),

2
lib/settlement/settlement_view/settlement_coupon.dart

@ -115,7 +115,7 @@ class _SettlementCoupon extends State<SettlementCoupon> {
return CouponWidget( return CouponWidget(
couponCan[position], couponCan[position],
widget.storeInfo, widget.storeInfo,
selected: widget.couponBean == couponCan[position], selected: widget?.couponBean?.id == couponCan[position]?.id,
); );
}, },
), ),

17
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -122,7 +122,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
children: [ children: [
MImage( MImage(
productList.skuImg, productList.skuImg,
width: 44.w, width: 44,
height: 44, height: 44,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
@ -342,10 +342,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
), ),
Container( Container(
child: Text( child: Text(
"已优惠:¥${(widget.minOrderInfo != null) ? (double.parse(widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0")) : "已优惠:¥${discountPrice()}",
(double.parse(widget.tableId <= 0 ? "0" : (widget.settleOrderInfo.discountAmount ?? "0"))
+ double.parse(widget?.settleOrderInfo?.benefitDiscountAmount ?? "0"))
}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
color: Color(0xFF7B7B7B), color: Color(0xFF7B7B7B),
@ -384,6 +381,16 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
); );
} }
String discountPrice(){
if(widget.minOrderInfo != null){
return (widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0");
}else if(widget.tableId < 0){
return "0";
}else {
return widget?.settleOrderInfo?.discountAmount ?? "0";
}
}
String totalPrice() { String totalPrice() {
if (widget.minOrderInfo != null && if (widget.minOrderInfo != null &&
widget.minOrderInfo.orderProductVOList != null) { widget.minOrderInfo.orderProductVOList != null) {

100
lib/store/store_order.dart

@ -137,11 +137,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
queryMemberInfo() async { queryMemberInfo() async {
BaseData baseData = await minService.memberInfo() BaseData baseData = await minService.memberInfo().catchError((error) {
.catchError((error){debugPrint(error);}); debugPrint(error);
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
value.setString('minMember', jsonEncode(baseData.data)), value.setString('minMember', jsonEncode(baseData.data)),
}, },
); );
@ -150,8 +151,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
getParentInfo() async { getParentInfo() async {
BaseData baseData = await minService.getParentInfo("$tableId") BaseData baseData =
.catchError((error) {debugPrint(error);}); await minService.getParentInfo("$tableId").catchError((error) {
debugPrint(error);
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if (baseData.data != null) { if (baseData.data != null) {
parentId = baseData.data["id"]; parentId = baseData.data["id"];
@ -182,7 +185,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
queryStoreInfo() async { queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { BaseData baseData =
await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error); debugPrint(error);
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -202,19 +206,17 @@ class _StoreOrderPage extends State<StoreOrderPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return return WillPopScope(
// WillPopScope( onWillPop: () async {
// onWillPop: () async { if (dialogShowing) {
// if (dialogShowing) { debugPrint("ssssasdadsasdadasd");
// debugPrint("ssssasdadsasdadasd"); SmartDialog.dismiss();
// SmartDialog.dismiss(); return false;
// return false; } else {
// } else { return true;
// return true; }
// } },
// }, child: Container(
// child:
Container(
color: Colors.white, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
@ -227,14 +229,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
controller: controller, controller: controller,
dragStartBehavior: DragStartBehavior.start, dragStartBehavior: DragStartBehavior.start,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
headerSliverBuilder: (BuildContext context, bool innerScrolled) { headerSliverBuilder:
(BuildContext context, bool innerScrolled) {
return [ return [
SliverOverlapAbsorber( SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context), context),
sliver: SliverAppBar( sliver: SliverAppBar(
expandedHeight: expandedHeight: (storeInfo != null &&
(storeInfo != null && storeInfo.couponVOList != null) storeInfo.couponVOList != null)
? 470.h ? 470.h
: 365.h, : 365.h,
floating: false, floating: false,
@ -262,9 +265,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
), ),
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
title: Title( title: Title(controller,
controller, storeInfo != null ? storeInfo.storeName : ''),
storeInfo != null ? storeInfo.storeName : ''),
collapseMode: CollapseMode.pin, collapseMode: CollapseMode.pin,
stretchModes: [ stretchModes: [
StretchMode.zoomBackground, StretchMode.zoomBackground,
@ -490,8 +492,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
], ],
), ),
); ),
// ); );
} }
/// ///
@ -555,6 +557,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
return; return;
} }
} }
await Navigator.of(context).pushNamed( await Navigator.of(context).pushNamed(
'/router/settlement', '/router/settlement',
arguments: { arguments: {
@ -562,15 +565,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
"tableId": tableId, "tableId": tableId,
"parentCode": parentCode, "parentCode": parentCode,
"parentId": parentId, "parentId": parentId,
"pName":pName, "pName": pName,
"pid":pid, "pid": pid,
"cName":cName, "cName": cName,
"cid":cid, "cid": cid,
"shoppingCart": shopCarGoods, "shoppingCart": shopCarGoods,
"numberOfPeople": numberOfPeople, "numberOfPeople": numberOfPeople,
}, },
); );
if(tableId >0){ if (tableId > 0) {
getParentInfo(); getParentInfo();
} }
queryShopCar().then((value) { queryShopCar().then((value) {
@ -651,18 +654,19 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
/// ///
_queryMiNiDetail(String id,int count) async { _queryMiNiDetail(String id, int count) async {
EasyLoading.show(status: S.current.zhengzaijiazai); EasyLoading.show(status: S.current.zhengzaijiazai);
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id); BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
showStoreSelector(baseData.data, id,count); showStoreSelector(baseData.data, id, count);
} }
} }
/// ///
showStoreSelector(MiNiDetail miNiDetail, String id,int count) async { showStoreSelector(MiNiDetail miNiDetail, String id, int count) async {
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1 if (miNiDetail.attrList != null &&
&& miNiDetail.attrList[0].attrValueList.length == 1) { miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count); _addShopCar(miNiDetail, [], count);
} else { } else {
EasyLoading.dismiss(); EasyLoading.dismiss();
@ -687,7 +691,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
ProductSkuVOListBean productSku; ProductSkuVOListBean productSku;
if (selectSkus!= null && selectSkus.length == 0) { if (selectSkus != null && selectSkus.length == 0) {
productSku = miNiDetail.productSkuVOList.first; productSku = miNiDetail.productSkuVOList.first;
} else { } else {
productSku = miNiDetail.productSkuVOList.firstWhere((element) { productSku = miNiDetail.productSkuVOList.firstWhere((element) {
@ -743,28 +747,28 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
Future<ShoppingCart> queryShopCar() async { Future<ShoppingCart> queryShopCar() async {
pName="";// pName = ""; //
pid="";// pid = ""; //
cName="";// cName = ""; //
cid="";// cid = ""; //
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.getShoppingCart(tableId); await minService.getShoppingCart(tableId);
if (baseDate != null && if (baseDate != null &&
baseDate.isSuccess && baseDate.isSuccess &&
baseDate.data != null && baseDate.data != null &&
baseDate.data.length > 0) { baseDate.data.length > 0) {
if( baseDate.data[0].selectDiscount ==1){ if (baseDate.data[0].selectDiscount == 1) {
baseDate.data[0].couponList.forEach((element) { baseDate.data[0].couponList.forEach((element) {
if(element.isMaxCoupon){ if (element.isMaxCoupon) {
cName = element.promotionName; cName = element.promotionName;
cid = element.id; cid = element.id;
} }
}); });
}else if(baseDate.data[0].selectDiscount==2){ } else if (baseDate.data[0].selectDiscount == 2) {
baseDate.data[0].promotionInfoList.forEach((element) { baseDate.data[0].promotionInfoList.forEach((element) {
if(element.isMaxPromotion){ if (element.isMaxPromotion) {
pName=element.name; pName = element.name;
pid=element.id; pid = element.id;
} }
}); });
} }

16
lib/store/store_view/product_sku.dart

@ -34,8 +34,8 @@ class ProductSku extends StatefulWidget {
class _ProductSku extends State<ProductSku> { class _ProductSku extends State<ProductSku> {
List<String> selectSkus = []; List<String> selectSkus = [];
int count = 1; int count = 1;
String selectedPrice = "";
@override @override
void initState() { void initState() {
@ -59,6 +59,7 @@ class _ProductSku extends State<ProductSku> {
return; return;
} }
if (productSku == null) return; if (productSku == null) return;
selectedPrice = productSku.skuPrice;
String skuId = productSku.id; String skuId = productSku.id;
if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return;
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id);
@ -98,6 +99,7 @@ class _ProductSku extends State<ProductSku> {
height: MediaQuery.of(context).size.height / 3 * 2, height: MediaQuery.of(context).size.height / 3 * 2,
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
// color: Color(0xFFFAFAFA),
color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA),
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topLeft: Radius.circular(8), topLeft: Radius.circular(8),
@ -123,7 +125,7 @@ class _ProductSku extends State<ProductSku> {
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Expanded(child: Column( Expanded(child:Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
@ -159,7 +161,7 @@ class _ProductSku extends State<ProductSku> {
), ),
), ),
Text( Text(
widget.miNiDetail.price, selectedPrice,
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
fontSize: 14.sp, fontSize: 14.sp,
@ -169,9 +171,7 @@ class _ProductSku extends State<ProductSku> {
], ],
), ),
], ],
)) )),
,
Spacer(),
InkWell( InkWell(
onTap: () { onTap: () {
// Navigator.of(context).pop(); // Navigator.of(context).pop();
@ -352,12 +352,12 @@ class _ProductSku extends State<ProductSku> {
Widget sweetnessItem(String name, bool isCheck) { Widget sweetnessItem(String name, bool isCheck) {
return Container( return Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 70.w, width: 70.w,
height: 29.h, height:30.h,
alignment: Alignment.center, alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060),

2
lib/store/store_view/shop_goods.dart

@ -198,7 +198,7 @@ class _ShopGoods extends State<ShopGoods> {
), ),
), ),
if (widget.isShopCart || (widget.productListBean?.attrStyle??0) == 0) if (widget.isShopCart || (widget.productListBean?.attrStyle??0) == 0)
InkWell( GestureDetector(
onTap: () { onTap: () {
widget.add(widget.shoppingCartSkuItemListBean); widget.add(widget.shoppingCartSkuItemListBean);
}, },

7
lib/store/store_view/store_order_list.dart

@ -230,11 +230,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
} }
}); });
} }
return InkWell( return ShopGoods(
onTap: () {
widget.queryMiNiDetail(productListBeans[position].id,1);
},
child: ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id,1); widget.queryMiNiDetail(productListBeans[position].id,1);
}, },
@ -247,7 +243,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
isShopCart: false, isShopCart: false,
queryMiNiDetail: widget.queryMiNiDetail, queryMiNiDetail: widget.queryMiNiDetail,
shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, shoppingCartSkuItemListBean: shoppingCartSkuItemListBean,
),
); );
} }
} }

35
lib/utils/ImgCachePath.dart

@ -0,0 +1,35 @@
import 'dart:io';
import 'package:path_provider/path_provider.dart';
class ImgCachePath{
factory ImgCachePath() => _getInstance();
static ImgCachePath get instance => _getInstance();
static ImgCachePath _instance;
String _path;
String get path => _path;
ImgCachePath._internal(){
fileFromDocsDir();
}
fileFromDocsDir() async {
Directory tempDir = await getTemporaryDirectory();
Directory directory = new Directory('${tempDir.path}/ImgCache');
if (!directory.existsSync()) {
directory.createSync();
}
_path = directory.path;
}
static ImgCachePath _getInstance(){
if(_instance == null){
_instance = ImgCachePath._internal();
}
return _instance;
}
}

100
lib/view_widget/custom_image.dart

@ -1,8 +1,8 @@
import 'dart:io'; import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/utils/ImgCachePath.dart';
import 'package:network_to_file_image/network_to_file_image.dart';
import 'package:path/path.dart' as p;
class MImage extends StatelessWidget { class MImage extends StatelessWidget {
final String src; final String src;
@ -29,20 +29,33 @@ class MImage extends StatelessWidget {
this.radius = BorderRadius.zero, this.radius = BorderRadius.zero,
}); });
File fileFromDocsDir(String filename) {
String pathName = p.join(ImgCachePath.instance.path, filename);
return File(pathName);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Widget image = LayoutBuilder( Widget image = LayoutBuilder(
builder: (context, constraints) { builder: (context, constraints) {
String imageUrl = ""; String imageUrl = "";
/// ///
if (src != null && src != "" && src.startsWith("http")) { // if (src != null && src != "" && src.startsWith("http")) {
String oper = src.contains("?") ? "" :"?"; // String oper = src.contains("?") ? "" :"?";
imageUrl = // imageUrl =
"$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" // "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}"
"x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; // "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100";
// }
int _w = ((constraints.constrainWidth()==double.infinity?
MediaQuery.of(context).size.width:constraints.constrainWidth()) * scaleIndex).toInt();
int _h = ((constraints.constrainHeight()==double.infinity?
MediaQuery.of(context).size.height:constraints.constrainHeight()) * scaleIndex).toInt();
///
if ((src??"").startsWith("http")) {
imageUrl = "$src?imageView2/1/w/${_w}/h/${_h}/format/jpg/q/75";
} }
// print(imageUrl); // print("imageUrl:$imageUrl");
// print("constrainWidth: ${constraints.constrainWidth()}"); // print("constrainWidth: ${constraints.constrainWidth()}");
// print("constrainHeight: ${constraints.constrainHeight()}"); // print("constrainHeight: ${constraints.constrainHeight()}");
@ -53,43 +66,38 @@ class MImage extends StatelessWidget {
); );
} }
Widget cachedNetworkImage; Widget cachedNetworkImage;
if (src.startsWith("http")) { if (src.startsWith("http")) {
cachedNetworkImage = CachedNetworkImage( cachedNetworkImage = Image(
imageUrl: imageUrl, image: ResizeImage(NetworkToFileImage(
cacheManager: DefaultCacheManager(), url: imageUrl,
fadeInDuration: Duration(milliseconds: 300), file: fileFromDocsDir("resize"+src.replaceAll("https:", "")
fadeOutDuration: Duration(milliseconds: 300), .replaceAll("http:", "")
imageBuilder: (context, provide) { .replaceAll("pos.upload.gznl.top", "")
return Image( .replaceAll("/", "")),
image: provide, debug: true,
fit: fit, ),
); width: _w,
}, height: _h),
errorWidget: (context, error, stackTrace) { errorBuilder: (context, error, stackTrace) {
return Image.asset( return Image.asset(
errorSrc, errorSrc,
fit: fit, fit: fit,
); );
}, },
placeholder: (context, placeholder) { fit: fit,
return Image.asset( );
fadeSrc, } else if (src.startsWith("file")) {
fit: fit, cachedNetworkImage = Image.file(
); File(src),
}, fit: fit,
); errorBuilder: (context, error, stackTrace) {
} else if (src.startsWith("file")) { return Image.asset(
cachedNetworkImage = Image.file( errorSrc,
File(src), fit: fit,
fit: fit, );
errorBuilder: (context, error, stackTrace) { },
return Image.asset( );
errorSrc, }
fit: fit,
);
},
);
}
return cachedNetworkImage; return cachedNetworkImage;
}, },
); );

2
lib/view_widget/text_image_dialog.dart

@ -38,7 +38,7 @@ class _TextImageWidget extends State<TextImageWidget> {
child: Center( child: Center(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
margin: EdgeInsets.symmetric(horizontal:16.w), margin: EdgeInsets.symmetric(horizontal:26.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,

51
pubspec.lock

@ -50,13 +50,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.1.6" version: "0.1.6"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -209,13 +202,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
flutter_easyloading: flutter_easyloading:
dependency: "direct main" dependency: "direct main"
description: description:
@ -269,7 +255,7 @@ packages:
name: flutter_screenutil name: flutter_screenutil
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.0.3" version: "5.1.0"
flutter_smart_dialog: flutter_smart_dialog:
dependency: "direct main" dependency: "direct main"
description: description:
@ -350,13 +336,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.15.0" version: "0.15.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.2"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -434,6 +413,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
network_to_file_image:
dependency: "direct main"
description:
name: network_to_file_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.8"
numerus: numerus:
dependency: transitive dependency: transitive
description: description:
@ -677,20 +663,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.8.1" version: "1.8.1"
sqflite:
dependency: transitive
description:
name: sqflite
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3+3"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -712,13 +684,6 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0+2"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:

2
pubspec.yaml

@ -65,7 +65,7 @@ dependencies:
scan: ^1.5.0 scan: ^1.5.0
path_provider: ^1.2.0 path_provider: ^1.2.0
cached_network_image: ^2.0.0 network_to_file_image: ^2.0.0
flutter_html: ^2.1.5 #2.1.0 flutter_html: ^2.1.5 #2.1.0
chewie_audio: ^1.1.2 chewie_audio: ^1.1.2

Loading…
Cancel
Save