Browse Source

UI调整

dart3_last
fff 2 weeks ago
parent
commit
85cfc42cf7
  1. 6
      lib/community/community_child_list.dart
  2. 6
      lib/community/community_child_page.dart
  3. 17
      lib/community/community_course.dart
  4. 71
      lib/community/community_view/class_list_view.dart
  5. 15
      lib/community/community_view/class_title_tab.dart
  6. 42
      lib/community/community_view/home_class.dart
  7. 3
      lib/constant.dart
  8. 22
      lib/data/home_rank.dart
  9. 27
      lib/data/home_rank.g.dart
  10. 131
      lib/home/home_page.dart
  11. 13
      lib/home/home_view/home_recommend_goods.dart
  12. 22
      lib/home/home_view/top_selling_list.dart
  13. 12
      lib/home/home_view/union_entry.dart
  14. 1
      lib/im/chat_details_page.dart
  15. 5
      lib/im/im_view/im_page.dart
  16. 105
      lib/mine/mine_vip/mine_vip_core.dart
  17. 2
      lib/retrofit/min_api.g.dart
  18. 61
      lib/view_widget/custom_image.dart
  19. 22
      pubspec.yaml

6
lib/community/community_child_list.dart

@ -45,7 +45,9 @@ class _CommunityChildList extends State<CommunityChildList> {
if(isLoadMore){
pageNum += 1;
isLoadMore = false;
}else pageNum = 1;
} else {
pageNum = 1;
}
BaseData<PageInfo<ComunityComment>>? baseData = await apiService?.trendList({
"onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false,
@ -55,8 +57,8 @@ class _CommunityChildList extends State<CommunityChildList> {
}).catchError((error) {
refreshController.refreshFailed();
refreshController.loadFailed();
return BaseData<PageInfo<ComunityComment>>()..isSuccess = false;
});
refreshController.refreshCompleted();
refreshController.loadComplete();
if (baseData?.isSuccess ?? false) {

6
lib/community/community_child_page.dart

@ -53,7 +53,7 @@ class CommunityChildPageState extends State<CommunityChildPage>
widget.onScroll();
if (sc.offset >= 500) {
_currentIndex =1;
}else if(sc.offset <= 500){
} else if(sc.offset <= 500) {
_currentIndex = 0;
}
});
@ -98,8 +98,10 @@ class CommunityChildPageState extends State<CommunityChildPage>
AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center,
);
return Future.value(null);
refreshController.refreshFailed();
return BaseData<PageInfo<ComunityComment>>()..isSuccess = false;
});
refreshController.refreshCompleted();
if (baseData?.isSuccess ?? false) {
if (baseData?.data?.list?.isNotEmpty ?? false)
articles.forEach((element) {

17
lib/community/community_course.dart

@ -97,8 +97,7 @@ class _CommunityCourse extends State<CommunityCourse>
///
classListAsync() async {
BaseListData<CategorySelect>? baseData =
await apiService?.categoryList().catchError((onError) {
BaseListData<CategorySelect>? baseData = await apiService?.categoryList().catchError((onError) {
return BaseListData<CategorySelect>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
@ -183,11 +182,7 @@ class _CommunityCourse extends State<CommunityCourse>
@override
Widget build(BuildContext context) {
super.build(context);
return Stack(
children: [
Positioned(
child: Container(
child: SmartRefresher(
return SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
@ -216,14 +211,6 @@ class _CommunityCourse extends State<CommunityCourse>
),
),
),
),
),
bottom: 0,
top: 0,
left: 0,
right: 0,
),
],
);
}

71
lib/community/community_view/class_list_view.dart

@ -28,40 +28,12 @@ class _ClassListView extends State<ClassListView> {
fontSize: 16.sp,
margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom: 30),
)
:
// GridView.builder(
// itemCount:widget.classList == null ? 0 : widget.classList.length,
// padding: EdgeInsets.only(
// left: 16.w,
// right: 16.w,
// top: 13.h,
// bottom: 16.h,
// ),
// shrinkWrap: true,
// physics: NeverScrollableScrollPhysics(),
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// //Widget数量
// crossAxisCount:2,
// //Widget之间间距
// crossAxisSpacing: 11.w,
// //Widget之间间距
// mainAxisSpacing: 16.w,
// //Widget宽高比例 0.59
// childAspectRatio:
// 225 / (281 / 2 + (281 / 2) * AppUtils.textScale(context)),
// ),
// itemBuilder: (context, index) {
// return GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed('/router/class_details',
// arguments: {"id": widget.classList[index].id})
// .then((value) => {widget.classList[index].viewers = value != null?value:widget.classList[index].viewers+1});
// },
// child: classListItem(widget.classList[index]),
// );
// },
// );
StaggeredGrid.count(
: Container(
padding: EdgeInsets.symmetric(
horizontal: 8,
vertical: 8,
),
child: StaggeredGrid.count(
crossAxisCount: 2,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
@ -71,21 +43,19 @@ class _ClassListView extends State<ClassListView> {
Navigator.of(context).pushNamed(
'/router/class_details',
arguments: {"id": e.id},
).then((value) =>
{e.viewers = (value as int?) ?? (e.viewers ?? 0) + 1});
).then((value) => {e.viewers = (value as int?) ?? (e.viewers ?? 0) + 1});
},
child: classListItem(e),
);
}).toList(),
),
);
}
Widget classListItem(Course classList) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(4),
),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
@ -96,31 +66,15 @@ class _ClassListView extends State<ClassListView> {
],
color: Colors.white,
),
margin: EdgeInsets.symmetric(
vertical: 3,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Stack(
alignment: Alignment(0.9, 0.9),
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
color: Color.fromARGB(90, 0, 0, 0),
),
child: ClipRRect(
ClipRRect(
child: Opacity(
opacity: 0.7,
opacity: 1,
child: MImage(
classList.coverImg ?? "",
width: double.infinity,
@ -131,8 +85,7 @@ class _ClassListView extends State<ClassListView> {
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
top: Radius.circular(8),
),
),
Container(

15
lib/community/community_view/class_title_tab.dart

@ -16,8 +16,7 @@ class ClassTitleTab extends StatefulWidget {
}
}
class _ClassTitleTab extends State<ClassTitleTab>
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
class _ClassTitleTab extends State<ClassTitleTab> with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController? tabController;
@override
@ -29,10 +28,11 @@ class _ClassTitleTab extends State<ClassTitleTab>
@override
Widget build(BuildContext context) {
super.build(context);
return Container(
alignment: Alignment.centerLeft,
child: DefaultTabController(
length: widget.classSelectList?.length ?? 0,
length: widget.classSelectList.length,
child: TabBar(
isScrollable: true,
//
@ -42,6 +42,12 @@ class _ClassTitleTab extends State<ClassTitleTab>
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
tabAlignment: TabAlignment.start,
padding: EdgeInsets.symmetric(
horizontal: 5.w,
),
dividerHeight: 0,
dividerColor: Colors.transparent,
unselectedLabelStyle: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
@ -54,7 +60,7 @@ class _ClassTitleTab extends State<ClassTitleTab>
widget.notifyClassSelectList(index);
},
//
tabs: widget.classSelectList?.map((e) => MyTab(text: "${e.name}")).toList() ?? [],
tabs: widget.classSelectList.map((e) => MyTab(text: "${e.name}")).toList(),
),
),
);
@ -62,4 +68,5 @@ class _ClassTitleTab extends State<ClassTitleTab>
@override
bool get wantKeepAlive => true;
}

42
lib/community/community_view/home_class.dart

@ -26,11 +26,6 @@ class _HomeClass extends State<HomeClass> {
final TextEditingController editingController = TextEditingController();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return ListView.builder(
@ -48,7 +43,6 @@ class _HomeClass extends State<HomeClass> {
Widget collectItem(CollectClass collectList) {
return Container(
margin: EdgeInsets.symmetric(
horizontal: 6.w,
vertical: 10.h,
),
child: Column(
@ -68,10 +62,10 @@ class _HomeClass extends State<HomeClass> {
Container(
height: 195.h,
margin: EdgeInsets.only(top: 10.h),
child: ListView.builder(
child: ListView.separated(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10.w),
padding: EdgeInsets.symmetric(horizontal: 10),
itemCount: widget.collectMap[collectList.id]?.length ?? 0,
itemBuilder: (context, position) {
return GestureDetector(
@ -80,7 +74,8 @@ class _HomeClass extends State<HomeClass> {
'/router/class_details',
arguments: {
"id": widget.collectMap[collectList.id]![position].id
}).then((value) {
},
).then((value) {
int viewer = widget.collectMap[collectList.id]![position].viewers ?? 0;
widget.collectMap[collectList.id]![position].viewers = value != null ? int.parse("${value}") : (viewer + 1);
});
@ -88,6 +83,9 @@ class _HomeClass extends State<HomeClass> {
child: classItem(widget.collectMap[collectList.id]![position]),
);
},
separatorBuilder: (BuildContext context, int index) {
return SizedBox(width: 10);
},
),
),
],
@ -112,9 +110,6 @@ class _HomeClass extends State<HomeClass> {
],
color: Colors.white,
),
margin: EdgeInsets.symmetric(
horizontal: 6.w,
),
child: Column(
children: [
Stack(
@ -123,25 +118,7 @@ class _HomeClass extends State<HomeClass> {
Stack(
alignment: Alignment(0.9, 0.9),
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(4),
),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
color: Color.fromARGB(90, 0, 0, 0),
),
child: ClipRRect(
child: Opacity(
opacity: 0.7,
ClipRRect(
child: MImage(
collect.coverImg ?? "",
width: double.infinity,
@ -150,12 +127,10 @@ class _HomeClass extends State<HomeClass> {
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
),
),
Container(
padding: EdgeInsets.only(left: 4),
child: Row(
@ -276,4 +251,5 @@ class _HomeClass extends State<HomeClass> {
),
);
}
}

3
lib/constant.dart

@ -20,7 +20,8 @@ const serviceMiniBaseUrl = "https://pos.api.yixinhuixiang.com/app/";
///线
/// app接口的请求地址
const localBaseUrl = "http://192.168.10.54:8766/app/"; ///
// const localBaseUrl = "http://192.168.10.54:8766/app/"; ///
const localBaseUrl = "https://pos.platform.yixinhuixiang.com/app/"; ///
///线
const serviceBaseUrl = "https://pos.platform.yixinhuixiang.com/app/";

22
lib/data/home_rank.dart

@ -6,9 +6,9 @@ part 'home_rank.g.dart';
@JsonSerializable(explicitToJson: true)
class HomeRank {
List<CommodityList>? commodityList = [];
List<CommodityZone>? commodityZone = [];
String? commodityListImg = '';
List<Commoditys>? CommodityList = [];
List<CommodityZones>? CommodityZone = [];
String? CommodityListImg = '';
HomeRank();
@ -19,16 +19,16 @@ class HomeRank {
}
@JsonSerializable(explicitToJson: true)
class CommodityList {
class Commoditys {
List<GoodList>? goodList = [];
String? typeName = '';
CommodityList();
factory CommodityList.fromJson(Map<String, dynamic> json) => _$CommodityListFromJson(json);
Map<String, dynamic> toJson() => _$CommodityListToJson(this);
Commoditys();
factory Commoditys.fromJson(Map<String, dynamic> json) => _$CommoditysFromJson(json);
Map<String, dynamic> toJson() => _$CommoditysToJson(this);
}
@JsonSerializable(explicitToJson: true)
class CommodityZone {
class CommodityZones {
String? productImg = '';
List<ProductSkuVOList>? productSkuVOList = [];
String? thumbnailImg = '';
@ -45,11 +45,11 @@ class CommodityZone {
String? storeId = '';
String? tenantCode = '';
CommodityZone();
CommodityZones();
factory CommodityZone.fromJson(Map<String, dynamic> json) => _$CommodityZoneFromJson(json);
factory CommodityZones.fromJson(Map<String, dynamic> json) => _$CommodityZonesFromJson(json);
Map<String, dynamic> toJson() => _$CommodityZoneToJson(this);
Map<String, dynamic> toJson() => _$CommodityZonesToJson(this);
}

27
lib/data/home_rank.g.dart

@ -7,35 +7,34 @@ part of 'home_rank.dart';
// **************************************************************************
HomeRank _$HomeRankFromJson(Map<String, dynamic> json) => HomeRank()
..commodityList = (json['commodityList'] as List<dynamic>?)
?.map((e) => CommodityList.fromJson(e as Map<String, dynamic>))
..CommodityList = (json['CommodityList'] as List<dynamic>?)
?.map((e) => Commoditys.fromJson(e as Map<String, dynamic>))
.toList()
..commodityZone = (json['commodityZone'] as List<dynamic>?)
?.map((e) => CommodityZone.fromJson(e as Map<String, dynamic>))
..CommodityZone = (json['CommodityZone'] as List<dynamic>?)
?.map((e) => CommodityZones.fromJson(e as Map<String, dynamic>))
.toList()
..commodityListImg = json['commodityListImg'] as String?;
..CommodityListImg = json['CommodityListImg'] as String?;
Map<String, dynamic> _$HomeRankToJson(HomeRank instance) => <String, dynamic>{
'commodityList': instance.commodityList?.map((e) => e.toJson()).toList(),
'commodityZone': instance.commodityZone?.map((e) => e.toJson()).toList(),
'commodityListImg': instance.commodityListImg,
'CommodityList': instance.CommodityList?.map((e) => e.toJson()).toList(),
'CommodityZone': instance.CommodityZone?.map((e) => e.toJson()).toList(),
'CommodityListImg': instance.CommodityListImg,
};
CommodityList _$CommodityListFromJson(Map<String, dynamic> json) =>
CommodityList()
Commoditys _$CommoditysFromJson(Map<String, dynamic> json) => Commoditys()
..goodList = (json['goodList'] as List<dynamic>?)
?.map((e) => GoodList.fromJson(e as Map<String, dynamic>))
.toList()
..typeName = json['typeName'] as String?;
Map<String, dynamic> _$CommodityListToJson(CommodityList instance) =>
Map<String, dynamic> _$CommoditysToJson(Commoditys instance) =>
<String, dynamic>{
'goodList': instance.goodList?.map((e) => e.toJson()).toList(),
'typeName': instance.typeName,
};
CommodityZone _$CommodityZoneFromJson(Map<String, dynamic> json) =>
CommodityZone()
CommodityZones _$CommodityZonesFromJson(Map<String, dynamic> json) =>
CommodityZones()
..productImg = json['productImg'] as String?
..productSkuVOList = (json['productSkuVOList'] as List<dynamic>?)
?.map((e) => ProductSkuVOList.fromJson(e as Map<String, dynamic>))
@ -54,7 +53,7 @@ CommodityZone _$CommodityZoneFromJson(Map<String, dynamic> json) =>
..storeId = json['storeId'] as String?
..tenantCode = json['tenantCode'] as String?;
Map<String, dynamic> _$CommodityZoneToJson(CommodityZone instance) =>
Map<String, dynamic> _$CommodityZonesToJson(CommodityZones instance) =>
<String, dynamic>{
'productImg': instance.productImg,
'productSkuVOList':

131
lib/home/home_page.dart

@ -176,6 +176,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
dioErrorType = onError.type;
refreshController.loadFailed();
refreshController.refreshFailed();
return BaseData<PageInfo<BannerData>>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
bannerData = baseData?.data?.records ?? [];
@ -191,7 +192,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
try {
BaseData<PageInfo<BannerData>>? baseData = await apiService?.queryBanner({
"model": {"type": "HOME_STORE_PAGE"},
}).catchError((onError) {});
}).catchError((onError) {
return BaseData<PageInfo<BannerData>>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
activityBannerData = baseData!.data?.records ?? [];
}
@ -206,7 +209,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
_loadCount = 0;
SmartDialog.dismiss();
String toastText = AppUtils.dioErrorTypeToString(dioErrorType);
if (toastText.isNotEmpty ?? false) {
if (toastText.isNotEmpty) {
SmartDialog.showToast(toastText, alignment: Alignment.center);
}
if (refreshController.isRefresh) refreshController.refreshCompleted();
@ -217,8 +220,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
queryRecommendRank() async {
try {
BaseData<HomeRank>? rank =
await apiService?.recommendRank().catchError((onError) {});
BaseData<HomeRank>? rank = await apiService?.recommendRank().catchError((onError) {
return BaseData<HomeRank>()..isSuccess = false;
});
if (rank?.isSuccess ?? false) {
homeRank = rank!.data;
}
@ -230,15 +234,16 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
queryGoodsCategory() async {
try {
BaseData<PageInfo<GoodsCategory>>? dataCategory =
await apiService?.goodsCategory({
BaseData<PageInfo<GoodsCategory>>? dataCategory = await apiService?.goodsCategory({
"current": 1,
"map": {},
"model": {"pageNum": 1, "pageSize": 20, "searchKey": ""},
"order": "descending",
"size": 20,
"sort": "sortOrder"
}).catchError((onError) {});
}).catchError((onError) {
return BaseData<PageInfo<GoodsCategory>>()..isSuccess = false;
});
if ((dataCategory?.isSuccess ?? false) &&
(dataCategory!.data?.records?.isNotEmpty ?? false)) {
gooodsCategorys.clear();
@ -265,8 +270,10 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
"pageSize": 100,
"state": 1
};
BaseData<PageInfo<Goods>>? pageGoods =
await apiService?.creditGoods(param).catchError((onError) {});
BaseData<PageInfo<Goods>>? pageGoods = await apiService?.creditGoods(param)
.catchError((onError) {
return BaseData<PageInfo<Goods>>()..isSuccess = false;
});
if (pageGoods?.isSuccess ?? false) {
goods = pageGoods?.data?.list ?? [];
}
@ -283,8 +290,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
queryUserBalance() async {
try {
BaseData<UserInfo>? baseData =
await apiService?.queryInfo().catchError((onError) {});
BaseData<UserInfo>? baseData = await apiService?.queryInfo().catchError((onError) {
return BaseData<UserInfo>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
userInfo = baseData!.data;
mRaiseMoney = double.tryParse("${userInfo?.raiseMoney}") ?? 0;
@ -318,8 +326,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
///
queryActivity() async {
BaseData<ActivityPos>? baseData =
await apiService?.appPopup().catchError((onError) {});
BaseData<ActivityPos>? baseData = await apiService?.appPopup().catchError((onError) {
return BaseData<ActivityPos>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
if (baseData!.data?.enabled ?? true)
posterShowAlertDialog(baseData.data, widget.firstLoginCouponList);
@ -337,8 +346,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
);
});
}
BaseData? baseData =
await apiService?.wiped(memberCouponId).catchError((onError) {});
BaseData? baseData = await apiService?.wiped(memberCouponId).catchError((onError) {
return BaseData()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
@ -354,7 +364,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
"pageSize": 10,
"searchKey": "",
"state": 0
}).catchError((onError) {});
}).catchError((onError) {
return BaseData<PageInfo<Coupon>>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
coupons = baseData!.data?.list ?? [];
}
@ -390,81 +402,6 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
super.build(context);
return Column(
children: [
// MyAppBar(
// title: "首页",
// leading: false,
// actions: [
// Container(
// height: 24,
// alignment: Alignment.center,
// margin: EdgeInsets.only(
// right: 12.w,
// ),
// child: GestureDetector(
// onTap: () {
// Navigator.of(context).pushNamed('/router/system_msg_page').then((value) {
// setState(() {
// totalMsg = 0;
// });
// });
// // Navigator.of(context).pushNamed('/router/web_turntable_activity');
// },
// 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),
// child: GestureDetector(
// onTap: () {
// toScan();
// },
// child: SvgPicture.asset(
// "assets/svg/saoyisao.svg",
// width: 24,
// height: 24,
// ),
// ),
// ),
// ],
// ),
Expanded(
child: Container(
child: SmartRefresher(
@ -505,10 +442,10 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
if (coupons.length != 0) DiscountZone(coupons),
///-
if (homeRank?.commodityZone?.isNotEmpty ?? false)
if (homeRank?.CommodityZone?.isNotEmpty ?? false)
HomeRecommendGoods(homeRank),
if (homeRank?.commodityZone?.isEmpty ?? true)
if (homeRank?.CommodityZone?.isEmpty ?? true)
SizedBox(
height: 20.h,
),
@ -521,7 +458,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
WelfareCore(),
///
if (homeRank?.commodityList?.isNotEmpty ?? false)
if (homeRank?.CommodityList?.isNotEmpty ?? false)
TopSellingList(homeRank),
// ///
@ -558,7 +495,8 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
},
),
],
)),
),
),
),
),
),
@ -595,14 +533,13 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
onTap: () {
bannerClick(bannerData[position]);
},
child: Container(
child: MImage(
bannerData[position].imgUrl ?? "",
fit: BoxFit.cover,
aspectRatio: 1.25,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
),
),
);
},
itemCount: bannerData.length,

13
lib/home/home_view/home_recommend_goods.dart

@ -44,32 +44,31 @@ class _HomeRecommendGoods extends State<HomeRecommendGoods> {
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount: widget.homeRank?.commodityZone?.length ?? 0,
itemCount: widget.homeRank?.CommodityZone?.length ?? 0,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
String storeId = widget.homeRank!.commodityZone![position].storeId ?? "";
String storeId = widget.homeRank!.CommodityZone![position].storeId ?? "";
miniLogin(apiService!, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": widget.homeRank!.commodityZone![position].storeId,
"tenant": widget.homeRank!.commodityZone![position].tenantCode,
"id": widget.homeRank!.CommodityZone![position].storeId,
"tenant": widget.homeRank!.CommodityZone![position].tenantCode,
"storeName": "",
"miniToken": token,
},
);
});
},
child:
recommendGoodsItem(widget.homeRank!.commodityZone![position]),
child: recommendGoodsItem(widget.homeRank!.CommodityZone![position]),
);
},
),
);
}
Widget recommendGoodsItem(CommodityZone commodityZone) {
Widget recommendGoodsItem(CommodityZones commodityZone) {
return Container(
width: 158.w,
margin: EdgeInsets.only(

22
lib/home/home_view/top_selling_list.dart

@ -37,7 +37,7 @@ class _TopSellingList extends State<TopSellingList> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
image: DecorationImage(
image: NetworkImage(widget.homeRank?.commodityListImg ?? ""),
image: NetworkImage(widget.homeRank?.CommodityListImg ?? ""),
fit: BoxFit.cover,
),
),
@ -70,12 +70,12 @@ class _TopSellingList extends State<TopSellingList> {
child: ListView.builder(
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount: widget.homeRank?.commodityList?.length ?? 0,
itemCount: widget.homeRank?.CommodityList?.length ?? 0,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: hotSaleItem(
widget.homeRank!.commodityList![position], position),
widget.homeRank!.CommodityList![position], position),
);
},
),
@ -85,9 +85,8 @@ class _TopSellingList extends State<TopSellingList> {
);
}
Widget hotSaleItem(CommodityList commodityList, index) {
int itemLength =
(widget.homeRank?.commodityList?[index].goodList?.length ?? 0);
Widget hotSaleItem(Commoditys commodityList, index) {
int itemLength = (widget.homeRank?.CommodityList?[index].goodList?.length ?? 0);
return Container(
width: 290.w,
decoration: BoxDecoration(
@ -121,15 +120,15 @@ class _TopSellingList extends State<TopSellingList> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
String storeId = widget.homeRank!.commodityList![index]
String storeId = widget.homeRank!.CommodityList![index]
.goodList![position].storeId ?? "";
miniLogin(apiService!, storeId, (token) {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": widget.homeRank!.commodityList![index]
"id": widget.homeRank!.CommodityList![index]
.goodList![position].storeId,
"tenant": widget.homeRank!.commodityList![index]
"tenant": widget.homeRank!.CommodityList![index]
.goodList![position].tenantCode,
"storeName": "",
"miniToken": token,
@ -137,10 +136,7 @@ class _TopSellingList extends State<TopSellingList> {
);
});
},
child: rankingItem(
widget
.homeRank!.commodityList![index].goodList![position],
position),
child: rankingItem(widget.homeRank!.CommodityList![index].goodList![position], position),
);
},
),

12
lib/home/home_view/union_entry.dart

@ -27,7 +27,6 @@ class _UnionEntry extends State<UnionEntry> {
@override
Widget build(BuildContext context) {
return Container(
height: 120.h,
width: double.infinity,
margin: EdgeInsets.only(
top: 14.h,
@ -35,6 +34,7 @@ class _UnionEntry extends State<UnionEntry> {
right: 9.w,
left: 9.w,
),
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
@ -58,6 +58,8 @@ class _UnionEntry extends State<UnionEntry> {
],
borderRadius: BorderRadius.circular(6.r),
),
child: AspectRatio(
aspectRatio: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
@ -82,6 +84,7 @@ class _UnionEntry extends State<UnionEntry> {
),
),
),
),
Expanded(
child: GestureDetector(
onTap: () {
@ -101,6 +104,8 @@ class _UnionEntry extends State<UnionEntry> {
],
borderRadius: BorderRadius.circular(6.r),
),
child: AspectRatio(
aspectRatio: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
@ -125,6 +130,7 @@ class _UnionEntry extends State<UnionEntry> {
),
),
),
),
Expanded(
child: GestureDetector(
onTap: () {
@ -144,6 +150,8 @@ class _UnionEntry extends State<UnionEntry> {
],
borderRadius: BorderRadius.circular(6.r),
),
child: AspectRatio(
aspectRatio: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
@ -168,8 +176,10 @@ class _UnionEntry extends State<UnionEntry> {
),
),
),
),
],
),
),
);
}
}

1
lib/im/chat_details_page.dart

@ -902,7 +902,6 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
showMessageMenu(context, _buttonKey, messages[position]);
},
onTap: () {
debugPrint("imageUrl: ${imageUrl}");
if (imageUrl.contains(messages[position].attach)) {
ImagePickers.previewImages(imageUrl, imageUrl.indexOf(messages[position].attach));
}

5
lib/im/im_view/im_page.dart

@ -435,7 +435,7 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
},
child: Container(
margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
padding: EdgeInsets.symmetric(vertical: 13.h),
padding: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration(
color: Color(0xFFFDFCFC),
borderRadius: BorderRadius.circular(4),
@ -460,7 +460,8 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
),
),
],
)),
),
),
);
}

105
lib/mine/mine_vip/mine_vip_core.dart

@ -110,7 +110,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.rankList().catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
return Future.value(null);
return BaseListData<Rank>()..isSuccess = false;
});
if (rankData?.isSuccess ?? false) {
ranks.clear();
@ -138,7 +138,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.benefitList().catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
return Future.value(null);
return BaseListData<VipBenefit>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
setState(() {
@ -158,7 +158,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.vipBenefit().catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
return Future.value(null);
return BaseData<VipRuleDetails>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
setState(() {
@ -181,8 +181,9 @@ class _MineVipCore extends State<MineVipCore> {
// }
// }
BaseData<WxPay>? baseData = await apiService?.rankBuy(
{"buyType": 2, "rankId": ranks[checkIndex].id}).catchError((onError) {
BaseData<WxPay>? baseData = await apiService?.rankBuy({
"buyType": 2, "rankId": ranks[checkIndex].id,
}).catchError((onError) {
return BaseData<WxPay>()..isSuccess = false;
});
if (baseData?.isSuccess ?? false) {
@ -248,6 +249,7 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(height: 40.h),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: GestureDetector(
@ -278,13 +280,13 @@ class _MineVipCore extends State<MineVipCore> {
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.only(right: 16.w),
margin: EdgeInsets.only(right: 16.w, bottom: 10.h),
child: GestureDetector(
onTap: () {
// Navigator.of(context).pushNamed('/router/integral_detailed_page');
},
child: Text(
"${S.of(context).dangqianzhukadengji} : ${userInfo?.masterCardRankName}",
"${S.of(context).dangqianzhukadengji} : ${userInfo?.masterCardRankName ?? userInfo?.memberRankVo?.rankName ?? ""}",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
@ -363,7 +365,6 @@ class _MineVipCore extends State<MineVipCore> {
itemCount: (ranks.isNotEmpty) ? ranks.length : 1,
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
@ -415,7 +416,6 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
@ -474,7 +474,6 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
@ -535,7 +534,6 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
@ -605,12 +603,11 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
)),
),
),
],
),
if (ranks.length > checkIndex &&
widget.arguments["rankLevel"] < ranks[checkIndex].level &&
ranks[checkIndex].price != "0.00")
if (ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00")
Align(
alignment: Alignment.bottomCenter,
child: InkWell(
@ -651,11 +648,9 @@ class _MineVipCore extends State<MineVipCore> {
Widget vipCar(int position) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 16.h, 8.w, 8.h),
width: MediaQuery.of(context).size.width - 32.w,
height: ((MediaQuery.of(context).size.width - 32.w) /
2.11 *
AppUtils.textScale(context)),
margin: EdgeInsets.fromLTRB(12.w, 8.h, 12.w, 8.h),
width: MediaQuery.of(context).size.width - 24.w,
height: ((MediaQuery.of(context).size.width - 16.w) / 2.11 * AppUtils.textScale(context)),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
@ -678,14 +673,13 @@ class _MineVipCore extends State<MineVipCore> {
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 86.w,
height: 86,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
@ -718,10 +712,7 @@ class _MineVipCore extends State<MineVipCore> {
child: Text(
"VIP ${ranks[position].rankName ?? ""}",
style: TextStyle(
color: Color(int.parse(
(ranks[position].textColor ?? "")
.replaceAll("#", "FF"),
radix: 16)),
color: Color(int.parse((ranks[position].textColor ?? "").replaceAll("#", "FF"), radix: 16)),
fontWeight: MyFontWeight.semi_bold,
fontSize: 22.sp,
),
@ -731,11 +722,11 @@ class _MineVipCore extends State<MineVipCore> {
),
),
Container(
margin: EdgeInsets.only(right: 11.w, bottom: 9.h),
margin: EdgeInsets.only(right: 11.w, bottom: 9),
child: Image.asset(
"assets/image/icon_mine_huixiang_logo.webp",
width: 86.w,
height: 86.w,
width: 86,
height: 86,
fit: BoxFit.contain,
),
),
@ -749,41 +740,26 @@ class _MineVipCore extends State<MineVipCore> {
bottom: 12.h,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (userInfo?.memberRankVo?.rankName !=
ranks[position].rankName ||
(userInfo?.memberRankVo?.rankName == "共创会员" &&
ranks[position].rankName == "共创会员"))
if (userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员"))
Align(
alignment: Alignment.centerRight,
child: Text(
(ranks[position].rankName == "共创会员")
? (userInfo?.memberRankVo?.rankName == "共创会员"
? "永久VIP"
(ranks[position].rankName == "共创会员") ? (userInfo?.memberRankVo?.rankName == "共创会员" ? "永久VIP"
: "${AppUtils.calculateDouble(double.tryParse("${ranks[position].price}") ?? 0)}/")
: (ranks[position].originScore ?? 0).toString(),
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(int.parse(
(ranks[position].textColor ?? "")
.replaceAll("#", "FF"),
radix: 16)),
fontWeight: ranks[position].rankName == "共创会员"
? MyFontWeight.regular
: MyFontWeight.bold,
fontSize: ranks[position].rankName == "共创会员"
? 14.sp
: 20.sp,
color: Color(int.parse((ranks[position].textColor ?? "").replaceAll("#", "FF"), radix: 16)),
fontWeight: ranks[position].rankName == "共创会员" ? MyFontWeight.regular : MyFontWeight.bold,
fontSize: ranks[position].rankName == "共创会员" ? 14.sp : 20.sp,
),
),
),
if (userInfo?.memberRankVo?.rankName ==
ranks[position].rankName &&
(userInfo?.memberRankVo?.rankName != "共创会员" &&
ranks[position].rankName != "共创会员"))
if (userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) ... [
Padding(
padding: EdgeInsets.only(bottom: 12.h),
padding: EdgeInsets.only(bottom: 8),
child: Row(
children: [
Expanded(
@ -833,12 +809,8 @@ class _MineVipCore extends State<MineVipCore> {
],
),
),
if (userInfo?.memberRankVo?.rankName ==
ranks[position].rankName &&
(userInfo?.memberRankVo?.rankName != "共创会员" &&
ranks[position].rankName != "共创会员"))
Container(
height: 8.h,
height: 8,
child: ClipRRect(
borderRadius: BorderRadius.circular(6.5),
child: LinearProgressIndicator(
@ -862,38 +834,29 @@ class _MineVipCore extends State<MineVipCore> {
),
),
),
],
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
S.of(context).kaitongriqi(
(widget.arguments["createTime"] != null &&
widget.arguments["createTime"] != "")
? widget.arguments["createTime"].split(" ")[0]
: widget.arguments["createTime"]),
S.of(context).kaitongriqi((widget.arguments["createTime"] != null && widget.arguments["createTime"] != "") ? widget.arguments["createTime"].split(" ")[0] : widget.arguments["createTime"]),
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(int.parse(
("${ranks[position].textColor}")
.replaceAll("#", "FF"),
radix: 16))),
color: Color(int.parse(("${ranks[position].textColor}").replaceAll("#", "FF"), radix: 16)),
),
),
Icon(
Icons.qr_code,
size: 24,
color: Color(int.parse(
("${ranks[position].textColor}")
.replaceAll("#", "FF"),
radix: 16)),
color: Color(int.parse(("${ranks[position].textColor}").replaceAll("#", "FF"), radix: 16)),
),
],
),
],
),
),
flex: 1,
),
],
),

2
lib/retrofit/min_api.g.dart

@ -14,7 +14,7 @@ class _MinApiService implements MinApiService {
this.baseUrl,
this.errorLogger,
}) {
baseUrl ??= 'https://pos.api.yixinhuixiang.com/app/';
baseUrl ??= 'http://192.168.10.54:8765/app/';
}
final Dio _dio;

61
lib/view_widget/custom_image.dart

@ -16,13 +16,13 @@ class MImage extends StatelessWidget {
final bool isCircle;
final bool noCompress;//
double scaleIndex = 2.5;
double scaleIndex = 1.5;
MImage(
this.src, {
this.errorSrc = "assets/image/default_2_1.webp",
this.fadeSrc = "assets/image/default_2_1.webp",
this.aspectRatio = 1,
this.aspectRatio = 0,
this.width,
this.height,
this.fit = BoxFit.cover,
@ -38,57 +38,45 @@ class MImage extends StatelessWidget {
double getImageWidth(context, double widgetWidth) {
double width = MediaQuery.of(context).size.width;
if (widgetWidth < (width / 3)) {
return 300;
} else if (widgetWidth < (width / 2)) {
if (widgetWidth > 700) {
return width;
} else if (widgetWidth > 300) {
return 700;
} else {
return width;
return 300;
}
}
double getImageHeiget(context, double widgetHeiget) {
double height = MediaQuery.of(context).size.height;
if (widgetHeiget < (height / 3)) {
return 600;
} else if (widgetHeiget < (height / 2)) {
return 1400;
double getImageHeight(context, double widgetHeight) {
if (widgetHeight > 700) {
return 1000;
} else if (widgetHeight > 300) {
return 700;
} else {
return height;
return 300;
}
}
@override
Widget build(BuildContext context) {
Widget image = LayoutBuilder(
builder: (context, constraints) {
builder: (ctx, constraints) {
String? imageUrl = "";
///
// 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
: getImageWidth(context, constraints.constrainWidth())) * scaleIndex).toInt();
int _h = ((constraints.constrainHeight()==double.infinity
? MediaQuery.of(context).size.height
: getImageHeiget(context, constraints.constrainHeight())) * scaleIndex).toInt();
int _w = ((getImageWidth(ctx, constraints.constrainWidth())) * scaleIndex).toInt();
int _h = ((getImageHeight(ctx, constraints.constrainHeight())) * scaleIndex).toInt();
///
if (src.startsWith("http")) {
if(noCompress)
if (noCompress) {
imageUrl = src;
else
imageUrl = "$src?imageView2/1/w/${_w}/h/${_h}/format/jpg/q/75";
} else {
imageUrl = "$src?imageView2/0/w/${_w}/format/jpg/q/100";
}
}
// print("imageUrl:$imageUrl");
// print("constrainWidth: ${constraints.constrainWidth()}");
// print("constrainHeight: ${constraints.constrainHeight()}");
debugPrint("imageUrl: $imageUrl");
if (imageUrl?.isEmpty ?? true) {
if (imageUrl.isEmpty) {
return Image.asset(
"assets/image/default_2_1.webp",
fit: fit,
@ -97,7 +85,7 @@ class MImage extends StatelessWidget {
Widget? cachedNetworkImage;
if (src.startsWith("http")) {
cachedNetworkImage = Image(
image: ResizeImage(NetworkToFileImage(
image: NetworkToFileImage(
url: imageUrl,
file: fileFromDocsDir("resize${(noCompress?"noCompress":"$_w$_h")}${src.replaceAll("https:", "")
.replaceAll("http:", "")
@ -105,8 +93,6 @@ class MImage extends StatelessWidget {
.replaceAll("/", "")}"),
debug: true,
),
width: _w,
height: _h),
errorBuilder: (context, error, stackTrace) {
return Image.asset(
errorSrc,
@ -133,7 +119,6 @@ class MImage extends StatelessWidget {
);
},
);
var clipRRect;
if (isCircle) {
clipRRect = ClipOval(clipBehavior: Clip.antiAlias, child: image);
@ -143,7 +128,7 @@ class MImage extends StatelessWidget {
child: image,
);
}
if (aspectRatio != null && aspectRatio > 0) {
if (aspectRatio > 0) {
return SizedBox(
width: width,
height: height,

22
pubspec.yaml

@ -34,9 +34,9 @@ dependencies:
intl: ^0.18.1
fluwx: ^4.5.0
fluwx: ^4.6.3
get: ^4.6.6
tobias: ^3.3.1
tobias: ^3.3.2
#pdf展示
flutter_pdfview: ^1.4.0
@ -63,7 +63,7 @@ dependencies:
permission_handler: ^11.3.0
geolocator: ^7.0.0
geolocator: ^7.7.1
# location: ^3.2.4
dio: ^5.7.0
@ -92,7 +92,7 @@ dependencies:
barcode_widget: ^2.0.4
qr_flutter: any
url_launcher: ^6.2.5
url_launcher: ^6.3.1
#多图, 裁剪
image_pickers: 2.0.4+8
@ -101,7 +101,7 @@ dependencies:
# qrscan: ^0.3.1
scan: ^1.6.0
path_provider: ^2.1.2
path_provider: ^2.1.4
network_to_file_image: ^7.0.0
image_gallery_saver: ^2.0.3
@ -137,9 +137,9 @@ dependencies:
flutter_slidable: ^3.0.1
emoji_picker_flutter: ^2.1.0
emoji_picker_flutter: ^2.1.1
mqtt_client: ^10.2.0
mqtt_client: ^10.3.0
shimmer: ^3.0.0
@ -153,16 +153,16 @@ dependencies:
widgetpicker: ^0.1.1
# floor: ^1.4.2
sqflite: ^2.3.3+1
webview_flutter: ^4.7.0
webview_flutter: ^4.8.0
syncfusion_flutter_datepicker: ^24.2.9
protobuf: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
retrofit_generator: ^8.1.0
build_runner: ^2.4.8
json_serializable: ^6.7.1
retrofit_generator: ^8.2.1
build_runner: ^2.4.9
json_serializable: ^6.8.0
flutter:

Loading…
Cancel
Save