Browse Source

Merge branch 'remove_uniapp' into dev

# Conflicts:
#	lib/community/community_view/class_details.dart
#	lib/community/headlines/headlines_collection.dart
#	lib/home/home_view/shortcut_operation.dart
#	lib/mine/mine_page.dart
#	lib/mine/mine_view/mine_item.dart
#	lib/mine/mine_wallet_page.dart
#	lib/retrofit/min_api.dart
#	lib/retrofit/retrofit_api.dart
#	lib/store/store_order.dart
#	lib/store/store_view/product_sku.dart
#	lib/store/store_view/store_info.dart
#	lib/store/store_view/store_order_list.dart
zyh
w-R 3 years ago
parent
commit
462a15773e
  1. BIN
      assets/image/2x/activity_hot.png
  2. BIN
      assets/image/2x/activity_q.png
  3. BIN
      assets/image/2x/c_z.png
  4. BIN
      assets/image/2x/icon_gz.png
  5. BIN
      assets/image/2x/icon_pl.png
  6. BIN
      assets/image/2x/icon_z.png
  7. BIN
      assets/image/3x/activity_hot.png
  8. BIN
      assets/image/3x/activity_q.png
  9. BIN
      assets/image/3x/c_z.png
  10. BIN
      assets/image/3x/icon_gz.png
  11. BIN
      assets/image/3x/icon_pl.png
  12. BIN
      assets/image/3x/icon_z.png
  13. BIN
      assets/image/activity_hot.png
  14. BIN
      assets/image/activity_q.png
  15. BIN
      assets/image/c_z.png
  16. BIN
      assets/image/icon_gz.png
  17. BIN
      assets/image/icon_pl.png
  18. BIN
      assets/image/icon_z.png
  19. 24
      ios/Podfile.lock
  20. 21
      ios/Runner.xcodeproj/project.pbxproj
  21. 2
      ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
  22. 136
      lib/community/community_child_list.dart
  23. 42
      lib/community/community_child_page.dart
  24. 54
      lib/community/community_details.dart
  25. 493
      lib/community/community_list.dart
  26. 37
      lib/community/community_page.dart
  27. 3
      lib/community/community_view/class_details.dart
  28. 30
      lib/community/community_view/class_details_video.dart
  29. 197
      lib/community/community_view/community_dynamic.dart
  30. 5
      lib/community/community_view/home_class.dart
  31. 171
      lib/community/headlines/activity_top_list.dart
  32. 10
      lib/community/headlines/article_list.dart
  33. 46
      lib/community/headlines/article_page.dart
  34. 99
      lib/community/headlines/headlines_collection.dart
  35. 28
      lib/community/headlines/headlines_column_details.dart
  36. 556
      lib/community/new_community_details.dart
  37. 18
      lib/community/photo_view_gallery_screen.dart
  38. 31
      lib/community/release_dynamic.dart
  39. 185
      lib/home/home_page.dart
  40. 6
      lib/home/home_view/coupon.dart
  41. 71
      lib/home/home_view/featured_acticvity.dart
  42. 2
      lib/home/home_view/quick_order.dart
  43. 2
      lib/home/home_view/shortcut_operation.dart
  44. 5
      lib/home/points_mall_view/points_goods_title.dart
  45. 1
      lib/integral/integral_detailed_page.dart
  46. 26
      lib/login/login_page.dart
  47. 12
      lib/main.dart
  48. 12
      lib/main_page.dart
  49. 1106
      lib/message/system_details.dart
  50. 658
      lib/message/system_message.dart
  51. 175
      lib/mine/mine_page.dart
  52. 42
      lib/mine/mine_view/mine_view.dart
  53. 184
      lib/mine/mine_view/wallet_coupon_view.dart
  54. 28
      lib/mine/mine_wallet_page.dart
  55. 34
      lib/mine/release_page.dart
  56. 2
      lib/order/order_view/order_commodity.dart
  57. 102
      lib/retrofit/data/article.dart
  58. 257
      lib/retrofit/data/login_info.dart
  59. 129
      lib/retrofit/data/message.dart
  60. 29
      lib/retrofit/data/msg_stats.dart
  61. 20
      lib/retrofit/min_api.dart
  62. 13
      lib/retrofit/retrofit_api.dart
  63. 22
      lib/retrofit/retrofit_api.g.dart
  64. 8
      lib/settlement/settlement.dart
  65. 4
      lib/settlement/settlement_view/coupon.dart
  66. 2
      lib/settlement/settlement_view/settlement_coupon.dart
  67. 17
      lib/settlement/settlement_view/settlement_order_commodity.dart
  68. 48
      lib/store/store_order.dart
  69. 37
      lib/store/store_view/product_sku.dart
  70. 2
      lib/store/store_view/shop_goods.dart
  71. 2
      lib/store/store_view/store_info.dart
  72. 19
      lib/store/store_view/store_order_list.dart
  73. 35
      lib/utils/ImgCachePath.dart
  74. 256
      lib/view_widget/activity_coupons.dart
  75. 99
      lib/view_widget/custom_image.dart
  76. 3
      lib/view_widget/item_input_widget.dart
  77. 11
      lib/view_widget/login_tips.dart
  78. 32
      lib/view_widget/new_people_reward.dart
  79. 8
      lib/view_widget/request_permission.dart
  80. 7
      lib/view_widget/text_image_dialog.dart
  81. 3
      lib/web/web_view/comment_list.dart
  82. 51
      pubspec.lock
  83. 4
      pubspec.yaml

BIN
assets/image/2x/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
assets/image/2x/activity_q.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

BIN
assets/image/2x/c_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/image/2x/icon_gz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
assets/image/2x/icon_pl.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
assets/image/2x/icon_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
assets/image/3x/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
assets/image/3x/activity_q.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

BIN
assets/image/3x/c_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
assets/image/3x/icon_gz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/image/3x/icon_pl.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
assets/image/3x/icon_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
assets/image/activity_hot.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 812 B

BIN
assets/image/activity_q.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/image/c_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

BIN
assets/image/icon_gz.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
assets/image/icon_pl.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
assets/image/icon_z.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

24
ios/Podfile.lock

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

21
ios/Runner.xcodeproj/project.pbxproj

@ -674,7 +674,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1300;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
@ -930,7 +930,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 61;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -980,7 +980,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
MARKETING_VERSION = 1.0.59;
MARKETING_VERSION = 1.0.61;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@ -994,7 +994,6 @@
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"",
"-l\"sqlite3\"",
"-l\"video_player\"",
@ -1051,7 +1050,6 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
@ -1100,6 +1098,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MTL_ENABLE_DEBUG_INFO = YES;
"MTL_ENABLE_DEBUG_INFO[arch=*]" = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@ -1160,7 +1159,7 @@
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
@ -1168,7 +1167,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 61;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -1218,7 +1217,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
MARKETING_VERSION = 1.0.59;
MARKETING_VERSION = 1.0.61;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@ -1232,7 +1231,6 @@
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"",
"-l\"sqlite3\"",
"-l\"video_player\"",
@ -1297,7 +1295,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 59;
CURRENT_PROJECT_VERSION = 61;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@ -1347,7 +1345,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
MARKETING_VERSION = 1.0.59;
MARKETING_VERSION = 1.0.61;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@ -1361,7 +1359,6 @@
"-l\"flutter_baidu_mapapi_map\"",
"-l\"flutter_baidu_mapapi_base\"",
"-l\"permission_handler\"",
"-l\"shared_preferences\"",
"-l\"sqflite\"",
"-l\"sqlite3\"",
"-l\"video_player\"",

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
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 {
queryCommunity();
}
///
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) {
setState(() {
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;
_onRefresh();
},
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: () {
_onRefresh();
},
),
],
),
),
),
),
);
// },
// );
}
}

42
lib/community/community_child_page.dart

@ -1,6 +1,9 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
@ -24,10 +27,11 @@ class CommunityChildPage extends StatefulWidget {
class _CommunityChildPage extends State<CommunityChildPage> {
RefreshController refreshController = RefreshController();
ApiService apiService;
int pageNum = 0;
int pageNum = 1;
String userId;
bool isLoadMore = false;
List<ComunityComment> comments = [];
List<Article> articles = [];
@override
void initState() {
@ -36,7 +40,6 @@ class _CommunityChildPage extends State<CommunityChildPage> {
}
_onRefresh() async {
pageNum = 0;
setState(() {});
}
@ -51,7 +54,11 @@ class _CommunityChildPage extends State<CommunityChildPage> {
token: value.getString("token"),
);
}
pageNum += 1;
if(isLoadMore){
pageNum += 1;
isLoadMore = false;
}
else pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false,
@ -67,11 +74,25 @@ class _CommunityChildPage extends State<CommunityChildPage> {
refreshController.loadComplete();
if (baseData.isSuccess) {
if (pageNum == 1) {
comments.clear();
articles.clear();
}
comments.addAll(baseData.data.list);
baseData.data.list.forEach((element) {
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.liked = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
article.createTime = element.createTime;
article.updateUser = element.memberInfo?.mid;
article.viewers = element?.viewers;
article.likes = element?.likes;
article.comments = element?.comments;
articles.add(article);
});
// comments.sort((a,b)=>b.createTime.compareTo(a.createTime));
print("comments: ${comments.length}");
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
@ -96,6 +117,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
),
onRefresh: _onRefresh,
onLoading: () {
isLoadMore = true;
setState(() {});
},
child: ListView.builder(
@ -103,7 +125,7 @@ class _CommunityChildPage extends State<CommunityChildPage> {
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
comments[position],
articles[position],
0,
userId: userId,
isList: true,
@ -117,14 +139,14 @@ class _CommunityChildPage extends State<CommunityChildPage> {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],
"businessId": articles[position].id,
"userId": userId,
},
);
},
);
},
itemCount: comments.length,
itemCount: articles.length,
),
);
},

54
lib/community/community_details.dart

@ -6,7 +6,6 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/article.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/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
@ -30,7 +29,7 @@ class CommunityDetails extends StatefulWidget {
class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObserver {
double height = 0;
double commentHeight = 60.h;
ComunityComment comunity;
// ComunityComment comunity;
String parenId = "0";
final GlobalKey commentKey = GlobalKey();
final ScrollController scrollController = ScrollController();
@ -43,6 +42,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
bool isKeyBoardShow = false;
int commentTotal = 0;
Article article;
String businessId;
@override
void didChangeMetrics() {
@ -72,15 +73,16 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
@override
void initState() {
super.initState();
comunity = widget.arguments["comment"];
// comunity = widget.arguments["comment"];
businessId = widget.arguments["businessId"];
WidgetsBinding.instance.addObserver(this);
_queryMemberCommentList();
queryDetails();
queryDetails(businessId);
}
///
queryDetails() async {
queryDetails(id) async {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
@ -88,11 +90,15 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
context: context,
token: value.getString("token"),
);
BaseData<Article> baseData = await apiService.informationInfo(comunity.id)
BaseData<Article> baseData = await apiService.informationInfo(id)
.catchError((onError) {
debugPrint(onError.toString());
});
if (baseData != null && baseData.isSuccess) {}
if (baseData != null && baseData.isSuccess) {
setState(() {
article = baseData.data;
});
}
}
@override
@ -114,13 +120,14 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
physics: BouncingScrollPhysics(),
child: Column(
children: [
if(article != null)
CommunityDynamic(
comunity,
article,
0,
exitFull: () {
setState(() {});
},
userId:widget.arguments["userId"],
userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"],
itemCount: 3,
isDetails: true,
heightFun: (height) {
@ -136,9 +143,9 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
),
CommentList(
commentKey,
comunity?.likes ?? comunity?.likes.toString() ?? 0,
comunity.id,
1,
article?.likes ?? 0,
businessId,
4,
isKeyBoardShow,
_reply,
_delCommentTips,
@ -154,8 +161,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
margin: EdgeInsets.only(top: 40),
padding: EdgeInsets.all(22.h),
child: Text(
S
.of(context)
S.of(context)
.zanwupinglun,
style: TextStyle(
fontSize: 12,
@ -180,7 +186,7 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
_toComment,
_queryMemberComment,
_queryInformationLikes,
isLike: comunity.selfLike,
isLike: article?.liked ?? false,
),
],
),
@ -190,15 +196,15 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
////
_queryInformationLikes() async {
BaseData baseData = await apiService.informationLikes(comunity.id).catchError((onError) {});
BaseData baseData = await apiService.informationLikes(businessId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
commentKey.currentState.setState(() {});
setState(() {
if (comunity.selfLike ?? false)
comunity.likes -= 1;
if (article?.liked ?? false)
article?.likes -= 1;
else
comunity.likes += 1;
comunity.selfLike = !comunity.selfLike ?? false;
article?.likes += 1;
article?.liked = !(article.liked ?? false);
});
} else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -210,8 +216,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
BaseData baseData = await apiService.memberComment({
"content": content,
"parentId": parenId,
"relationalId": comunity.id,
"relationalType":1
"relationalId": businessId,
"relationalType":4
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
CommentListState state = commentKey.currentState;
@ -295,8 +301,8 @@ class _CommunityDetails extends State<CommunityDetails> with WidgetsBindingObser
await apiService.memberCommentList({
"pageNum": 1,
"pageSize": 100,
"relationalId": comunity.id,
"relationalType":1,
"relationalId": businessId,
"relationalType":4,
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
commentTotal = baseData.data.size;

493
lib/community/community_list.dart

@ -0,0 +1,493 @@
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(() {});
// },
}).then((value) {
widget.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,
),
],
)
],
),
),
);
},
);
}
}

37
lib/community/community_page.dart

@ -1,5 +1,6 @@
import 'package:flutter/material.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/home/huixiang_brand_page.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
@ -20,6 +21,8 @@ class _CommunityPage extends State<CommunityPage>
with SingleTickerProviderStateMixin {
TabController tabcontroller;
CommunityChildPage guanzhu,tuijian ;
List<String> lables = [
"关注",
"推荐",
@ -38,14 +41,15 @@ class _CommunityPage extends State<CommunityPage>
}
_toRelease() async {
int tmpIndex = tabcontroller.index;
setState(() {
tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1;
});
var result = await Navigator.of(context).pushNamed('/router/release_dynamic');
setState(() {
tabcontroller.index = tmpIndex;
});
// int tmpIndex = tabcontroller.index;
// setState(() {
// tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1;
// });
// setState(() {
// tabcontroller.index = tmpIndex;
// });
}
@override
@ -82,12 +86,17 @@ class _CommunityPage extends State<CommunityPage>
onTap: () {
_toRelease();
},
action: SvgPicture.asset(
"assets/svg/shequ_fabu.svg",
fit: BoxFit.contain,
width: 24,
height: 24,
),
action: GestureDetector(
behavior: HitTestBehavior.opaque,
child: Container(color: Colors.transparent,
padding: EdgeInsets.only(left: 20,right: 20),
child: SvgPicture.asset(
"assets/svg/shequ_fabu.svg",
fit: BoxFit.contain,
width: 24,
height: 24,
),)
)
),
body: Container(
padding: EdgeInsets.only(bottom: 76.h),
@ -102,7 +111,7 @@ class _CommunityPage extends State<CommunityPage>
return CommunityCourse();
}
else {
return CommunityChildPage(e);
return CommunityChildList(e);
}
}).toList(),
controller: tabcontroller,

3
lib/community/community_view/class_details.dart

@ -200,7 +200,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
Row(
children: [
Container(
height:26.h,
// height: 22.h,
padding:EdgeInsets.only(left:2,right:2),
alignment: Alignment.center,
decoration: BoxDecoration(
@ -216,6 +216,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
course.tags.length > 0)
? course.tags[0]
: "",
overflow:TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,

30
lib/community/community_view/class_details_video.dart

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

197
lib/community/community_view/community_dynamic.dart

@ -1,10 +1,11 @@
import 'dart:convert';
import 'dart:ui';
import 'package:chewie/chewie.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:chewie/src/chewie_progress_colors.dart' as chewie;
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -13,14 +14,11 @@ 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:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_pickers/image_pickers.dart';
import 'package:photo_view/photo_view.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:video_player/video_player.dart';
import '../photo_view_gallery_screen.dart';
class CommunityDynamic extends StatefulWidget {
final int itemCount;
final Function(double height) heightFun;
@ -29,11 +27,11 @@ class CommunityDynamic extends StatefulWidget {
final Function removalDynamic;
final Function exitFull;
final bool isList;
final ComunityComment comment;
final Article article;
final String userId;
CommunityDynamic(
this.comment,
this.article,
this.commentType, {
Key key,
this.itemCount = 9,
@ -78,15 +76,16 @@ class _CommunityDynamic extends State<CommunityDynamic> {
String filePath;
initVideo() async {
if (widget.comment.subjectInfo.type == "video" &&
widget.comment.subjectInfo.video.isNotEmpty) {
if (widget?.article?.content == null) return;
var cnt = jsonDecode(widget.article.content);
if (cnt["type"] == "video" && cnt["video"] != null) {
if (widget.isList) {
videoPlayerController = VideoPlayerController.network(
widget.comment.subjectInfo.video,
cnt["video"],
)..initialize().then((value) {});
} else {
videoPlayerController = VideoPlayerController.network(
widget.comment.subjectInfo.video,
cnt["video"],
)..initialize().then((value) {
chewieAudioController = ChewieController(
videoPlayerController: videoPlayerController,
@ -114,11 +113,12 @@ class _CommunityDynamic extends State<CommunityDynamic> {
}
////
_vipFollow(followId,isFollow) async {
_vipFollow(followId, isFollow) async {
BaseData baseData = await apiService.follow(followId);
if (baseData != null && baseData.isSuccess) {
widget.exitFull();
SmartDialog.showToast(isFollow?"关注成功":"取关成功", alignment: Alignment.center);
SmartDialog.showToast(isFollow ? "关注成功" : "取关成功",
alignment: Alignment.center);
setState(() {});
} else {
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -171,22 +171,29 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: Row(
children: [
GestureDetector(
onTap: (){
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen(
images:[widget?.comment?.memberInfo?.avatar ?? ""],//list
index: 0,//index
), ), );
},
child: MImage(
widget?.comment?.memberInfo?.avatar ?? "",
width: 44,
height: 44,
isCircle: true,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: [(widget?.article?.authorHeadImg ?? "").isEmpty?
"https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg
], //list
index: 0, //index
),
));
},
child:
MImage(
(widget?.article?.authorHeadImg ?? "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,
),
@ -195,7 +202,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget?.comment?.memberInfo?.nickname ?? "",
widget?.article?.authorName ?? "",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
@ -203,7 +210,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
),
Text(
widget?.comment?.createTime ?? "",
widget?.article?.createTime ?? "",
style: TextStyle(
fontSize: 13.sp,
fontWeight: MyFontWeight.regular,
@ -215,14 +222,15 @@ class _CommunityDynamic extends State<CommunityDynamic> {
],
),
),
if (widget?.comment?.memberInfo?.mid != widget.userId ?? "")
if (widget?.article?.updateUser != widget.userId ?? "")
GestureDetector(
onTap: () {
setState(() {
if (widget.commentType == 0) {
widget.comment.selfFollow =
!(widget.comment.selfFollow ?? false);
_vipFollow(widget.comment.memberInfo?.mid,widget.comment.selfFollow ?? false);
widget.article.liked =
!(widget.article.liked ?? false);
_vipFollow(widget.article.updateUser,
widget.article.liked ?? false);
} else {
showDeleteDialog();
}
@ -235,31 +243,34 @@ class _CommunityDynamic extends State<CommunityDynamic> {
alignment: Alignment.center,
child: RoundButton(
height: 25.h,
backgroup: (widget.comment.selfFollow ?? false)
backgroup: (widget?.article?.liked ?? false)
? Color(0xFFE6E6E6)
: Color(0xFF32A060),
textColor: (widget.comment.selfFollow ?? false)
textColor: (widget?.article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
text: (widget.comment.selfFollow ?? false)
text: (widget?.article?.liked ?? false)
? "已关注"
: "关注",
radius: 20,
icons: Icon(
(widget.comment.selfFollow ?? false)
(widget?.article?.liked ?? false)
? Icons.check
: Icons.add,
color: (widget.comment.selfFollow ?? false)
color: (widget?.article?.liked ?? false)
? Color(0xFF808080)
: Colors.white,
size: 15,
),
))
: Padding(padding: EdgeInsets.all(20),child:Icon(
Icons.close,
color: Colors.black,
size: 16,
),),
: Padding(
padding: EdgeInsets.all(20),
child: Icon(
Icons.close,
color: Colors.black,
size: 16,
),
),
),
],
),
@ -267,7 +278,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
height: 12.h,
),
Text(
widget.comment.subject ?? "",
widget?.article?.mainTitle ?? "",
maxLines: 5,
overflow: TextOverflow.ellipsis,
style: TextStyle(
@ -276,7 +287,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
fontSize: 15.sp,
),
),
buildMedia(widget.comment.subjectInfo),
buildMedia(widget?.article?.content),
if (!widget.isDetails)
SizedBox(
height: 12.h,
@ -287,8 +298,8 @@ class _CommunityDynamic extends State<CommunityDynamic> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
IconText(
(widget.comment != null)
? "${widget.comment.viewers}"
(widget.article != null)
? "${widget.article.viewers}"
: "",
space: 4.w,
leftImage: "assets/svg/liulanliang.svg",
@ -298,7 +309,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
),
IconText(
"${widget.comment.comments ?? 0}",
"${widget.article.comments ?? 0}",
space: 4.w,
leftImage: "assets/svg/pinglun.svg",
iconSize: 16,
@ -309,7 +320,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
GestureDetector(
onTap: () {},
child: IconText(
"${widget.comment.likes ?? 0}",
"${widget.article.likes ?? 0}",
space: 4.w,
leftImage: "assets/svg/xihuan.svg",
iconSize: 16,
@ -332,39 +343,46 @@ class _CommunityDynamic extends State<CommunityDynamic> {
}
///
Widget buildMedia(SubjectInfo subjectInfo) {
if (subjectInfo == null) {
Widget buildMedia(String subjectInfo) {
if (subjectInfo == null || !subjectInfo.startsWith("{")) {
return Container();
}
var cnt = jsonDecode(subjectInfo);
Widget itemWidget = Container();
if (subjectInfo.type == "image" && subjectInfo.images.length > 0) {
if (subjectInfo.images.length == 1) {
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:subjectInfo.images,//list
// index: 0,//index
// ), ), );
},
child: MImage(
subjectInfo.images[0],
fit: BoxFit.cover,
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",
)),
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],
fit: BoxFit.contain,
radius: BorderRadius.circular(2),
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,
crossAxisCount:
(cnt["images"].length == 2 || cnt["images"].length == 4)
? 2
: 3,
crossAxisSpacing: 12.w,
mainAxisSpacing: 12.w,
childAspectRatio: 1,
@ -377,13 +395,18 @@ class _CommunityDynamic extends State<CommunityDynamic> {
child: InkWell(
onTap: () {
// ImagePickers.previewImages(subjectInfo.images, position);
Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen(
images:subjectInfo.images,//list
index: position,//index
), ), );
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PhotoViewGalleryScreen(
images: cnt["images"], //list
index: position, //index
),
),
);
},
child: MImage(
subjectInfo.images[position],
cnt["images"][position],
fit: BoxFit.cover,
aspectRatio: 1,
radius: BorderRadius.circular(1),
@ -393,17 +416,19 @@ class _CommunityDynamic extends State<CommunityDynamic> {
),
);
},
itemCount: subjectInfo.images.length,
itemCount: cnt["images"].length,
);
}
} else if (subjectInfo.type == "video" && subjectInfo.video.isNotEmpty) {
} else if (cnt["type"] == "video" &&
cnt["video"] != null &&
cnt["video"].isNotEmpty) {
itemWidget = videoWidget(
MediaQuery.of(context).size.width - 32,
videoPlayerController != null
? (MediaQuery.of(context).size.width - 32) /
videoPlayerController.value.aspectRatio
: MediaQuery.of(context).size.width / 2,
!widget.isList ? subjectInfo.video : widget.comment.coverImg,
cnt["video"].replaceAll(".mp4", "_poster.jpg"),
);
}
return Column(
@ -460,7 +485,9 @@ class _CommunityDynamic extends State<CommunityDynamic> {
color: Colors.black,
child: Stack(
children: [
Center(
Container(
width: double.infinity,
height: double.infinity,
child: MImage(
src,
aspectRatio: videoPlayerController != null
@ -500,7 +527,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 110.h,
height: 130.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -551,7 +578,7 @@ class _CommunityDynamic extends State<CommunityDynamic> {
fontWeight: FontWeight.bold,
),
onTap: () {
_deleteDynamic(widget.comment.id);
_deleteDynamic(widget.article.id);
Navigator.of(context).pop();
},
),

5
lib/community/community_view/home_class.dart

@ -220,7 +220,7 @@ class _HomeClass extends State<HomeClass> {
Container(
margin: EdgeInsets.only(top: 8, right: 8),
padding: EdgeInsets.only(left: 2, right: 2),
height: 16.h,
height: 20.h,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
@ -230,8 +230,9 @@ class _HomeClass extends State<HomeClass> {
(collect?.tags != null && collect.tags.length > 0)
? collect.tags[0]
: "",
overflow:TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontSize: 11.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF634815),
),

171
lib/community/headlines/activity_top_list.dart

@ -0,0 +1,171 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/collect_class_list.dart';
import 'package:huixiang/retrofit/data/course_list.dart';
import 'package:huixiang/retrofit/data/headlines_list.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:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/new_people_reward.dart';
class ActivityTopList extends StatefulWidget {
final List<Article> articleTop;
ActivityTopList(this.articleTop);
@override
State<StatefulWidget> createState() {
return _ActivityTopList();
}
}
class _ActivityTopList extends State<ActivityTopList> {
ApiService apiService;
BMFCoordinate latLng;
final TextEditingController editingController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Container(
height: 220.h,
margin: EdgeInsets.only(top: 10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10),
itemCount: widget.articleTop == null ? 0 : widget.articleTop.length,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/web_page',
arguments: {"articleId": widget.articleTop[position].id});
widget.articleTop[position].viewers =
(widget.articleTop[position].viewers + 1);
setState(() {});
},
child: headlinesCollectionItem(widget.articleTop[position], position),
);
},
),
);
}
Widget headlinesCollectionItem(Article articles, index) {
return Container(
width: 340.w,
height: 220.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
color: Colors.black,
),
margin: EdgeInsets.symmetric(
horizontal: 6,
),
child:Column(
children: [
Stack(
alignment: Alignment.bottomLeft,
children: [
Stack(
children: [
ClipRRect(
child: Opacity(
opacity: 0.8,
child: MImage(
widget?.articleTop[index]?.coverImg ?? "",
width: 340.w,
height: 220.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
bottom: Radius.circular(4),
),
),
Container(
padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 8),
alignment: Alignment.topLeft,
child: Row(
children: [
Image.asset(
"assets/image/activity_hot.png",
width: 20,
height: 20,
fit: BoxFit.fill,
),
SizedBox(
width: 4.w,
),
Expanded(
child: Text(
"精选好文",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
),
],
)),
],
),
Padding(padding:EdgeInsets.only(left: 12.w, right: 12.w, bottom: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget?.articleTop[index]?.mainTitle ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),
SizedBox(height: 5.h),
Opacity(opacity:0.8,
child: Text(
widget?.articleTop[index]?.viceTitle ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),)
],
)),
],
),
],
)
);
}
}

10
lib/community/headlines/article_list.dart

@ -1,20 +1,10 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.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/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/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/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:flutter_screenutil/flutter_screenutil.dart';

46
lib/community/headlines/article_page.dart

@ -14,12 +14,14 @@ import 'package:huixiang/retrofit/data/headlines_list.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:flutter_screenutil/flutter_screenutil.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 'activity_top_list.dart';
import 'article_list.dart';
class ArticlePage extends StatefulWidget {
@ -39,6 +41,7 @@ class _ArticlePage extends State<ArticlePage>
List<Brand> brands = [];
List<BannerData> bannerData = [];
List<Article> articles = [];
List<Article> articleTop = [];
List<HeadlinesList> headlines = [];
int pageNum = 1;
@ -52,7 +55,8 @@ class _ArticlePage extends State<ArticlePage>
setState(() {});
}
});
queryArticleList();
queryArticleList(false);
queryArticleList(true);
queryHeadlinesBanner();
queryHeadlinesList();
}
@ -90,7 +94,7 @@ class _ArticlePage extends State<ArticlePage>
}
///
queryArticleList() async {
queryArticleList(bool isHot) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@ -104,7 +108,9 @@ class _ArticlePage extends State<ArticlePage>
"pageSize": 10,
"searchKey": "",
"state": 1,
"type": 2
"type": 2,
"storeId":"",
"isHot":isHot
}).catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
@ -113,9 +119,15 @@ class _ArticlePage extends State<ArticlePage>
refreshController.refreshCompleted();
refreshController.loadComplete();
if (pageNum == 1) {
if(!isHot)
articles.clear();
else
articleTop.clear();
}
if(!isHot)
articles.addAll(baseData.data.list);
else
articleTop.addAll(baseData.data.list);
if (baseData.data.pageNum == baseData.data.pages) {
refreshController.loadNoData();
} else {
@ -155,7 +167,8 @@ class _ArticlePage extends State<ArticlePage>
_onRefresh() {
queryHeadlinesBanner();
queryHeadlinesList(); //
queryArticleList();
queryArticleList(false);
queryArticleList(true);
}
@override
@ -177,7 +190,7 @@ class _ArticlePage extends State<ArticlePage>
),
onRefresh: _onRefresh,
onLoading: () {
queryArticleList();
queryArticleList(false);
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
@ -207,12 +220,29 @@ class _ArticlePage extends State<ArticlePage>
List<Widget> classChildItem() {
var widgets = <Widget>[
///banner
HeadlinesBanner(
bannerData,
),
// HeadlinesBanner(
// bannerData,
// ),
ActivityTopList(articleTop),
SizedBox(height: 28),
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 16,bottom:5),
child:Text(
"文章专栏",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.black,
),
)
),
///
HeadlinesCollection(headlines, articles),

99
lib/community/headlines/headlines_collection.dart

@ -37,8 +37,8 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
@override
Widget build(BuildContext context) {
return Container(
height: 60.h,
margin: EdgeInsets.only(top: 10),
height: 100.h,
margin: EdgeInsets.only(top:10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
@ -61,7 +61,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
Widget headlinesCollectionItem(HeadlinesList headlines) {
return Container(
width: 225.w,
height: 60.h,
height:100.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
@ -75,7 +75,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
color: Colors.black,
),
margin: EdgeInsets.symmetric(
horizontal: 6,
horizontal:6,
),
child: Stack(
children: [
@ -85,7 +85,7 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
child: MImage(
headlines?.coverImg ?? "",
width: 225.w,
height: 60.h,
height: 100.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
@ -97,69 +97,40 @@ class _HeadlinesCollection extends State<HeadlinesCollection> {
),
),
Container(
padding: EdgeInsets.only(left: 12.w, right: 12.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Row(
children: [
Container(
margin: EdgeInsets.only(right:4),
padding:EdgeInsets.only(left:2,right:2),
height: 16.h,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
color: Color(0xFF32A060),
),
child: Text(
"专栏",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
padding: EdgeInsets.only(left:12.w,right: 12.w,bottom: 8),
alignment: Alignment.bottomLeft,
child: Row(
children: [
Container(
margin: EdgeInsets.only(right:4),
padding:EdgeInsets.only(left:2,right:2),
height:22.h,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
color: Color(0xFF007EFF),
),
Expanded(child:Text(
headlines?.name ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
child: Text(
"专栏",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),),
],)),
// Row(
// children: [
// Expanded(child:Text(
// "更新3篇",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// )),
// Text(
// "查看专栏",
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// SizedBox(width: 2),
// Image.asset(
// "assets/image/t_right.png",
// width: 14,
// height: 14,
// ),
// ],),
],),
),
),
Expanded(child:Text(
headlines?.name ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.semi_bold,
color: Colors.white,
),
),),
],)
),
],
),

28
lib/community/headlines/headlines_column_details.dart

@ -78,7 +78,8 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
"searchKey": "",
"state": 1,
"type": 2,
"categoryId": categoryId
"categoryId": categoryId,
"isHot":false,
}).catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
@ -113,6 +114,7 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
children: [
Positioned(
child: Container(
color: Colors.white,
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
@ -142,14 +144,20 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
Stack(
children: [
Positioned(
child: MImage(
headlinesListDetails?.bannerImg ?? "",
width: double.infinity,
height: 260.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
child: Container(
color: Colors.black,
child:Opacity(
opacity:0.75,
child: MImage(
headlinesListDetails?.bannerImg ?? "",
width: double.infinity,
height: 260.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
)
)
)
),
Container(
margin: EdgeInsets.only(
@ -194,7 +202,7 @@ class _HeadlinesColumnDetails extends State<HeadlinesColumnDetails>
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(2),
color: Color(0xFF32A060),
color: Color(0xFF007EFF),
),
child: Text(
"专栏",

556
lib/community/new_community_details.dart

@ -0,0 +1,556 @@
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 WillPopScope(
onWillPop: () async {
Navigator.of(context).pop(true);
return false;
},
child: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: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:path/path.dart' as p;
class PhotoViewGalleryScreen extends StatefulWidget {
List images=[];
@ -25,7 +28,10 @@ class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
super.initState();
currentIndex=widget.index;
}
File fileFromDocsDir(String filename) {
String pathName = p.join(ImgCachePath.instance.path, filename);
return File(pathName);
}
@override
Widget build(BuildContext context) {
return Scaffold(
@ -41,8 +47,12 @@ class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
scrollPhysics: const BouncingScrollPhysics(),
builder: (BuildContext context, int index) {
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,

31
lib/community/release_dynamic.dart

@ -85,6 +85,37 @@ class _ReleaseDynamic extends State<ReleaseDynamic> {
child: Column(
children: [
buildEdit(),
Container(
width: double.infinity,
margin: EdgeInsets.all(16),
padding: EdgeInsets.only(left: 16,right: 16),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"!",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize:18.sp,
color: Colors.red,
),
),
SizedBox(width: 10,),
Expanded(child: Text(
"用户发布内容需要等待系统审核,审核通过后才会在推荐广场展示",
maxLines:2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
color: Color(0xFFA0A0A0),
),
),)
],
),
),
Expanded(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(

185
lib/home/home_page.dart

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -21,14 +23,18 @@ import 'package:huixiang/retrofit/data/founder.dart';
import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/activity_coupons.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/invite_success_dialog.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/new_people_reward.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -40,9 +46,10 @@ class HomePage extends StatefulWidget {
final Function changeTab;
final String invite;
final List<InterviewCouponList> interviewCouponList;
final List<NewUserCouponList> newUserCouponList;
final List<FirstLoginCouponList> firstLoginCouponList;
HomePage(this.changeTab, {this.invite,this.interviewCouponList,this.newUserCouponList});
HomePage(this.changeTab,
{this.invite, this.interviewCouponList, this.firstLoginCouponList});
@override
State<StatefulWidget> createState() {
@ -62,22 +69,23 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
setState(() {});
}
});
queryMsgStats();
if((widget.invite??"") != "" || widget.interviewCouponList != null
&& widget.interviewCouponList.length > 0)
showInvite = true;
if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null &&
widget.interviewCouponList.length > 0) showInvite = true;
if(widget.newUserCouponList != null && widget.newUserCouponList.length > 0)
if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
showNew = true;
}
///
inviteShowAlertDialog(invite,InterviewCouponList interviewCouponList) {
inviteShowAlertDialog(invite, InterviewCouponList interviewCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return InviteSuccessDialog(invite,interviewCouponList);
return InviteSuccessDialog(invite, interviewCouponList);
},
);
}
@ -114,6 +122,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
List<Goods> gooods = [];
Founder founder;
bool isSigned = false;
int totalMsg = 0;
queryHome() async {
EasyLoading.show(status: S.of(context).zhengzaijiazai);
@ -231,16 +240,45 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
refreshController.refreshFailed();
}
EasyLoading.dismiss();
if(showInvite){
inviteShowAlertDialog(widget.invite,widget.interviewCouponList[0]);
if (showInvite) {
inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
showInvite = false;
}
if(showNew){
newShowAlertDialog(widget.newUserCouponList);
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList);
showNew = false;
}
}
///
queryMsgStats() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
totalMsg = 0;
baseData.data.forEach((element) {
totalMsg += element.number;
});
});
// refreshController.loadComplete();
// refreshController.refreshCompleted();
}
EasyLoading.dismiss();
}
_onRefresh(){
queryHome();
queryMsgStats();
}
@override
void dispose() {
super.dispose();
@ -259,17 +297,56 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
leading: false,
actions: [
Container(
margin: EdgeInsets.only(right: 12.w),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/system_msg_page');
},
child: SvgPicture.asset(
"assets/svg/tixing.svg",
width: 24,
height: 24,
),
height: 24,
alignment: Alignment.center,
margin: EdgeInsets.only(
right: 12.w,
),
child: GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/system_msg_page');
},
child: Container(
height: 24,
alignment:Alignment.center,
child:Stack(
children: [
SvgPicture.asset(
"assets/svg/tixing.svg",
width: 24,
height: 24,
),
if(totalMsg != 0)
Container(
width:36,
alignment: Alignment.topRight,
child:Container(
width:22,
height:14,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
width: 1,
color: Colors.white,
style: BorderStyle.solid,
),
color:Color(0xFFFF441A),
),
child:RoundButton(
text:totalMsg.toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:8.sp,
radius: 100,
)
),
)
],
),
)
)
),
Container(
margin: EdgeInsets.only(right: 16.w),
@ -295,12 +372,13 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
setState(() {});
setState(() {_onRefresh();
});
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: FutureBuilder(
future: queryHome(),
future:queryHome(),
builder: (context, snapshot) {
return Column(
children: [
@ -308,14 +386,16 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
HomeBanner(bannerData, controller),
///
ShortcutOperation((){
ShortcutOperation(() {
widget.changeTab(1);
}),
///
SignView(isSigned,(value){setState(() {
isSigned = value;
});}),
SignView(isSigned, (value) {
setState(() {
isSigned = value;
});
}),
// ///
// HotArticle(articles),
@ -330,12 +410,16 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
// CouponView(),
///
HomeIntegralStore(gooods),
SizedBox(
height: 28,
),
///
FeaturedActivity(),
///
HomeIntegralStore(gooods),
///Tab
PointsGoodsTitle(
gooodsCategorys,
@ -384,7 +468,7 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
(result) async {
if (result) {
await openAppSettings();
}
@ -395,12 +479,22 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
} else if (await Permission.camera.isGranted) {
// http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
if(result.toString().contains("type\":\"coupon")){
///
activityShowAlertDialog(result.toString());
return;
}
// String result = await scanner.scan();
Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"];
String tenantCode = uri.queryParameters["tenantCode"];
String shopId = uri.queryParameters["shopId"];
if (tableId != null && tableId != "" && tenantCode != null && tenantCode != "" && shopId != null && shopId != "") {
if (tableId != null &&
tableId != "" &&
tenantCode != null &&
tenantCode != "" &&
shopId != null &&
shopId != "") {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
@ -412,7 +506,22 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
);
}
} else {
await Permission.camera.request();
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.png",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await Permission.camera.request();
}
},
heightRatioWithWidth: 0.82,
);
});
}
}
@ -423,6 +532,16 @@ class _HomePage extends State<HomePage> with AutomaticKeepAliveClientMixin {
);
}
activityShowAlertDialog(String result) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return ActivityCoupons(result);
},
);
}
@override
bool get wantKeepAlive => true;
}

6
lib/home/home_view/coupon.dart

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

71
lib/home/home_view/featured_acticvity.dart

@ -78,15 +78,15 @@ class _FeaturedActivity extends State<FeaturedActivity> {
child: stackItem(18.sp, activityList[0]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h,
height: 125.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(6),
color: Colors.red,
image: DecorationImage(
image: NetworkImage(
activityList[0].coverImg,
),
fit: BoxFit.fill,
fit: BoxFit.cover,
),
),
),
@ -106,44 +106,44 @@ class _FeaturedActivity extends State<FeaturedActivity> {
child: stackItem(12.sp, activityList[1]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h / 2,
height:125.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
borderRadius: BorderRadius.circular(6),
color: Colors.green,
image: DecorationImage(
image: NetworkImage(
activityList[1].coverImg,
),
fit: BoxFit.fill,
),
),
),
),
SizedBox(
height: 5,
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/web_page',
arguments: {"activityId": activityList[2].id});
},
child: Container(
child: stackItem(12.sp, activityList[2]),
margin: EdgeInsets.symmetric(horizontal: 5.w),
width: (MediaQuery.of(context).size.width - 42) / 2,
height: 190.h / 2,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.blue,
image: DecorationImage(
image: NetworkImage(
activityList[2].coverImg,
),
fit: BoxFit.fill,
fit: BoxFit.cover,
),
),
),
),
// SizedBox(
// height: 5,
// ),
// GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed('/router/web_page',
// arguments: {"activityId": activityList[2].id});
// },
// child: Container(
// child: stackItem(12.sp, activityList[2]),
// margin: EdgeInsets.symmetric(horizontal: 5.w),
// width: (MediaQuery.of(context).size.width - 42) / 2,
// height: 190.h / 2,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(4),
// color: Colors.blue,
// image: DecorationImage(
// image: NetworkImage(
// activityList[2].coverImg,
// ),
// fit: BoxFit.fill,
// ),
// ),
// ),
// ),
],
),
),
@ -160,7 +160,10 @@ class _FeaturedActivity extends State<FeaturedActivity> {
Widget stackItem(double textSize, Activity activity) {
return Container(
color: Color.fromARGB(80, 0, 0, 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Color.fromARGB(80, 0, 0, 0),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -176,7 +179,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
maxLines: 1,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: textSize,
fontSize: 14.sp,
color: Colors.white,
),
),
@ -195,7 +198,7 @@ class _FeaturedActivity extends State<FeaturedActivity> {
),
),
Container(
width: 58.w,
width: 48.w,
margin: EdgeInsets.only(left: 8, bottom: 8),
padding: EdgeInsets.symmetric(
vertical: 4.h,

2
lib/home/home_view/quick_order.dart

@ -160,7 +160,7 @@ class _QuickOrder extends State<QuickOrder> {
children: [
ItemTitle(
text: "店铺推荐",
imgPath: "assets/image/icon_points_mall.png",
imgPath: "assets/image/icon_shop.png",
),
Container(
height: 170,

2
lib/home/home_view/shortcut_operation.dart

@ -121,7 +121,7 @@ class _ShortcutOperation extends State<ShortcutOperation> {
),
SizedBox(height: 5),
Text(
"充值送会员!",
"会员享有赠送",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,

5
lib/home/points_mall_view/points_goods_title.dart

@ -3,6 +3,7 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:huixiang/view_widget/my_tab.dart';
class PointsGoodsTitle extends StatefulWidget {
@ -41,6 +42,10 @@ class _PointsGoodsTitle extends State<PointsGoodsTitle> {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ItemTitle(
text: S.of(context).jifenshangcheng,
imgPath: "assets/image/icon_points_mall.png",
),
// ItemTitle(
// text: S.of(context).jifenshangcheng,
// imgPath: "assets/image/icon_points_mall.png",

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/utils/font_weight.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_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

26
lib/login/login_page.dart

@ -342,7 +342,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
Navigator.of(context).pushNamedAndRemoveUntil(
'/router/main_page',
(route) => false,arguments:{"invite":invite,"interviewCouponList":value.data.interviewCouponList,
"newUserCouponList":value.data.newUserCouponList});
"firstLoginCouponList":value.data.firstLoginCouponList});
EasyLoading.dismiss();
} else {
@ -512,20 +512,16 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_login_logo.png",
width: 91.w,
height: 91.h,
),
SizedBox(
height: 0.596.sh,
),
],
),
Container(
height: MediaQuery.of(context).size.height * 0.78,
margin: EdgeInsets.only(top: 56.h),
alignment: Alignment.topCenter,
child:Image.asset(
"assets/image/icon_login_logo.png",
width: 91.w,
height: 91.h,
),
)
],
),
),

12
lib/main.dart

@ -62,6 +62,7 @@ import 'package:huixiang/store/store_order.dart';
import 'package:huixiang/settlement/settlement.dart';
import 'package:huixiang/test_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/union/union_details_page.dart';
@ -77,10 +78,12 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
import 'community/community_view/class_details.dart';
import 'community/headlines/headlines_column_details.dart';
import 'community/new_community_details.dart';
import 'community/photo_view_gallery_screen.dart';
import 'home/guide_page.dart';
import 'home/home_view/activity_list.dart';
import 'main_page.dart';
import 'message/system_details.dart';
import 'mine/manage_address_page.dart';
import 'mine/mine_view/community_follow.dart';
import 'mine/mine_vip/binding_assistant_card.dart';
@ -105,10 +108,11 @@ void main() async {
Locale locale;
if (sharedPreferences.containsKey("language") &&
sharedPreferences.getString("language") == "zh") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CN');
} else {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} else {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH');
}
ImgCachePath();
initSdk();
bool isFirst = sharedPreferences.getBool("isFirst");
@ -319,6 +323,8 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(),
'/router/community_details': (context, {arguments}) =>
CommunityDetails(arguments: arguments),
'/router/new_community_details': (context, {arguments}) =>
NewCommunityDetails(arguments: arguments),
'/router/user_info_page': (context, {arguments}) => UserInfoPage(),
'/router/recharge_page': (context, {arguments}) => RechargePage(),
'/router/mine_wallet': (context, {arguments}) => MineWalletPage(),
@ -352,4 +358,6 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
GroupPageDetails(arguments:arguments),
'/router/photo_view_gallery_screen': (context, {arguments}) =>
PhotoViewGalleryScreen(),
'/router/system_details': (context, {arguments}) =>
SystemDetails(arguments:arguments),
};

12
lib/main_page.dart

@ -82,15 +82,15 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
String invite = "";
var interviewCouponList;
var newUserCouponList;
var firstLoginCouponList;
if(widget.arguments != null && (widget.arguments["invite"]??"") != ""
&& widget.arguments["interviewCouponList"] != null ){
invite = widget.arguments["invite"];
interviewCouponList = widget.arguments["interviewCouponList"];
}
if(widget.arguments != null && widget.arguments["newUserCouponList"] != null ){
newUserCouponList = widget.arguments["newUserCouponList"];
if(widget.arguments != null && widget.arguments["firstLoginCouponList"] != null ){
firstLoginCouponList = widget.arguments["firstLoginCouponList"];
}
_widgetOptions = <Widget>[
@ -99,7 +99,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
setState(() {
pageController.jumpToPage(index);
});
},invite:invite,interviewCouponList:interviewCouponList,newUserCouponList:newUserCouponList,),
},invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,),
// MainHomePage(),
UnionPage(),
CommunityPage(),
@ -196,11 +196,11 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
Map<String, dynamic> params = {};
switch (pushMap["typed"]) {
case 1:
routeName = "/router/store_detail_page";
routeName = "/router/web_page";
params["articleId"] = pushMap["info"];
break;
case 2:
routeName = "/router/store_detail_page";
routeName = "/router/web_page";
params["activityId"] = pushMap["info"];
break;
case 3:

1106
lib/message/system_details.dart

File diff suppressed because it is too large Load Diff

658
lib/message/system_message.dart

@ -1,8 +1,10 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/message.dart';
import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -10,6 +12,7 @@ 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/no_data_view.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -23,6 +26,17 @@ class SystemMessagePage extends StatefulWidget {
class _SystemMessagePage extends State<SystemMessagePage> {
ApiService apiService;
int pageNum = 1;
List<Message> messages = [];
Map <String,int> msgNumber = {
"1":0,
"2":0,
"3":0,
"4":0,
"5":0,
"6":0,
};
int state = 0;
@override
void initState() {
@ -32,15 +46,14 @@ class _SystemMessagePage extends State<SystemMessagePage> {
apiService =
ApiService(Dio(), token: value.getString("token"), context: context);
queryMessage();
queryMsgStats();
});
}
int pageNum = 1;
List<Message> messages = [];
_refresh() {
pageNum = 1;
queryMessage();
queryMsgStats();
}
queryMessage() async {
@ -59,7 +72,13 @@ class _SystemMessagePage extends State<SystemMessagePage> {
if (pageNum == 1) {
messages.clear();
}
messages.addAll(baseData.data.list);
List<Message> message = [];
message.addAll(baseData.data.list);
message.forEach((element) {
if(element.typed==2 || element.typed==3){
messages.add(element);
}
});
_refreshController.loadComplete();
_refreshController.refreshCompleted();
if (mounted) setState(() {});
@ -74,17 +93,65 @@ class _SystemMessagePage extends State<SystemMessagePage> {
}
}
queryMsgStats() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<MsgStats>> baseData = await apiService.stats().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
msgNumber.forEach((key, value) {
msgNumber[key] = 0;
});
baseData.data.forEach((element) {
if(msgNumber.containsKey(element.name)){
msgNumber[element.name] = element.number;
}
});
});
_refreshController.loadComplete();
_refreshController.refreshCompleted();
}
EasyLoading.dismiss();
}
RefreshController _refreshController = RefreshController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MyAppBar(
background: Color(0xFFF7F7F7),
background: Colors.white,
leadingColor: Colors.black,
title: S.of(context).xitongxiaoxi,
title: S.of(context).xiaoxi,
titleSize: 18.sp,
titleColor: Colors.black,
actions: [
Container(
margin: EdgeInsets.only(right: 16.w),
alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () {
setState(() {
queryMsgStats();
});
},
child: Text(
"标为已读",
style: TextStyle(
fontSize: 16.sp,
fontWeight:MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
),
),
),
],
),
body: SmartRefresher(
enablePullDown: true,
@ -94,159 +161,490 @@ class _SystemMessagePage extends State<SystemMessagePage> {
footer: CustomFooter(
loadStyle: LoadStyle.ShowWhenLoading,
builder: (BuildContext context, LoadStatus mode) {
return MyFooter(mode);
return (messages.length == 0)?Container():MyFooter(mode);
},
),
controller: _refreshController,
onRefresh: _refresh,
onLoading: () {
queryMessage();
setState(() {
_refresh();
});
},
child: (messages == null || messages.length == 0)
? NoDataView(
isShowBtn: false,
text: S.of(context).haimeiyouxiaoxi,
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
)
: ListView.builder(
padding: EdgeInsets.only(top: 16),
itemCount: messages.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
if (messages[position].typed == 2) {
Navigator.of(context)
.pushNamed('/router/exchange_order_details');
}
},
child: buildMessageItem(messages[position]),
);
}),
child: Container(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
child: Column(
children: [
newsSurvey(),
SizedBox(height: 16.h,),
buildMessage(),
],
),
),
),
),
),
);
}
Widget buildMessageItem(Message message) {
Widget newsSurvey(){
return Container(
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
padding: EdgeInsets.all(20.w),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
color: Colors.white,
padding: EdgeInsets.only(top: 16.h,bottom: 16.h),
child: Row(
children: [
Expanded(child: GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":5});
},
child:Column(
children: [
Stack(
children: [
Image.asset(
"assets/image/icon_z.png",
width: 40,
height: 40,
),
if(msgNumber["5"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
child:Container(
width:20,
height:17,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
width: 1,
color: Colors.white,
style: BorderStyle.solid,
),
color:Color(0xFFFF441A),
),
child:RoundButton(
text:msgNumber["5"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:8.sp,
radius: 100,
)
),
)
],
),
SizedBox(height: 6.h),
Text(
"点赞",
style: TextStyle(
fontSize: 14.sp,
fontWeight:MyFontWeight.medium,
color: Color(0xFF060606),
),
)
],
)
)
),
Expanded(child:
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":6});
},
child: Column(
children: [
Stack(
children: [
Image.asset(
"assets/image/icon_pl.png",
width: 40,
height: 40,
),
if(msgNumber["6"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
child:Container(
width:16,
height:16,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
width: 1,
color: Colors.white,
style: BorderStyle.solid,
),
color:Color(0xFFFF441A),
),
child:RoundButton(
text: msgNumber["6"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:8.sp,
radius: 100,
)
),
)
],
),
SizedBox(height: 6.h),
Text(
S.of(context).pinglun,
style: TextStyle(
fontSize: 14.sp,
fontWeight:MyFontWeight.medium,
color: Color(0xFF060606),
),
),
],
)
)),
Expanded(child:
GestureDetector(
onTap: (){
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":4});
},
child:Column(
children: [
Stack(
children: [
Image.asset(
"assets/image/icon_gz.png",
width: 40,
height: 40,
),
if(msgNumber["4"].toString() != "0")
Container(
width:48,
alignment: Alignment.topRight,
child:Container(
width:16,
height:16,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
width: 1,
color: Colors.white,
style: BorderStyle.solid,
),
color:Color(0xFFFF441A),
),
child:RoundButton(
text: msgNumber["4"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:8.sp,
radius: 100,
)
),
)
],
),
SizedBox(height: 6.h),
Text(
S.of(context).guanzhu,
style: TextStyle(
fontSize: 14.sp,
fontWeight:MyFontWeight.medium,
color: Color(0xFF060606),
),
),
],
)
)
),
],
borderRadius: BorderRadius.circular(8),
),
);
}
Widget buildMessage(){
return Container(
color: Colors.white,
width: double.infinity,
padding: EdgeInsets.all(20.w),
child:Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).xitongxiaoxi,
style: TextStyle(
fontSize: 16.sp,
fontWeight:MyFontWeight.semi_bold,
color: Colors.black,
),
),
(messages == null || messages.length == 0)
? NoDataView(
isShowBtn: false,
text: S.of(context).haimeiyouxiaoxi,
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
)
:ListView.builder(
padding: EdgeInsets.only(top: 16),
itemCount: messages.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
if(messages[position].typed == 2)
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":2});
else if(messages[position].typed == 3)
Navigator.of(context)
.pushNamed('/router/system_details',arguments: {"msgType":3});
},
child: buildMessageItem(messages[position]),
);
}),
],
)
);
}
Widget buildMessageItem(Message message) {
return Container(
margin: EdgeInsets.only(top: 8.h, bottom: 8.h),
// margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 8.h, bottom: 8.h),
// padding: EdgeInsets.all(20.w),
// decoration: BoxDecoration(
// color: Colors.white,
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// )
// ],
// borderRadius: BorderRadius.circular(8),
// ),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
(message.typed == 1)
? "assets/image/icon_system_notices.png"
: (message.typed == 2)
? "assets/image/icon_system_order.png"
: "assets/image/icon_system_recharge.png",
width: 24.w,
height: 24.h,
),
SizedBox(
width: 4.w,
),
Text(
(message.typed == 1)
? S.of(context).xitongtongzhi
: (message.typed == 2)
? S.of(context).dingdanxiaoxi
: S.of(context).chongzhixiaoxi,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF060606),
),
)
],
Image.asset(
(message.typed == 1)
? "assets/image/icon_system_message.png"
: (message.typed == 2)
? "assets/image/icon_system_message.png"
: "assets/image/c_z.png",
width: 40.w,
height: 40.h,
),
Text(
message.updateTime,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
),
SizedBox(
width:12.w,
),
],
),
if (message.typed != 3)
Container(
margin: EdgeInsets.only(left: 28.w, top: 12.h),
child: Text(
S.of(context).ninyouyigexindedingdan,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF353535),
),
),
)
else
Container(
margin: EdgeInsets.only(left: 28.w, top: 18.h),
child: Text(
message.title,
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
),
),
if (message.typed != 3)
Container(
margin: EdgeInsets.only(left: 28.w, top: 22.h),
child: Row(
Expanded(child:Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).chakangengduo,
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
),
Row(
children: [
Expanded(child:Text(
(message.typed == 1)
? S.of(context).xitongtongzhi
: (message.typed == 2)
? S.of(context).dingdanxiaoxi
: S.of(context).chongzhixiaoxi,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF060606),
),
)),
Text(
message.updateTime,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFFA29E9E),
),
),
],
),
SizedBox(height:4.h,),
(message.typed != 3) ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
S.of(context).ninyouyigexindedingdan,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF353535),
),
),),
if(msgNumber["2"].toString() != "0")
RoundButton(
width: 16,
height: 16,
text:msgNumber["2"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:10.sp,
radius: 100,
),
],
):
Row(
mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
message.content,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF353535),
),
)),
if(msgNumber["3"].toString() != "0")
RoundButton(
width: 16,
height: 16,
text:msgNumber["3"].toString(),
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFFFF441A),
fontSize:10.sp,
radius: 100,
),
],
),
Icon(
Icons.keyboard_arrow_right,
color: Colors.black,
)
],
),
)
else
Container(
margin: EdgeInsets.only(left: 28.w, top: 22.h),
child: Text(
message.content,
style: TextStyle(
fontSize: 10.sp,
color: Color(0xFF353535),
),
),
),
)),
],
),
Container(
margin: EdgeInsets.only(top: 16.h,bottom:8.h),
height: 1.h,
width: double.infinity,
color: Color(0xFFF7F7F7),
),
],
),
// Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Row(
// children: [
// Image.asset(
// (message.typed == 1)
// ? "assets/image/icon_system_notices.png"
// : (message.typed == 2)
// ? "assets/image/icon_system_order.png"
// : "assets/image/icon_system_recharge.png",
// width: 24.w,
// height: 24.h,
// ),
// SizedBox(
// width: 4.w,
// ),
// Text(
// (message.typed == 1)
// ? S.of(context).xitongtongzhi
// : (message.typed == 2)
// ? S.of(context).dingdanxiaoxi
// : S.of(context).chongzhixiaoxi,
// style: TextStyle(
// fontSize: 14.sp,
// fontWeight: FontWeight.bold,
// color: Color(0xFF060606),
// ),
// )
// ],
// ),
// Text(
// message.updateTime,
// style: TextStyle(
// fontSize: 10.sp,
// color: Color(0xFFA29E9E),
// ),
// ),
// ],
// ),
// if (message.typed != 3)
// Container(
// margin: EdgeInsets.only(left: 28.w, top: 12.h),
// child: Text(
// S.of(context).ninyouyigexindedingdan,
// style: TextStyle(
// fontSize: 10.sp,
// color: Color(0xFF353535),
// ),
// ),
// )
// else
// Container(
// margin: EdgeInsets.only(left: 28.w, top: 18.h),
// child: Text(
// message.title,
// style: TextStyle(
// fontSize: 20.sp,
// fontWeight: MyFontWeight.semi_bold,
// color: Color(0xFF353535),
// ),
// ),
// ),
// if (message.typed != 3)
// Container(
// margin: EdgeInsets.only(left: 28.w, top: 22.h),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// S.of(context).chakangengduo,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: FontWeight.bold,
// color: Color(0xFF353535),
// ),
// ),
// Icon(
// Icons.keyboard_arrow_right,
// color: Colors.black,
// )
// ],
// ),
// )
// else
// Container(
// margin: EdgeInsets.only(left: 28.w, top: 22.h),
// child: Text(
// message.content,
// style: TextStyle(
// fontSize: 10.sp,
// color: Color(0xFF353535),
// ),
// ),
// ),
// ],
// ),
);
}
}

175
lib/mine/mine_page.dart

@ -212,7 +212,6 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
),
),
/////
attention(),
@ -313,8 +312,8 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
/////
Widget attention(){
return Container(
padding: EdgeInsets.only(bottom: 16,top: 16),
margin: EdgeInsets.only(left: 16,top:16,right: 16),
margin: EdgeInsets.only(left: 16, top: 10, right: 16),
// padding: EdgeInsets.only(top: 16,bottom: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
@ -327,109 +326,123 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
),
],
),
child:GestureDetector(
onTap:(){
Navigator.of(context).pushNamed(
'/router/communityFollow',
arguments: {},
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap:(){
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed(
'/router/communityFollow',
arguments: {},
);
},
child:
Column(
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(16),
child: Column(
children: [
Text(
S.of(context).guanzhu,
infoNumber != null ? infoNumber.follow.toString() : "0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(height: 5,),
SizedBox(
height: 4,
),
Text(
infoNumber != null ?infoNumber.follow.toString() :"0",
S.of(context).guanzhu,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
)),
),
GestureDetector(
onTap:(){
),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed(
'/router/communityFollow',
arguments: {},
);
},
child:
Column(
children: [
Text(
S.of(context).fensi,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 5,),
Text(
infoNumber != null ?infoNumber.fans.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(16),
child: Column(
children: [
Text(
infoNumber != null ? infoNumber.fans.toString() : "0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
height: 4,
),
Text(
S.of(context).fensi,
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
)),
),
GestureDetector(
onTap:(){
Navigator.of(context).pushNamed(
'/router/mine_attainment_page',
arguments: {"userInfo":userInfo},
);
},
child:
Column(
children: [
Text(
"成就",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 5,),
Text(
infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed(
'/router/mine_attainment_page',
arguments: {"userInfo": userInfo},
);
},
child: Container(
color: Colors.transparent,
padding: EdgeInsets.all(16),
child: Column(
children: [
Text(
infoNumber != null
? infoNumber.achievementNumber.toString()
: "0",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 15.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(
height: 4,
),
Text(
"成就",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
],
),
),
],
),
)),
],
),
);
}

42
lib/mine/mine_view/mine_view.dart

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/activity_coupons.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
@ -42,8 +43,8 @@ class _MineView extends State<MineView> {
padding: EdgeInsets.all(8.h),
child: Image.asset(
"assets/image/icon_scan_qr_code.png",
width: 24.w,
height: 24.h,
width:32.w,
height: 32.h,
),
),
),
@ -56,8 +57,8 @@ class _MineView extends State<MineView> {
margin: EdgeInsets.only(right: 12.w),
child: Image.asset(
"assets/image/icon_mine_setting.png",
width: 24.w,
height: 24.h,
width: 32.w,
height: 32.h,
),
),
),
@ -93,6 +94,11 @@ class _MineView extends State<MineView> {
} else if (await Permission.camera.isGranted) {
// http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
if(result.toString().contains("type\":\"coupon")){
///
activityShowAlertDialog(result.toString());
return;
}
// String result = await scanner.scan();
Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"];
@ -119,6 +125,16 @@ class _MineView extends State<MineView> {
}
}
activityShowAlertDialog(String result) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return ActivityCoupons(result);
},
);
}
///
Widget mineView() {
return Container(
@ -197,6 +213,7 @@ class _MineView extends State<MineView> {
),
),
),
if(widget.userInfo.level != 1)
Image.asset(
"assets/image/icon_user.png",
width: 18.w,
@ -253,19 +270,24 @@ class _MineView extends State<MineView> {
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Image.asset(
"assets/image/ji_fen.png",
width: 16.w,
height: 16.h,
),
Text(
S.of(context).jifenxiangqing,
"签到得积分",
style: TextStyle(
color: Colors.black,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
Icon(
Icons.keyboard_arrow_right,
size: 16,
color: Colors.black,
)
// Icon(
// Icons.keyboard_arrow_right,
// size: 16,
// color: Colors.black,
// )
],
),
)),

184
lib/mine/mine_view/wallet_coupon_view.dart

@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -30,11 +31,8 @@ class _WalletCoupon extends State<WalletCoupon> {
),
],
),
child: Row(
children: [
Expanded(
flex: 1,
child: GestureDetector(
child: (Theme.of(context).platform == TargetPlatform.android)
? GestureDetector(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
@ -46,8 +44,6 @@ class _WalletCoupon extends State<WalletCoupon> {
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_mine_invoice_assistant.png",
@ -58,70 +54,128 @@ class _WalletCoupon extends State<WalletCoupon> {
width: 12.w,
),
Expanded(
child: Text(
S.of(context).lingquanzhongxin,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Color(0xFF353535),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).lingquanzhongxin,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Color(0xFF353535),
),
),
SizedBox(
height: 3,
),
Text(
"联盟下单享不停、海量优惠券等你来领!",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 12.sp,
color: Color(0xFF7B7B7B),
),
),
],
),
flex: 1,
),
)
],
),
),
),
Container(
width: 2.w,
height: 32.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w),
color: Color(0xFFF7F7F7),
),
Expanded(
flex: 1,
child: GestureDetector(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_wallet');
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_mine_wallet.png",
width: 48.h,
height: 48.h,
),
SizedBox(
width: 12.w,
))
: Row(
children: [
Expanded(
flex: 1,
child: GestureDetector(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context)
.pushNamed('/router/roll_center_page');
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_mine_invoice_assistant.png",
width: 48.h,
height: 48.h,
),
SizedBox(
width: 12.w,
),
Expanded(
child: Text(
S.of(context).lingquanzhongxin,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Color(0xFF353535),
),
),
flex: 1,
),
],
),
),
Expanded(
child: Text(
S.of(context).wodeqianbao,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Color(0xFF353535),
),
),
Container(
width: 2.w,
height: 32.h,
margin: EdgeInsets.only(left: 20.w, right: 20.w),
color: Color(0xFFF7F7F7),
),
Expanded(
flex: 1,
child: GestureDetector(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
Navigator.of(context).pushNamed('/router/mine_wallet');
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/image/icon_mine_wallet.png",
width: 48.h,
height: 48.h,
),
SizedBox(
width: 12.w,
),
Expanded(
child: Text(
S.of(context).wodeqianbao,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Color(0xFF353535),
),
),
flex: 1,
),
],
),
flex: 1,
),
],
),
),
],
),
),
],
),
);
}
}

28
lib/mine/mine_wallet_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/utils/font_weight.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/no_data_view.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
@ -57,7 +58,8 @@ class _MineWalletPage extends State<MineWalletPage> {
}
queryUserBalance() async {
BaseData<UserInfo> baseData = await apiService.queryInfo().catchError((onError) {});
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
mBalance = double.tryParse(userInfo.money);
@ -168,14 +170,21 @@ class _MineWalletPage extends State<MineWalletPage> {
),
Container(
margin: EdgeInsets.only(top: 14.h),
child: ListView.builder(
itemCount: userBills != null ? userBills.length : 0,
shrinkWrap: true,
padding: EdgeInsets.only(bottom: 20.h),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return historyItem(userBills[position], position);
}),
child: (userBills == null || userBills.length == 0)
? NoDataView(
isShowBtn: false,
text: "目前暂未记录哦",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h),
)
: ListView.builder(
itemCount: userBills != null ? userBills.length : 0,
shrinkWrap: true,
padding: EdgeInsets.only(bottom: 20.h),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return historyItem(userBills[position], position);
}),
),
],
),
@ -200,6 +209,7 @@ class _MineWalletPage extends State<MineWalletPage> {
Expanded(
flex: 1,
child: Container(
// height: 34.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

34
lib/mine/release_page.dart

@ -1,8 +1,11 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/community/community_view/community_dynamic.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/article.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/page.dart';
@ -26,7 +29,7 @@ class _ReleasePage extends State<ReleasePage> {
int pageNum = 0;
String userId;
List<ComunityComment> comments = [];
List<Article> articles = [];
@override
void initState() {
@ -66,10 +69,24 @@ class _ReleasePage extends State<ReleasePage> {
refreshController.loadComplete();
if (baseData.isSuccess) {
if (pageNum == 1) {
comments.clear();
articles.clear();
}
comments.addAll(baseData.data.list);
print("comments: ${comments.length}");
baseData.data.list.forEach((element) {
var article = Article();
article.id = element.id;
article.content = jsonEncode(element.subjectInfo);
article.mainTitle =element.subject;
article.liked = element.selfFollow;
article.authorHeadImg = element.memberInfo?.avatar;
article.authorName = element.memberInfo?.nickname;
article.createTime = element.createTime;
article.updateUser = element.memberInfo?.mid;
article.viewers = element?.viewers;
article.likes = element?.likes;
article.comments = element?.comments;
articles.add(article);
});
// print("comments: ${comments.length}");
if (int.tryParse(baseData.data.total) < (pageNum * 10)) {
refreshController.loadNoData();
}
@ -109,8 +126,9 @@ class _ReleasePage extends State<ReleasePage> {
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(
comments[position],
1,exitFull: (){setState(() {
articles[position],
1,
exitFull: (){setState(() {
_onRefresh();
});},
removalDynamic: () {
@ -121,13 +139,13 @@ class _ReleasePage extends State<ReleasePage> {
Navigator.of(context).pushNamed(
'/router/community_details',
arguments: {
"comment": comments[position],"userId":userId,
"businessId": articles[position].id,"userId":userId,
},
);
},
);
},
itemCount: comments.length,
itemCount: articles.length,
)),
);
},

2
lib/order/order_view/order_commodity.dart

@ -169,7 +169,7 @@ class _OrderCommodity extends State<OrderCommodity> {
margin: EdgeInsets.only(
left: 16.w,
),
height: 44.h,
// height: 44.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,

102
lib/retrofit/data/article.dart

@ -14,7 +14,7 @@ class Article {
dynamic _viceTitle;
String _content;
String _coverImg;
Author _author;
dynamic _author;
int _type;
String _startTime;
String _categoryId;
@ -26,6 +26,8 @@ class Article {
bool _liked;
int _viewers;
int _comments;
String _authorName;
String _authorHeadImg;
bool isFollow;
dynamic _storeName;
@ -39,7 +41,7 @@ class Article {
dynamic get viceTitle => _viceTitle;
String get content => _content;
String get coverImg => _coverImg;
Author get author => _author;
dynamic get author => _author;
int get type => _type;
String get startTime => _startTime;
String get categoryId => _categoryId;
@ -51,8 +53,14 @@ class Article {
bool get liked => _liked;
int get viewers => _viewers;
int get comments => _comments;
String get authorName => _authorName;
String get authorHeadImg => _authorHeadImg;
dynamic get storeName => _storeName;
set id(String value) {
_id = value;
}
set likes(int value) {
_likes = value;
}
@ -69,6 +77,14 @@ class Article {
_comments = value;
}
set authorName(String value) {
_authorName = value;
}
set authorHeadImg(String value) {
_authorHeadImg = value;
}
Article({
String id,
String createTime,
@ -90,6 +106,9 @@ class Article {
bool isHot,
int viewers,
int comments,
String authorName,
String authorHeadImg,
dynamic storeName}){
_id = id;
_createTime = createTime;
@ -113,6 +132,8 @@ class Article {
_liked = liked;
_viewers = viewers;
_comments = comments;
_authorName = authorName;
_authorHeadImg = authorHeadImg;
_storeName = storeName;
}
@ -127,7 +148,7 @@ class Article {
_viceTitle = json["viceTitle"];
_content = json["content"];
_coverImg = json["coverImg"];
_author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"]));
_author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null;
_type = json["type"];
_startTime = json["startTime"];
_categoryId = json["categoryId"];
@ -139,6 +160,8 @@ class Article {
_liked = json["liked"];
_viewers = json["viewers"];
_comments = json["comments"];
_authorName = json["authorName"];
_authorHeadImg = json["authorHeadImg"];
_storeName = json["storeName"];
}
@ -166,8 +189,81 @@ class Article {
map["liked"] = _liked;
map["viewers"] = _viewers;
map["comments"] = _comments;
map["authorName"] = _authorName;
map["authorHeadImg"] = _authorHeadImg;
map["storeName"] = _storeName;
return map;
}
set createTime(String value) {
_createTime = value;
}
set createUser(dynamic value) {
_createUser = value;
}
set updateTime(String value) {
_updateTime = value;
}
set updateUser(dynamic value) {
_updateUser = value;
}
set storeId(String value) {
_storeId = value;
}
set mainTitle(String value) {
_mainTitle = value;
}
set viceTitle(dynamic value) {
_viceTitle = value;
}
set content(String value) {
_content = value;
}
set coverImg(String value) {
_coverImg = value;
}
set author(dynamic value) {
_author = value;
}
set type(int value) {
_type = value;
}
set startTime(String value) {
_startTime = value;
}
set categoryId(String value) {
_categoryId = value;
}
set endTime(String value) {
_endTime = value;
}
set state(int value) {
_state = value;
}
set isDelete(int value) {
_isDelete = value;
}
set isHot(bool value) {
_isHot = value;
}
set storeName(dynamic value) {
_storeName = value;
}
}

257
lib/retrofit/data/login_info.dart

@ -1,16 +1,19 @@
/// authInfo : {"token":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJhY2NvdW50IjoiMTU2MTU2OTg3NDUiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.KHiw51SQ2RkARJhGKFTXgI7IrYXOhN-YqFZCwJ1jkEc","tokenType":"token","refreshToken":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.jjI0dTviahPq6p4J_tx_Sn-Fg-q51kE3WPpqdVcEIMw","name":"回乡_888888","account":"15615698745","avatar":null,"workDescribe":null,"userId":"1470702592303562752","userType":"PLATFORM_APP","expire":"2592000","expiration":"2022-01-13 18:29:59","mobile":"15615698745"}
/// interviewCouponList : [{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1}]
/// newUserCouponList : [{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1},{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1},{"id":"1463398002331746304","createTime":"2021-11-24 14:44:07","createUser":"1333246101196636160","updateTime":"2021-11-24 14:44:07","updateUser":"1333246101196636160","storeId":"0","couponName":"满10-2","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"2.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2021-11-24 12:00:00","publishEndTime":"2021-11-30 12:00:00","useStartTime":"2021-11-24 12:00:00","useEndTime":"2021-11-30 12:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":true,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹奶茶店","number":1}]
/// authInfo : {"token":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJhY2NvdW50IjoiMTU0NDc4OTg3NTYiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.dIGWaCR6uuJ4YcgTfEEeVGJtOmpAlLaxQ2sEnd_9_zw","tokenType":"token","refreshToken":"eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.ZrG-JCemN_HtFzE512311Tksh2o21ywgjHhhGeXXWrE","name":"回乡_888888","account":"15447898756","avatar":null,"workDescribe":null,"userId":"1484477944838488064","userType":"PLATFORM_APP","expire":"2592000","expiration":"2022-02-20 18:48:19","mobile":"15447898756"}
/// interviewCouponList : [{"id":"1478615682588344320","createTime":"2022-01-05 14:33:45","createUser":"1333246101196636160","updateTime":"2022-01-05 14:33:45","updateUser":"1333246101196636160","storeId":"0","couponName":"新品10-5","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"10.00","discountAmount":"5.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-02 00:00:00","useEndTime":"2022-01-30 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹茶","number":1}]
/// newUserCouponList : null
/// firstLoginCouponList : [{"id":"1484456566340976640","createTime":"2022-01-21 17:23:20","createUser":"1333246101196636160","updateTime":"2022-01-21 17:23:20","updateUser":"1333246101196636160","storeId":"1333246101343436800","couponName":"新会员","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"14.00","discountAmount":"7.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-01 00:00:00","useEndTime":"2022-02-01 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1175","isDelete":0,"storeName":"海峡姐妹茶(汉街店)","number":1},{"id":"1484456980566245376","createTime":"2022-01-21 17:24:59","createUser":"1336877238389309440","updateTime":"2022-01-21 17:24:59","updateUser":"1336877238389309440","storeId":"1328618782985289728","couponName":"新会员8-8","bizType":1,"allProduct":true,"productSkuId":[],"fullAmount":"8.00","discountAmount":"8.00","fullNumber":1,"discountPercent":100,"sellPrice":"0.00","sellCount":0,"bizId":"","publishStartTime":"2022-01-01 00:00:00","publishEndTime":"2022-01-31 00:00:00","useStartTime":"2022-01-01 00:00:00","useEndTime":"2022-01-31 00:00:00","promotionId":"0","dateOrDay":false,"startAfterDays":0,"daysValidate":0,"businessType":0,"centreDisplay":false,"tenantCode":"1174","isDelete":0,"storeName":"前进麦味(凯德1818店)","number":1}]
class LoginInfo {
LoginInfo({
AuthInfo authInfo,
List<InterviewCouponList> interviewCouponList,
List<NewUserCouponList> newUserCouponList,}){
AuthInfo authInfo,
List<InterviewCouponList> interviewCouponList,
dynamic newUserCouponList,
List<FirstLoginCouponList> firstLoginCouponList,}){
_authInfo = authInfo;
_interviewCouponList = interviewCouponList;
_newUserCouponList = newUserCouponList;
}
_firstLoginCouponList = firstLoginCouponList;
}
LoginInfo.fromJson(dynamic json) {
_authInfo = json['authInfo'] != null ? AuthInfo.fromJson(json['authInfo']) : null;
@ -20,20 +23,23 @@ class LoginInfo {
_interviewCouponList.add(InterviewCouponList.fromJson(v));
});
}
if (json['newUserCouponList'] != null) {
_newUserCouponList = [];
json['newUserCouponList'].forEach((v) {
_newUserCouponList.add(NewUserCouponList.fromJson(v));
_newUserCouponList = json['newUserCouponList'];
if (json['firstLoginCouponList'] != null) {
_firstLoginCouponList = [];
json['firstLoginCouponList'].forEach((v) {
_firstLoginCouponList.add(FirstLoginCouponList.fromJson(v));
});
}
}
AuthInfo _authInfo;
List<InterviewCouponList> _interviewCouponList;
List<NewUserCouponList> _newUserCouponList;
dynamic _newUserCouponList;
List<FirstLoginCouponList> _firstLoginCouponList;
AuthInfo get authInfo => _authInfo;
List<InterviewCouponList> get interviewCouponList => _interviewCouponList;
List<NewUserCouponList> get newUserCouponList => _newUserCouponList;
dynamic get newUserCouponList => _newUserCouponList;
List<FirstLoginCouponList> get firstLoginCouponList => _firstLoginCouponList;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
@ -43,79 +49,80 @@ class LoginInfo {
if (_interviewCouponList != null) {
map['interviewCouponList'] = _interviewCouponList.map((v) => v.toJson()).toList();
}
if (_newUserCouponList != null) {
map['newUserCouponList'] = _newUserCouponList.map((v) => v.toJson()).toList();
map['newUserCouponList'] = _newUserCouponList;
if (_firstLoginCouponList != null) {
map['firstLoginCouponList'] = _firstLoginCouponList.map((v) => v.toJson()).toList();
}
return map;
}
}
/// id : "1463398002331746304"
/// createTime : "2021-11-24 14:44:07"
/// id : "1484456566340976640"
/// createTime : "2022-01-21 17:23:20"
/// createUser : "1333246101196636160"
/// updateTime : "2021-11-24 14:44:07"
/// updateTime : "2022-01-21 17:23:20"
/// updateUser : "1333246101196636160"
/// storeId : "0"
/// couponName : "满10-2"
/// storeId : "1333246101343436800"
/// couponName : "新会员"
/// bizType : 1
/// allProduct : true
/// productSkuId : []
/// fullAmount : "10.00"
/// discountAmount : "2.00"
/// fullAmount : "14.00"
/// discountAmount : "7.00"
/// fullNumber : 1
/// discountPercent : 100
/// sellPrice : "0.00"
/// sellCount : 0
/// bizId : ""
/// publishStartTime : "2021-11-24 12:00:00"
/// publishEndTime : "2021-11-30 12:00:00"
/// useStartTime : "2021-11-24 12:00:00"
/// useEndTime : "2021-11-30 12:00:00"
/// publishStartTime : "2022-01-01 00:00:00"
/// publishEndTime : "2022-01-31 00:00:00"
/// useStartTime : "2022-01-01 00:00:00"
/// useEndTime : "2022-02-01 00:00:00"
/// promotionId : "0"
/// dateOrDay : false
/// startAfterDays : 0
/// daysValidate : 0
/// businessType : 0
/// centreDisplay : true
/// centreDisplay : false
/// tenantCode : "1175"
/// isDelete : 0
/// storeName : "海峡姐妹茶店"
/// storeName : "海峡姐妹茶(汉街"
/// number : 1
class NewUserCouponList {
NewUserCouponList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String storeId,
String couponName,
int bizType,
bool allProduct,
List<dynamic> productSkuId,
String fullAmount,
String discountAmount,
int fullNumber,
int discountPercent,
String sellPrice,
int sellCount,
String bizId,
String publishStartTime,
String publishEndTime,
String useStartTime,
String useEndTime,
String promotionId,
bool dateOrDay,
int startAfterDays,
int daysValidate,
int businessType,
bool centreDisplay,
String tenantCode,
int isDelete,
String storeName,
int number,}){
class FirstLoginCouponList {
FirstLoginCouponList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String storeId,
String couponName,
int bizType,
bool allProduct,
List<dynamic> productSkuId,
String fullAmount,
String discountAmount,
int fullNumber,
int discountPercent,
String sellPrice,
int sellCount,
String bizId,
String publishStartTime,
String publishEndTime,
String useStartTime,
String useEndTime,
String promotionId,
bool dateOrDay,
int startAfterDays,
int daysValidate,
int businessType,
bool centreDisplay,
String tenantCode,
int isDelete,
String storeName,
int number,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
@ -147,9 +154,9 @@ class NewUserCouponList {
_isDelete = isDelete;
_storeName = storeName;
_number = number;
}
}
NewUserCouponList.fromJson(dynamic json) {
FirstLoginCouponList.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
@ -291,71 +298,71 @@ class NewUserCouponList {
}
/// id : "1463398002331746304"
/// createTime : "2021-11-24 14:44:07"
/// id : "1478615682588344320"
/// createTime : "2022-01-05 14:33:45"
/// createUser : "1333246101196636160"
/// updateTime : "2021-11-24 14:44:07"
/// updateTime : "2022-01-05 14:33:45"
/// updateUser : "1333246101196636160"
/// storeId : "0"
/// couponName : "满10-2"
/// couponName : "新品10-5"
/// bizType : 1
/// allProduct : true
/// productSkuId : []
/// fullAmount : "10.00"
/// discountAmount : "2.00"
/// discountAmount : "5.00"
/// fullNumber : 1
/// discountPercent : 100
/// sellPrice : "0.00"
/// sellCount : 0
/// bizId : ""
/// publishStartTime : "2021-11-24 12:00:00"
/// publishEndTime : "2021-11-30 12:00:00"
/// useStartTime : "2021-11-24 12:00:00"
/// useEndTime : "2021-11-30 12:00:00"
/// publishStartTime : "2022-01-01 00:00:00"
/// publishEndTime : "2022-01-31 00:00:00"
/// useStartTime : "2022-01-02 00:00:00"
/// useEndTime : "2022-01-30 00:00:00"
/// promotionId : "0"
/// dateOrDay : false
/// startAfterDays : 0
/// daysValidate : 0
/// businessType : 0
/// centreDisplay : true
/// centreDisplay : false
/// tenantCode : "1175"
/// isDelete : 0
/// storeName : "海峡姐妹"
/// storeName : "海峡姐妹茶"
/// number : 1
class InterviewCouponList {
InterviewCouponList({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String storeId,
String couponName,
int bizType,
bool allProduct,
List<dynamic> productSkuId,
String fullAmount,
String discountAmount,
int fullNumber,
int discountPercent,
String sellPrice,
int sellCount,
String bizId,
String publishStartTime,
String publishEndTime,
String useStartTime,
String useEndTime,
String promotionId,
bool dateOrDay,
int startAfterDays,
int daysValidate,
int businessType,
bool centreDisplay,
String tenantCode,
int isDelete,
String storeName,
int number,}){
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String storeId,
String couponName,
int bizType,
bool allProduct,
List<dynamic> productSkuId,
String fullAmount,
String discountAmount,
int fullNumber,
int discountPercent,
String sellPrice,
int sellCount,
String bizId,
String publishStartTime,
String publishEndTime,
String useStartTime,
String useEndTime,
String promotionId,
bool dateOrDay,
int startAfterDays,
int daysValidate,
int businessType,
bool centreDisplay,
String tenantCode,
int isDelete,
String storeName,
int number,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
@ -387,7 +394,7 @@ class InterviewCouponList {
_isDelete = isDelete;
_storeName = storeName;
_number = number;
}
}
InterviewCouponList.fromJson(dynamic json) {
_id = json['id'];
@ -531,33 +538,33 @@ class InterviewCouponList {
}
/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJhY2NvdW50IjoiMTU2MTU2OTg3NDUiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.KHiw51SQ2RkARJhGKFTXgI7IrYXOhN-YqFZCwJ1jkEc"
/// token : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJQTEFURk9STV9BUFAiLCJuYW1lIjoi5Zue5LmhXzg4ODg4OCIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJhY2NvdW50IjoiMTU0NDc4OTg3NTYiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.dIGWaCR6uuJ4YcgTfEEeVGJtOmpAlLaxQ2sEnd_9_zw"
/// tokenType : "token"
/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0NzA3MDI1OTIzMDM1NjI3NTIiLCJleHAiOjE2NDIwNjk3OTksIm5iZiI6MTYzOTQ3Nzc5OX0.jjI0dTviahPq6p4J_tx_Sn-Fg-q51kE3WPpqdVcEIMw"
/// refreshToken : "eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsInVzZXJpZCI6IjE0ODQ0Nzc5NDQ4Mzg0ODgwNjQiLCJleHAiOjE2NDUzNTQwOTksIm5iZiI6MTY0Mjc2MjA5OX0.ZrG-JCemN_HtFzE512311Tksh2o21ywgjHhhGeXXWrE"
/// name : "回乡_888888"
/// account : "15615698745"
/// account : "15447898756"
/// avatar : null
/// workDescribe : null
/// userId : "1470702592303562752"
/// userId : "1484477944838488064"
/// userType : "PLATFORM_APP"
/// expire : "2592000"
/// expiration : "2022-01-13 18:29:59"
/// mobile : "15615698745"
/// expiration : "2022-02-20 18:48:19"
/// mobile : "15447898756"
class AuthInfo {
AuthInfo({
String token,
String tokenType,
String refreshToken,
String name,
String account,
dynamic avatar,
dynamic workDescribe,
String userId,
String userType,
String expire,
String expiration,
String mobile,}){
String token,
String tokenType,
String refreshToken,
String name,
String account,
dynamic avatar,
dynamic workDescribe,
String userId,
String userType,
String expire,
String expiration,
String mobile,}){
_token = token;
_tokenType = tokenType;
_refreshToken = refreshToken;
@ -570,7 +577,7 @@ class AuthInfo {
_expire = expire;
_expiration = expiration;
_mobile = mobile;
}
}
AuthInfo.fromJson(dynamic json) {
_token = json['token'];

129
lib/retrofit/data/message.dart

@ -1,44 +1,18 @@
/// id : "1420215467561189376"
/// createTime : "2021-07-28 10:58:26"
/// id : "1483062749750624256"
/// createTime : "2022-01-17 21:04:48"
/// createUser : "0"
/// updateTime : "2021-07-28 10:58:29"
/// updateTime : "2022-01-17 21:04:48"
/// updateUser : "0"
/// mid : "1406879717390286848"
/// title : "充值成功"
/// content : "你于2021-07-28 10:52:02充值0.01元,当前余额:0.08元。"
/// typed : 3
/// relational : ""
/// state : 1
/// mid : "1478548672881885184"
/// title : "粉丝关注"
/// content : "哈哈哈关注了你!"
/// typed : 4
/// relational : "{\"businessId\":1483062749356359680,\"mid\":1379254113602109440,\"avatar\":\"https://pos.upload.gznl.top/admin/2021/08/1f8d55ed-85d2-42a2-b155-6737a66226e8.jpg\",\"typed\":\"MEMBER\",\"nickname\":\"哈哈哈\",\"action\":\"FOLLOW\",\"receiveMid\":1478548672881885184}"
/// state : 0
/// isDelete : 0
/// followed : false
class Message {
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _title;
String _content;
int _typed;
String _relational;
int _state;
int _isDelete;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get title => _title;
String get content => _content;
int get typed => _typed;
String get relational => _relational;
int get state => _state;
int get isDelete => _isDelete;
Message({
String id,
String createTime,
@ -51,7 +25,8 @@ class Message {
int typed,
String relational,
int state,
int isDelete}){
int isDelete,
bool followed,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
@ -64,37 +39,67 @@ class Message {
_relational = relational;
_state = state;
_isDelete = isDelete;
_followed = followed;
}
Message.fromJson(dynamic json) {
_id = json["id"];
_createTime = json["createTime"];
_createUser = json["createUser"];
_updateTime = json["updateTime"];
_updateUser = json["updateUser"];
_mid = json["mid"];
_title = json["title"];
_content = json["content"];
_typed = json["typed"];
_relational = json["relational"];
_state = json["state"];
_isDelete = json["isDelete"];
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_mid = json['mid'];
_title = json['title'];
_content = json['content'];
_typed = json['typed'];
_relational = json['relational'];
_state = json['state'];
_isDelete = json['isDelete'];
_followed = json['followed'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _mid;
String _title;
String _content;
int _typed;
String _relational;
int _state;
int _isDelete;
bool _followed;
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get mid => _mid;
String get title => _title;
String get content => _content;
int get typed => _typed;
String get relational => _relational;
int get state => _state;
int get isDelete => _isDelete;
bool get followed => _followed;
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
map["id"] = _id;
map["createTime"] = _createTime;
map["createUser"] = _createUser;
map["updateTime"] = _updateTime;
map["updateUser"] = _updateUser;
map["mid"] = _mid;
map["title"] = _title;
map["content"] = _content;
map["typed"] = _typed;
map["relational"] = _relational;
map["state"] = _state;
map["isDelete"] = _isDelete;
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['mid'] = _mid;
map['title'] = _title;
map['content'] = _content;
map['typed'] = _typed;
map['relational'] = _relational;
map['state'] = _state;
map['isDelete'] = _isDelete;
map['followed'] = _followed;
return map;
}

29
lib/retrofit/data/msg_stats.dart

@ -0,0 +1,29 @@
/// name : "4"
/// number : 8
class MsgStats {
MsgStats({
String name,
int number,}){
_name = name;
_number = number;
}
MsgStats.fromJson(dynamic json) {
_name = json['name'];
_number = json['number'];
}
String _name;
int _number;
String get name => _name;
int get number => _number;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['name'] = _name;
map['number'] = _number;
return map;
}
}

20
lib/retrofit/min_api.dart

@ -14,21 +14,15 @@ import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import 'data/activity_actRecord_details.dart';
import 'data/activity_area_list.dart';
import 'data/activity_details.dart';
import 'data/findMiNiGroupList.dart';
import 'data/activity_order_list.dart';
import 'data/home_recommend_list.dart';
import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart';
import 'data/shopping_home_config.dart';
part 'min_api.g.dart';
// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///
// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///
const base_url = "https://pos.api.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///
// const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222
@ -37,12 +31,14 @@ part 'min_api.g.dart';
// const base_url = "http://192.168.10.236:8765/app/";///
// const baseUrl = "http://192.168.10.236:8765/app/";///
// const base_url = "http://192.168.10.142:8765/app/";///
// const baseUrl = "http://192.168.10.142:8765/app/";///
// const base_url = "http://192.168.10.37:8766/app/";
// const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.142:8765/app/";///
const baseUrl = "http://192.168.10.142:8765/app/";///
///
@RestApi(baseUrl: baseUrl)
abstract class MinApiService {
@ -171,7 +167,7 @@ abstract class MinApiService {
///
@PUT("shoppingcart/single")
Future<BaseData> shoppingCartSingle(@Body() Map<String, dynamic> param);
Future<BaseData<List<ShoppingCart>>> shoppingCartSingle(@Body() Map<String, dynamic> param);
///
@POST("order/getOrderInfo")

13
lib/retrofit/retrofit_api.dart

@ -37,6 +37,7 @@ import 'data/headlines_list_details.dart';
import 'data/logistics.dart';
import 'data/member_comment_list.dart';
import 'data/message.dart';
import 'data/msg_stats.dart';
import 'data/page.dart';
import 'data/rank.dart';
import 'data/second_card_list.dart';
@ -54,8 +55,8 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart';
// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
// const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222
@ -67,8 +68,8 @@ part 'retrofit_api.g.dart';
// const baseUrl = "http://192.168.10.37:8766/app/";
const base_url = "http://192.168.10.142:8766/app/";///
const baseUrl = "http://192.168.10.142:8766/app/";///
// const base_url = "http://192.168.10.88:8766/app/";///
// const baseUrl = "http://192.168.10.88:8766/app/";///
@RestApi(baseUrl: baseUrl)
abstract class ApiService {
@ -346,6 +347,10 @@ abstract class ApiService {
@GET("/app-msg/{id}")
Future<BaseData> queryMsg(@Path("id") String id);
///App消息
@GET("/app-msg/stats")
Future<BaseData<List<MsgStats>>> stats();
////
@GET("/information/likes/{id}")
Future<BaseData> informationLikes(@Path("id") String id);

22
lib/retrofit/retrofit_api.g.dart

@ -1032,6 +1032,28 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<List<MsgStats>>> stats() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/app-msg/stats',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<MsgStats>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<MsgStats>((i) => MsgStats.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
@override
Future<BaseData<dynamic>> informationLikes(id) async {
ArgumentError.checkNotNull(id, 'id');

8
lib/settlement/settlement.dart

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

4
lib/settlement/settlement_view/coupon.dart

@ -171,8 +171,8 @@ class _CouponWidget extends State<CouponWidget> {
},
child: Image.asset(
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,
height: 24,
),

2
lib/settlement/settlement_view/settlement_coupon.dart

@ -115,7 +115,7 @@ class _SettlementCoupon extends State<SettlementCoupon> {
return CouponWidget(
couponCan[position],
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: [
MImage(
productList.skuImg,
width: 44.w,
width: 44,
height: 44,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
@ -342,10 +342,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
),
Container(
child: Text(
"已优惠:¥${(widget.minOrderInfo != null) ? (double.parse(widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0")) :
(double.parse(widget.tableId <= 0 ? "0" : (widget.settleOrderInfo.discountAmount ?? "0"))
+ double.parse(widget?.settleOrderInfo?.benefitDiscountAmount ?? "0"))
}",
"已优惠:¥${discountPrice()}",
style: TextStyle(
fontSize: 12.sp,
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() {
if (widget.minOrderInfo != null &&
widget.minOrderInfo.orderProductVOList != null) {

48
lib/store/store_order.dart

@ -242,10 +242,14 @@ class _StoreOrderPage extends State<StoreOrderPage>
stretch: false,
brightness: Brightness.light,
leading: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
},
child: Container(
width: double.infinity,
height: double.infinity,
color: Colors.transparent,
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(10),
@ -257,9 +261,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
),
flexibleSpace: FlexibleSpaceBar(
title: Title(
controller,
storeInfo != null ? storeInfo.storeName : ''),
title: Title(controller,
storeInfo != null ? storeInfo.storeName : ''),
collapseMode: CollapseMode.pin,
stretchModes: [
StretchMode.zoomBackground,
@ -283,7 +286,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
],
),
top: 0,
bottom:0,
bottom: 0,
left: 0,
right: 0,
),
@ -314,8 +317,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
],
),
),
top:80.h,
bottom:0,
top: 100.h,
bottom: 0,
left: 0,
right: 0,
),
@ -550,6 +553,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
return;
}
}
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
@ -648,16 +652,27 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
_queryMiNiDetail(String id,int count) async {
EasyLoading.show(status: S.current.zhengzaijiazai);
if(count < 0){
shopCarGoods.shoppingCartSkuItemList.forEach((element) {
if(element.productId == id){
shopCartReduce(element);
setState(() {
});
}
});
return;
}
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) {
showStoreSelector(baseData.data, id,count);
showStoreSelector(baseData.data, id, count);
}
}
///
showStoreSelector(MiNiDetail miNiDetail, String id,int count) async {
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1
&& miNiDetail.attrList[0].attrValueList.length == 1) {
showStoreSelector(MiNiDetail miNiDetail, String id, int count) async {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count);
} else {
EasyLoading.dismiss();
@ -670,7 +685,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
_addShopCar,
add,
reduce,
buttonType: 0,
),
onDismiss: () {
dialogShowing = false;
@ -683,7 +697,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
ProductSkuVOListBean productSku;
if (selectSkus!= null && selectSkus.length == 0) {
if (selectSkus != null && selectSkus.length == 0) {
productSku = miNiDetail.productSkuVOList.first;
} else {
productSku = miNiDetail.productSkuVOList.firstWhere((element) {
@ -797,11 +811,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) {
EasyLoading.dismiss();
this.shopCarGoods = await queryShopCar();
if (shopCartKey != null) {
if (shopCartKey?.currentState != null) {
shopCartKey.currentState.setState(() {});
}
setState(() {});
setState(() {
});
}
return this.shopCarGoods;
}
@ -860,9 +876,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
}
ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods
.shoppingCartSkuItemList
.firstWhere((element) => skuId == element.skuId);
.firstWhere((element) => skuId == element.id);
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
.indexWhere((element) => skuId == element.skuId);
.indexWhere((element) => skuId == element.id);
if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) {

37
lib/store/store_view/product_sku.dart

@ -36,8 +36,8 @@ class ProductSku extends StatefulWidget {
class _ProductSku extends State<ProductSku> {
List<String> selectSkus = [];
int count = 1;
String selectedPrice = "";
@override
void initState() {
@ -61,6 +61,7 @@ class _ProductSku extends State<ProductSku> {
return;
}
if (productSku == null) return;
selectedPrice = productSku.skuPrice;
String skuId = productSku.id;
if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return;
int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id);
@ -100,6 +101,7 @@ class _ProductSku extends State<ProductSku> {
height: MediaQuery.of(context).size.height / 3 * 2,
width: double.infinity,
decoration: BoxDecoration(
// color: Color(0xFFFAFAFA),
color: Color(0xFFFAFAFA),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
@ -125,7 +127,7 @@ class _ProductSku extends State<ProductSku> {
SizedBox(
width: 10,
),
Expanded(child: Column(
Expanded(child:Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
@ -161,7 +163,7 @@ class _ProductSku extends State<ProductSku> {
),
),
Text(
widget.miNiDetail.price,
selectedPrice,
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
@ -172,7 +174,6 @@ class _ProductSku extends State<ProductSku> {
),
],
)),
Spacer(),
InkWell(
onTap: () {
// Navigator.of(context).pop();
@ -723,18 +724,26 @@ class _ProductSku extends State<ProductSku> {
Widget sweetnessItem(String name, bool isCheck) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RoundButton(
width: 68.w,
height: 29.h,
text: name,
textColor: !isCheck ? Color(0xFF727272) : Colors.white,
fontWeight: MyFontWeight.regular,
radius: 4,
backgroup: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060),
fontSize: 12.sp,
Container(
width: 70.w,
height:30.h,
alignment: Alignment.center,
decoration: BoxDecoration(
color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060),
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child:Text(
name,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:!isCheck ? Color(0xFF727272) : Colors.white,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
),
],
),

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)
InkWell(
GestureDetector(
onTap: () {
widget.add(widget.shoppingCartSkuItemListBean);
},

2
lib/store/store_view/store_info.dart

@ -30,7 +30,7 @@ class _StoreInfoView extends State<StoreInfoView> {
top: 5.h,
bottom: 6.h,
),
height: 160.h,
height: 140.h,
padding: EdgeInsets.all(12.w),
decoration: BoxDecoration(
color: Colors.white,

19
lib/store/store_view/store_order_list.dart

@ -21,7 +21,7 @@ class StoreOrderListPage extends StatefulWidget {
final ScrollController controller;
final String minToken;
final String tenant;
final Function(String id, int count) queryMiNiDetail;
final Function(String id,int count) queryMiNiDetail;
ShoppingCart shopCarGoods;
@ -31,8 +31,8 @@ class StoreOrderListPage extends StatefulWidget {
this.storeInfo,
this.shopCarGoods,
this.controller,
this.minToken,
this.tenant,
this.minToken,
this.tenant,
this.queryMiNiDetail,
);
@ -230,24 +230,19 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
}
});
}
return InkWell(
onTap: () {
widget.queryMiNiDetail(productListBeans[position].id, 1);
},
child: ShopGoods(
return ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id, 1);
widget.queryMiNiDetail(productListBeans[position].id,1);
},
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
if (count > 0)
widget.queryMiNiDetail(productListBeans[position].id, -1);
if(count > 0)
widget.queryMiNiDetail(productListBeans[position].id,-1);
},
productListBean: productListBeans[position],
count: count,
isShopCart: false,
queryMiNiDetail: widget.queryMiNiDetail,
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;
}
}

256
lib/view_widget/activity_coupons.dart

@ -0,0 +1,256 @@
import 'dart:collection';
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:shared_preferences/shared_preferences.dart';
class ActivityCoupons extends StatefulWidget {
final String result;
ActivityCoupons(this.result);
@override
State<StatefulWidget> createState() {
return _ActivityCoupons();
}
}
class _ActivityCoupons extends State<ActivityCoupons> {
var resultData;
int pageNum = 1;
List<Coupon> coupons = [];
ApiService apiService;
var receiveCou = new Queue();
@override
void initState() {
super.initState();
resultData = jsonDecode(widget.result);
}
receiveCoupon() async {
var id = receiveCou.removeFirst();
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.receiveCoupon(id).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
if (receiveCou.length > 0) {
receiveCoupon();
} else {
Navigator.of(context).pop();
SmartDialog.showToast("领取成功", alignment: Alignment.center);
}
}
else{
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
Navigator.of(context).pop();
}
}
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 150.h),
height: MediaQuery.of(context).size.height / 2,
child: Column(
children: [
Container(
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
padding: EdgeInsets.only(top: 210.h),
margin: EdgeInsets.only(top: 20.h, left: 20, right: 20),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/activity_q.png"),
),
),
child: Column(
children: [
Expanded(
child: couponsActivity(),
),
GestureDetector(
onTap: () {
(resultData["list"] as List).forEach((element) {
receiveCou..add(element["id"]);
});
receiveCoupon();
},
child: Container(
margin: EdgeInsets.only(
left: 60.w, right: 60.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
gradient: new LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Color(0xFFFFDCA1),
Color(0xFFFAE4C0),
]),
borderRadius: BorderRadius.circular(22.5),
),
width: MediaQuery.of(context).size.width,
height: 40,
alignment: Alignment.center,
child: Text(
"立即领取",
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14.sp,
color: Color(0xFF4A4748),
),
),
),
),
],
),
),
SizedBox(height: 35),
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pop();
});
},
child: Image.asset(
"assets/image/yq_qx.png",
width: 34,
height: 34,
),
)
],
),
);
}
Widget couponsActivity() {
return ListView.builder(
padding: EdgeInsets.zero,
itemCount: (resultData == null || resultData["list"] == null)
? 0
: (resultData["list"] as List).length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: couponsItem(resultData["list"][position]),
);
},
);
}
Widget couponsItem(listData) {
return Container(
height: 69.h,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/xin_rq.png"),
),
),
margin: EdgeInsets.symmetric(horizontal: 60, vertical: 5),
padding: EdgeInsets.only(left: 16.w, right: 10.w),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (listData["type"] == 1)
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFDE5F3B),
),
),
TextSpan(
text: listData["discount"] ?? "",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFDE5F3B),
),
),
],
),
),
if (listData["type"] == 3)
Text(
"兑换券",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFDE5F3B),
),
),
if (listData["type"] == 2)
Padding(
padding: EdgeInsets.only(right: 20),
child: Text.rich(
TextSpan(
children: [
TextSpan(
text: (listData["percent"] / 10).toString() ?? "",
style: TextStyle(
fontSize: 25.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFDE5F3B),
),
),
TextSpan(
text: "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFDE5F3B),
),
),
],
),
)),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: 4, bottom: 4, left: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
listData["name"] ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF181818),
),
),
],
))),
],
),
);
}
}

99
lib/view_widget/custom_image.dart

@ -1,8 +1,8 @@
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: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 {
final String src;
@ -29,17 +29,33 @@ class MImage extends StatelessWidget {
this.radius = BorderRadius.zero,
});
File fileFromDocsDir(String filename) {
String pathName = p.join(ImgCachePath.instance.path, filename);
return File(pathName);
}
@override
Widget build(BuildContext context) {
Widget image = LayoutBuilder(
builder: (context, constraints) {
String imageUrl = "";
if (src != null && src != "" && src.startsWith("http")) {
imageUrl =
"$src?imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}"
"x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100";
///
// if (src != null && src != "" && src.startsWith("http")) {
// String oper = src.contains("?") ? "" :"?";
// imageUrl =
// "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}"
// "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:$imageUrl");
// print("constrainWidth: ${constraints.constrainWidth()}");
// print("constrainHeight: ${constraints.constrainHeight()}");
@ -50,43 +66,38 @@ class MImage extends StatelessWidget {
);
}
Widget cachedNetworkImage;
if (src.startsWith("http")) {
cachedNetworkImage = CachedNetworkImage(
imageUrl: imageUrl,
cacheManager: DefaultCacheManager(),
fadeInDuration: Duration(milliseconds: 300),
fadeOutDuration: Duration(milliseconds: 300),
imageBuilder: (context, provide) {
return Image(
image: provide,
fit: fit,
);
},
errorWidget: (context, error, stackTrace) {
return Image.asset(
errorSrc,
fit: fit,
);
},
placeholder: (context, placeholder) {
return Image.asset(
fadeSrc,
fit: fit,
);
},
);
} else if (src.startsWith("file")) {
cachedNetworkImage = Image.file(
File(src),
fit: fit,
errorBuilder: (context, error, stackTrace) {
return Image.asset(
errorSrc,
fit: fit,
);
},
);
}
if (src.startsWith("http")) {
cachedNetworkImage = Image(
image: ResizeImage(NetworkToFileImage(
url: imageUrl,
file: fileFromDocsDir("resize"+src.replaceAll("https:", "")
.replaceAll("http:", "")
.replaceAll("pos.upload.gznl.top", "")
.replaceAll("/", "")),
debug: true,
),
width: _w,
height: _h),
errorBuilder: (context, error, stackTrace) {
return Image.asset(
errorSrc,
fit: fit,
);
},
fit: fit,
);
} else if (src.startsWith("file")) {
cachedNetworkImage = Image.file(
File(src),
fit: fit,
errorBuilder: (context, error, stackTrace) {
return Image.asset(
errorSrc,
fit: fit,
);
},
);
}
return cachedNetworkImage;
},
);

3
lib/view_widget/item_input_widget.dart

@ -147,7 +147,8 @@ class ItemInputWidget extends StatelessWidget {
margin: EdgeInsets.only(left: 5, bottom: 12.h),
),
Container(
height: 0.035.sh,
// height: 0.035.sh,
margin: EdgeInsets.only(bottom:10.h),
child: TextField(
controller: controller,
style: style,

11
lib/view_widget/login_tips.dart

@ -19,8 +19,11 @@ class LoginTips extends StatelessWidget {
type: MaterialType.transparency,
child: Center(
child: Container(
width: 0.7867.sw,
height: 0.7867.sw / (Platform.isAndroid ? 0.86 : 0.9),
// width: 0.7867.sw,
// height: 0.7867.sw / (Platform.isAndroid ? 0.86 : 0.9),
width:double.infinity,
height:MediaQuery.of(context).size.width / 1,
margin: EdgeInsets.symmetric(horizontal:28.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.white,
@ -33,8 +36,8 @@ class LoginTips extends StatelessWidget {
children: [
Image.asset(
"assets/image/icon_login_tips.png",
width: 0.7867.sw * 0.6,
height: 0.7867.sw * 0.6 * 0.7,
// width: 0.7867.sw * 0.6,
// height: 0.7867.sw * 0.6 * 0.7,
fit: BoxFit.fill,
),
SizedBox(

32
lib/view_widget/new_people_reward.dart

@ -1,17 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/separator.dart';
class NewPeopleReward extends StatefulWidget {
final List<NewUserCouponList> newUserCouponList;
final List<FirstLoginCouponList> firstLoginCouponList;
NewPeopleReward(this.newUserCouponList);
NewPeopleReward(this.firstLoginCouponList);
@override
State<StatefulWidget> createState() {
@ -97,22 +93,22 @@ class _NewPeopleReward extends State<NewPeopleReward> {
Widget reward() {
return ListView.builder(
padding: EdgeInsets.zero,
itemCount: widget.newUserCouponList.length,
itemCount: widget.firstLoginCouponList.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: rewardItem(widget.newUserCouponList[position]),
child: rewardItem(widget.firstLoginCouponList[position]),
);
},
);
}
Widget rewardItem(NewUserCouponList newUserCouponList) {
Widget rewardItem(FirstLoginCouponList firstLoginCouponList) {
return Container(
height: 69.h,
height:90.h,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
@ -139,7 +135,7 @@ class _NewPeopleReward extends State<NewPeopleReward> {
),
TextSpan(
text: double.tryParse(
"${newUserCouponList.discountAmount}" ?? "0")
"${firstLoginCouponList.discountAmount}" ?? "0")
.toInt()
.toString() ??
"",
@ -153,13 +149,13 @@ class _NewPeopleReward extends State<NewPeopleReward> {
),
),
Expanded(child:Padding(
padding: EdgeInsets.only(top: 4, bottom: 4,left:10),
padding: EdgeInsets.only(top: 4, bottom: 4,left:30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
newUserCouponList.storeName,
firstLoginCouponList.storeName,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
@ -169,9 +165,9 @@ class _NewPeopleReward extends State<NewPeopleReward> {
),
),
Text(
newUserCouponList.couponName,
firstLoginCouponList.couponName,
overflow: TextOverflow.ellipsis,
maxLines: 2,
maxLines: 1,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
@ -179,9 +175,9 @@ class _NewPeopleReward extends State<NewPeopleReward> {
),
),
Text(
"有效期至:${(newUserCouponList.useEndTime != null && newUserCouponList.useEndTime != "")
? newUserCouponList.useEndTime.split(" ")[0]
: "$newUserCouponList.useEndTime"}",
"有效期至:${(firstLoginCouponList.useEndTime != null && firstLoginCouponList.useEndTime != "")
? firstLoginCouponList.useEndTime.split(" ")[0]
: "$firstLoginCouponList.useEndTime"}",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(

8
lib/view_widget/request_permission.dart

@ -37,7 +37,9 @@ class _RequestPermission extends State<RequestPermission> {
type: MaterialType.transparency,
child: Center(
child: Container(
width: widget.width ?? 0.7867.sw,
// width: widget.width ?? 0.7867.sw,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal: 24.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.white,
@ -50,8 +52,8 @@ class _RequestPermission extends State<RequestPermission> {
children: [
Image.asset(
widget.src,
width: 0.7867.sw * 0.6,
height: 0.7867.sw * 0.6 * 0.7,
// width: 0.7867.sw * 0.6,
// height: 0.7867.sw * 0.6 * 0.7,
fit: BoxFit.fill,
),
SizedBox(

7
lib/view_widget/text_image_dialog.dart

@ -37,7 +37,8 @@ class _TextImageWidget extends State<TextImageWidget> {
type: MaterialType.transparency,
child: Center(
child: Container(
width: widget.width ?? 0.7867.sw,
width: double.infinity,
margin: EdgeInsets.symmetric(horizontal:26.w),
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w),
decoration: BoxDecoration(
color: Colors.white,
@ -50,8 +51,8 @@ class _TextImageWidget extends State<TextImageWidget> {
children: [
Image.asset(
widget.src,
width: 0.7867.sw * 0.9,
height: 0.7867.sw * 0.9 * 0.7,
// width: 0.7867.sw * 0.9,
// height: 0.7867.sw * 0.9 * 0.7,
fit: BoxFit.fill,
),
SizedBox(

3
lib/web/web_view/comment_list.dart

@ -131,7 +131,6 @@ class CommentListState extends State<CommentList> {
),
if (memberList != null && memberList.length > 0)
Container(
height: commentHeight,
decoration: BoxDecoration(
color: Color(0xFFF2F2F2),
boxShadow: [
@ -144,7 +143,7 @@ class CommentListState extends State<CommentList> {
],
),
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: 22.h),
padding: EdgeInsets.only(top: 22.h, bottom: 22.h),
child: Text(
S.of(context).yixiansquanbupinglun,
style: TextStyle(

51
pubspec.lock

@ -50,13 +50,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -209,13 +202,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: "direct main"
description:
@ -269,7 +255,7 @@ packages:
name: flutter_screenutil
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.0.3"
version: "5.1.0"
flutter_smart_dialog:
dependency: "direct main"
description:
@ -350,13 +336,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.15.0"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
@ -434,6 +413,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -677,20 +663,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:
@ -712,13 +684,6 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:

4
pubspec.yaml

@ -60,12 +60,12 @@ dependencies:
#多图, 裁剪
image_pickers: ^2.0.0
# flutter_scankit: ^1.2.0
# flutter_scankit: ^1.2.0
# qrscan: ^0.3.1
scan: ^1.5.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
chewie_audio: ^1.1.2

Loading…
Cancel
Save