Browse Source

UI调整

dart3_last
fff 2 weeks ago
parent
commit
85cfc42cf7
  1. 6
      lib/community/community_child_list.dart
  2. 8
      lib/community/community_child_page.dart
  3. 65
      lib/community/community_course.dart
  4. 117
      lib/community/community_view/class_list_view.dart
  5. 67
      lib/community/community_view/class_title_tab.dart
  6. 72
      lib/community/community_view/home_class.dart
  7. 3
      lib/constant.dart
  8. 22
      lib/data/home_rank.dart
  9. 35
      lib/data/home_rank.g.dart
  10. 141
      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. 254
      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. 789
      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){ if(isLoadMore){
pageNum += 1; pageNum += 1;
isLoadMore = false; isLoadMore = false;
}else pageNum = 1; } else {
pageNum = 1;
}
BaseData<PageInfo<ComunityComment>>? baseData = await apiService?.trendList({ BaseData<PageInfo<ComunityComment>>? baseData = await apiService?.trendList({
"onlyFollow": widget.typeStr == "关注" ? true : false, "onlyFollow": widget.typeStr == "关注" ? true : false,
"onlyMe": false, "onlyMe": false,
@ -55,8 +57,8 @@ class _CommunityChildList extends State<CommunityChildList> {
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
return BaseData<PageInfo<ComunityComment>>()..isSuccess = false;
}); });
refreshController.refreshCompleted(); refreshController.refreshCompleted();
refreshController.loadComplete(); refreshController.loadComplete();
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {

8
lib/community/community_child_page.dart

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

65
lib/community/community_course.dart

@ -97,8 +97,7 @@ class _CommunityCourse extends State<CommunityCourse>
/// ///
classListAsync() async { classListAsync() async {
BaseListData<CategorySelect>? baseData = BaseListData<CategorySelect>? baseData = await apiService?.categoryList().catchError((onError) {
await apiService?.categoryList().catchError((onError) {
return BaseListData<CategorySelect>()..isSuccess = false; return BaseListData<CategorySelect>()..isSuccess = false;
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
@ -183,47 +182,35 @@ class _CommunityCourse extends State<CommunityCourse>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Stack( return SmartRefresher(
children: [ controller: refreshController,
Positioned( enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {
_onRefresh();
});
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
child: Container(
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container( child: Container(
child: SmartRefresher( color: Color(0xFFF7F7F7),
controller: refreshController, margin: EdgeInsets.only(top: 16.h),
enablePullDown: true, child: Column(
enablePullUp: false, children: classChildItem(),
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {
_onRefresh();
});
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
child: Container(
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: Container(
color: Color(0xFFF7F7F7),
margin: EdgeInsets.only(top: 16.h),
child: Column(
children: classChildItem(),
),
),
),
),
), ),
), ),
bottom: 0,
top: 0,
left: 0,
right: 0,
), ),
], ),
); );
} }

117
lib/community/community_view/class_list_view.dart

@ -28,64 +28,34 @@ class _ClassListView extends State<ClassListView> {
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom: 30), margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom: 30),
) )
: : Container(
// GridView.builder( padding: EdgeInsets.symmetric(
// itemCount:widget.classList == null ? 0 : widget.classList.length, horizontal: 8,
// padding: EdgeInsets.only( vertical: 8,
// left: 16.w, ),
// right: 16.w, child: StaggeredGrid.count(
// top: 13.h, crossAxisCount: 2,
// bottom: 16.h, mainAxisSpacing: 8,
// ), crossAxisSpacing: 8,
// shrinkWrap: true, children: widget.classList.map((e) {
// physics: NeverScrollableScrollPhysics(), return GestureDetector(
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( onTap: () {
// //Widget数量 Navigator.of(context).pushNamed(
// crossAxisCount:2, '/router/class_details',
// //Widget之间间距 arguments: {"id": e.id},
// crossAxisSpacing: 11.w, ).then((value) => {e.viewers = (value as int?) ?? (e.viewers ?? 0) + 1});
// //Widget之间间距 },
// mainAxisSpacing: 16.w, child: classListItem(e),
// //Widget宽高比例 0.59 );
// childAspectRatio: }).toList(),
// 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(
crossAxisCount: 2,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
children: widget.classList.map((e) {
return GestureDetector(
onTap: () {
Navigator.of(context).pushNamed(
'/router/class_details',
arguments: {"id": e.id},
).then((value) =>
{e.viewers = (value as int?) ?? (e.viewers ?? 0) + 1});
},
child: classListItem(e),
);
}).toList(),
); );
} }
Widget classListItem(Course classList) { Widget classListItem(Course classList) {
return Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.vertical( borderRadius: BorderRadius.circular(8),
bottom: Radius.circular(4),
),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.black.withAlpha(10), color: Colors.black.withAlpha(10),
@ -96,44 +66,27 @@ class _ClassListView extends State<ClassListView> {
], ],
color: Colors.white, color: Colors.white,
), ),
margin: EdgeInsets.symmetric(
vertical: 3,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Stack( Stack(
alignment: Alignment(0.9, 0.9), alignment: Alignment(0.9, 0.9),
children: [ children: [
Container( ClipRRect(
decoration: BoxDecoration( child: Opacity(
borderRadius: BorderRadius.circular(4), opacity: 1,
boxShadow: [ child: MImage(
BoxShadow( classList.coverImg ?? "",
color: Colors.black.withAlpha(10), width: double.infinity,
offset: Offset(0, 3), height: 220.h,
blurRadius: 14, fit: BoxFit.cover,
spreadRadius: 0, errorSrc: "assets/image/default_1.webp",
) fadeSrc: "assets/image/default_1.webp",
],
color: Color.fromARGB(90, 0, 0, 0),
),
child: ClipRRect(
child: Opacity(
opacity: 0.7,
child: MImage(
classList.coverImg ?? "",
width: double.infinity,
height: 220.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
), ),
), ),
borderRadius: BorderRadius.vertical(
top: Radius.circular(8),
),
), ),
Container( Container(
padding: EdgeInsets.only(left: 4), padding: EdgeInsets.only(left: 4),

67
lib/community/community_view/class_title_tab.dart

@ -16,8 +16,7 @@ class ClassTitleTab extends StatefulWidget {
} }
} }
class _ClassTitleTab extends State<ClassTitleTab> class _ClassTitleTab extends State<ClassTitleTab> with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController? tabController; TabController? tabController;
@override @override
@ -29,37 +28,45 @@ class _ClassTitleTab extends State<ClassTitleTab>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context);
return Container( return Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: DefaultTabController( child: DefaultTabController(
length: widget.classSelectList?.length ?? 0, length: widget.classSelectList.length,
child: TabBar( child: TabBar(
isScrollable: true, isScrollable: true,
// //
indicatorColor: Color(0xff39B54A), indicatorColor: Color(0xff39B54A),
labelColor: Color(0xff32A060), labelColor: Color(0xff32A060),
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
unselectedLabelStyle: TextStyle( tabAlignment: TabAlignment.start,
fontSize: 14.sp, padding: EdgeInsets.symmetric(
fontWeight: MyFontWeight.regular, horizontal: 5.w,
), ),
controller: tabController, dividerHeight: 0,
// dividerColor: Colors.transparent,
unselectedLabelColor: Color(0xff4D4D4D), unselectedLabelStyle: TextStyle(
indicatorSize: TabBarIndicatorSize.label, fontSize: 14.sp,
onTap: (index){ fontWeight: MyFontWeight.regular,
widget.notifyClassSelectList(index); ),
}, controller: tabController,
// //
tabs: widget.classSelectList?.map((e) => MyTab(text: "${e.name}")).toList() ?? [], unselectedLabelColor: Color(0xff4D4D4D),
), indicatorSize: TabBarIndicatorSize.label,
), onTap: (index){
); widget.notifyClassSelectList(index);
},
//
tabs: widget.classSelectList.map((e) => MyTab(text: "${e.name}")).toList(),
),
),
);
} }
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }

72
lib/community/community_view/home_class.dart

@ -26,11 +26,6 @@ class _HomeClass extends State<HomeClass> {
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();
@override
void initState() {
super.initState();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView.builder( return ListView.builder(
@ -48,7 +43,6 @@ class _HomeClass extends State<HomeClass> {
Widget collectItem(CollectClass collectList) { Widget collectItem(CollectClass collectList) {
return Container( return Container(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
horizontal: 6.w,
vertical: 10.h, vertical: 10.h,
), ),
child: Column( child: Column(
@ -68,26 +62,30 @@ class _HomeClass extends State<HomeClass> {
Container( Container(
height: 195.h, height: 195.h,
margin: EdgeInsets.only(top: 10.h), margin: EdgeInsets.only(top: 10.h),
child: ListView.builder( child: ListView.separated(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
padding: EdgeInsets.symmetric(horizontal: 10.w), padding: EdgeInsets.symmetric(horizontal: 10),
itemCount: widget.collectMap[collectList.id]?.length ?? 0, itemCount: widget.collectMap[collectList.id]?.length ?? 0,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/class_details', '/router/class_details',
arguments: { arguments: {
"id": widget.collectMap[collectList.id]![position].id "id": widget.collectMap[collectList.id]![position].id
}).then((value) { },
int viewer = widget.collectMap[collectList.id]![position].viewers ?? 0; ).then((value) {
widget.collectMap[collectList.id]![position].viewers = value != null ? int.parse("${value}") : (viewer + 1); int viewer = widget.collectMap[collectList.id]![position].viewers ?? 0;
}); widget.collectMap[collectList.id]![position].viewers = value != null ? int.parse("${value}") : (viewer + 1);
});
}, },
child: classItem(widget.collectMap[collectList.id]![position]), 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, color: Colors.white,
), ),
margin: EdgeInsets.symmetric(
horizontal: 6.w,
),
child: Column( child: Column(
children: [ children: [
Stack( Stack(
@ -123,37 +118,17 @@ class _HomeClass extends State<HomeClass> {
Stack( Stack(
alignment: Alignment(0.9, 0.9), alignment: Alignment(0.9, 0.9),
children: [ children: [
Container( ClipRRect(
decoration: BoxDecoration( child: MImage(
borderRadius: BorderRadius.only( collect.coverImg ?? "",
topLeft: Radius.circular(4), width: double.infinity,
topRight: Radius.circular(4), height: 120.h,
), fit: BoxFit.cover,
boxShadow: [ errorSrc: "assets/image/default_1.webp",
BoxShadow( fadeSrc: "assets/image/default_1.webp",
color: Colors.black.withAlpha(10),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
color: Color.fromARGB(90, 0, 0, 0),
), ),
child: ClipRRect( borderRadius: BorderRadius.vertical(
child: Opacity( top: Radius.circular(4),
opacity: 0.7,
child: MImage(
collect.coverImg ?? "",
width: double.infinity,
height: 120.h,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
), ),
), ),
Container( Container(
@ -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接口的请求地址 /// 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/"; 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) @JsonSerializable(explicitToJson: true)
class HomeRank { class HomeRank {
List<CommodityList>? commodityList = []; List<Commoditys>? CommodityList = [];
List<CommodityZone>? commodityZone = []; List<CommodityZones>? CommodityZone = [];
String? commodityListImg = ''; String? CommodityListImg = '';
HomeRank(); HomeRank();
@ -19,16 +19,16 @@ class HomeRank {
} }
@JsonSerializable(explicitToJson: true) @JsonSerializable(explicitToJson: true)
class CommodityList { class Commoditys {
List<GoodList>? goodList = []; List<GoodList>? goodList = [];
String? typeName = ''; String? typeName = '';
CommodityList(); Commoditys();
factory CommodityList.fromJson(Map<String, dynamic> json) => _$CommodityListFromJson(json); factory Commoditys.fromJson(Map<String, dynamic> json) => _$CommoditysFromJson(json);
Map<String, dynamic> toJson() => _$CommodityListToJson(this); Map<String, dynamic> toJson() => _$CommoditysToJson(this);
} }
@JsonSerializable(explicitToJson: true) @JsonSerializable(explicitToJson: true)
class CommodityZone { class CommodityZones {
String? productImg = ''; String? productImg = '';
List<ProductSkuVOList>? productSkuVOList = []; List<ProductSkuVOList>? productSkuVOList = [];
String? thumbnailImg = ''; String? thumbnailImg = '';
@ -45,11 +45,11 @@ class CommodityZone {
String? storeId = ''; String? storeId = '';
String? tenantCode = ''; 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);
} }

35
lib/data/home_rank.g.dart

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

141
lib/home/home_page.dart

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

13
lib/home/home_view/home_recommend_goods.dart

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

22
lib/home/home_view/top_selling_list.dart

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

254
lib/home/home_view/union_entry.dart

@ -27,7 +27,6 @@ class _UnionEntry extends State<UnionEntry> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
height: 120.h,
width: double.infinity, width: double.infinity,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: 14.h, top: 14.h,
@ -35,140 +34,151 @@ class _UnionEntry extends State<UnionEntry> {
right: 9.w, right: 9.w,
left: 9.w, left: 9.w,
), ),
child: Row( child: IntrinsicHeight(
crossAxisAlignment: CrossAxisAlignment.center, child: Row(
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.center,
Expanded( children: [
child: GestureDetector( Expanded(
onTap: () { child: GestureDetector(
widget.goToOrder(1); onTap: () {
}, widget.goToOrder(1);
child: Container( },
margin: EdgeInsets.symmetric(horizontal: 5), child: Container(
decoration: BoxDecoration( margin: EdgeInsets.symmetric(horizontal: 5),
color: Color(0xFFFFFFFF), decoration: BoxDecoration(
boxShadow: [ color: Color(0xFFFFFFFF),
BoxShadow( boxShadow: [
color: Colors.black.withAlpha(12), BoxShadow(
offset: Offset(0, 3), color: Colors.black.withAlpha(12),
blurRadius: 14, offset: Offset(0, 3),
spreadRadius: 0, blurRadius: 14,
) spreadRadius: 0,
], )
borderRadius: BorderRadius.circular(6.r), ],
), borderRadius: BorderRadius.circular(6.r),
child: Column( ),
crossAxisAlignment: CrossAxisAlignment.center, child: AspectRatio(
mainAxisAlignment: MainAxisAlignment.center, aspectRatio: 1,
children: [ child: Column(
Image.asset( crossAxisAlignment: CrossAxisAlignment.center,
"assets/image/home_chi.webp", mainAxisAlignment: MainAxisAlignment.center,
fit: BoxFit.fill, children: [
width: 53.w, Image.asset(
height: 52.h, "assets/image/home_chi.webp",
), fit: BoxFit.fill,
SizedBox(height: 8.h), width: 53.w,
Text( height: 52.h,
S.of(context).chijiankang, ),
style: TextStyle( SizedBox(height: 8.h),
fontWeight: MyFontWeight.semi_bold, Text(
fontSize: 15.sp, S.of(context).chijiankang,
color: Color(0xFF0D0D0D), style: TextStyle(
), fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
color: Color(0xFF0D0D0D),
),
),
],
), ),
], ),
), ),
), ),
), ),
), Expanded(
Expanded( child: GestureDetector(
child: GestureDetector( onTap: () {
onTap: () { widget.goToOrder(2);
widget.goToOrder(2); },
}, child: Container(
child: Container( margin: EdgeInsets.symmetric(horizontal: 5),
margin: EdgeInsets.symmetric(horizontal: 5), decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFFFFFF),
color: Color(0xFFFFFFFF), boxShadow: [
boxShadow: [ BoxShadow(
BoxShadow( color: Colors.black.withAlpha(12),
color: Colors.black.withAlpha(12), offset: Offset(0, 3),
offset: Offset(0, 3), blurRadius: 14,
blurRadius: 14, spreadRadius: 0,
spreadRadius: 0, )
) ],
], borderRadius: BorderRadius.circular(6.r),
borderRadius: BorderRadius.circular(6.r), ),
), child: AspectRatio(
child: Column( aspectRatio: 1,
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.center,
Image.asset( children: [
"assets/image/home_he.webp", Image.asset(
fit: BoxFit.fill, "assets/image/home_he.webp",
width: 36.w, fit: BoxFit.fill,
height: 56.h, width: 36.w,
height: 56.h,
),
SizedBox(height: 8.h),
Text(
S.of(context).hejiankang,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
color: Color(0xFF0D0D0D),
),
),
],
), ),
SizedBox(height: 8.h), ),
Text(
S.of(context).hejiankang,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
color: Color(0xFF0D0D0D),
),
),
],
), ),
), ),
), ),
), Expanded(
Expanded( child: GestureDetector(
child: GestureDetector( onTap: () {
onTap: () { widget.goToOrder(3);
widget.goToOrder(3); },
}, child: Container(
child: Container( margin: EdgeInsets.symmetric(horizontal: 5),
margin: EdgeInsets.symmetric(horizontal: 5), decoration: BoxDecoration(
decoration: BoxDecoration( color: Color(0xFFFFFFFF),
color: Color(0xFFFFFFFF), boxShadow: [
boxShadow: [ BoxShadow(
BoxShadow( color: Colors.black.withAlpha(12),
color: Colors.black.withAlpha(12), offset: Offset(0, 3),
offset: Offset(0, 3), blurRadius: 14,
blurRadius: 14, spreadRadius: 0,
spreadRadius: 0,
),
],
borderRadius: BorderRadius.circular(6.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/home_wan.webp",
fit: BoxFit.fill,
width: 58.w,
height: 52.h,
),
SizedBox(height: 8.h),
Text(
S.of(context).wanjiankang,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
color: Color(0xFF0D0D0D),
), ),
],
borderRadius: BorderRadius.circular(6.r),
),
child: AspectRatio(
aspectRatio: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/image/home_wan.webp",
fit: BoxFit.fill,
width: 58.w,
height: 52.h,
),
SizedBox(height: 8.h),
Text(
S.of(context).wanjiankang,
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
color: Color(0xFF0D0D0D),
),
),
],
), ),
], ),
), ),
), ),
), ),
), ],
], ),
), ),
); );
} }

1
lib/im/chat_details_page.dart

@ -902,7 +902,6 @@ class _ChatDetailsPage extends State<ChatDetailsPage>
showMessageMenu(context, _buttonKey, messages[position]); showMessageMenu(context, _buttonKey, messages[position]);
}, },
onTap: () { onTap: () {
debugPrint("imageUrl: ${imageUrl}");
if (imageUrl.contains(messages[position].attach)) { if (imageUrl.contains(messages[position].attach)) {
ImagePickers.previewImages(imageUrl, imageUrl.indexOf(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( child: Container(
margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h), margin: EdgeInsets.fromLTRB(16.w, 0, 16.w, 16.h),
padding: EdgeInsets.symmetric(vertical: 13.h), padding: EdgeInsets.symmetric(vertical: 10.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color(0xFFFDFCFC), color: Color(0xFFFDFCFC),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
@ -460,7 +460,8 @@ class _IMPage extends State<IMPage> implements OnChatMessage {
), ),
), ),
], ],
)), ),
),
); );
} }

789
lib/mine/mine_vip/mine_vip_core.dart

@ -110,7 +110,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.rankList().catchError((onError) { await apiService?.rankList().catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
return Future.value(null); return BaseListData<Rank>()..isSuccess = false;
}); });
if (rankData?.isSuccess ?? false) { if (rankData?.isSuccess ?? false) {
ranks.clear(); ranks.clear();
@ -138,7 +138,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.benefitList().catchError((onError) { await apiService?.benefitList().catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
return Future.value(null); return BaseListData<VipBenefit>()..isSuccess = false;
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
setState(() { setState(() {
@ -158,7 +158,7 @@ class _MineVipCore extends State<MineVipCore> {
await apiService?.vipBenefit().catchError((onError) { await apiService?.vipBenefit().catchError((onError) {
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
return Future.value(null); return BaseData<VipRuleDetails>()..isSuccess = false;
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
setState(() { setState(() {
@ -181,8 +181,9 @@ class _MineVipCore extends State<MineVipCore> {
// } // }
// } // }
BaseData<WxPay>? baseData = await apiService?.rankBuy( BaseData<WxPay>? baseData = await apiService?.rankBuy({
{"buyType": 2, "rankId": ranks[checkIndex].id}).catchError((onError) { "buyType": 2, "rankId": ranks[checkIndex].id,
}).catchError((onError) {
return BaseData<WxPay>()..isSuccess = false; return BaseData<WxPay>()..isSuccess = false;
}); });
if (baseData?.isSuccess ?? false) { if (baseData?.isSuccess ?? false) {
@ -248,6 +249,7 @@ class _MineVipCore extends State<MineVipCore> {
SizedBox(height: 40.h), SizedBox(height: 40.h),
Container( Container(
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
@ -278,13 +280,13 @@ class _MineVipCore extends State<MineVipCore> {
), ),
Container( Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(right: 16.w), margin: EdgeInsets.only(right: 16.w, bottom: 10.h),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
// Navigator.of(context).pushNamed('/router/integral_detailed_page'); // Navigator.of(context).pushNamed('/router/integral_detailed_page');
}, },
child: Text( child: Text(
"${S.of(context).dangqianzhukadengji} : ${userInfo?.masterCardRankName}", "${S.of(context).dangqianzhukadengji} : ${userInfo?.masterCardRankName ?? userInfo?.memberRankVo?.rankName ?? ""}",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 16.sp, fontSize: 16.sp,
@ -297,320 +299,315 @@ class _MineVipCore extends State<MineVipCore> {
), ),
), ),
Expanded( Expanded(
child: SmartRefresher( child: SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
header: MyHeader( header: MyHeader(
color: Colors.white, color: Colors.white,
), ),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
return MyFooter(mode); return MyFooter(mode);
},
),
onRefresh: () {
_onRefresh();
}, },
),
onRefresh: () {
_onRefresh();
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: Column( scrollController: ScrollController(),
children: [ child: SingleChildScrollView(
/// physics: BouncingScrollPhysics(),
if (ranks.length > 0) child: Column(
Container( children: [
height: (MediaQuery.of(context).size.width) / ///
1.78 * if (ranks.length > 0)
AppUtils.textScale(context), Container(
child: Swiper( height: (MediaQuery.of(context).size.width) /
viewportFraction: 0.95, 1.78 *
loop: false, AppUtils.textScale(context),
physics: BouncingScrollPhysics(), child: Swiper(
index: checkIndex, viewportFraction: 0.95,
controller: controller, loop: false,
onIndexChanged: (index) { physics: BouncingScrollPhysics(),
setState(() { index: checkIndex,
checkIndex = index; controller: controller,
}); onIndexChanged: (index) {
}, setState(() {
itemBuilder: (context, position) { checkIndex = index;
return vipCar(position); });
// MineVipView( },
// vipLevel: !(ranks != null && ranks.isNotEmpty) itemBuilder: (context, position) {
// ? widget.arguments["rankLevel"] return vipCar(position);
// : position + 1, // MineVipView(
// curLevel: widget.arguments["rankLevel"], // vipLevel: !(ranks != null && ranks.isNotEmpty)
// tag: (widget.arguments["rankLevel"] == (position + 1) || // ? widget.arguments["rankLevel"]
// !(ranks != null && ranks.isNotEmpty)) // : position + 1,
// ? "vip" // curLevel: widget.arguments["rankLevel"],
// : "", // tag: (widget.arguments["rankLevel"] == (position + 1) ||
// padding: 6.w, // !(ranks != null && ranks.isNotEmpty))
// // rank: !(ranks != null && ranks.isNotEmpty) // ? "vip"
// // ? 0 // : "",
// // : widget.arguments["expendAmount"] ?? 0, // padding: 6.w,
// rankMax: !(ranks != null && ranks.isNotEmpty) // // rank: !(ranks != null && ranks.isNotEmpty)
// ? 0 // // ? 0
// : ranks[position].rankOrigin, // // : widget.arguments["expendAmount"] ?? 0,
// createTime: widget.arguments["createTime"], // rankMax: !(ranks != null && ranks.isNotEmpty)
// showRank: false, // ? 0
// price: !(ranks != null && ranks.isNotEmpty) // : ranks[position].rankOrigin,
// ? "0" // createTime: widget.arguments["createTime"],
// : ranks[position].price, // showRank: false,
// ); // price: !(ranks != null && ranks.isNotEmpty)
}, // ? "0"
itemCount: (ranks.isNotEmpty) ? ranks.length : 1, // : ranks[position].price,
// );
},
itemCount: (ranks.isNotEmpty) ? ranks.length : 1,
),
), ),
), ///
Container(
/// margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
Container( padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0), decoration: BoxDecoration(
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), color: Colors.white,
decoration: BoxDecoration( borderRadius: BorderRadius.only(
color: Colors.white, topLeft: Radius.circular(8),
borderRadius: BorderRadius.only( topRight: Radius.circular(8),
topLeft: Radius.circular(8), ),
topRight: Radius.circular(8),
), ),
), child: Column(
child: Column( mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: [ Row(
Row( children: [
children: [ Container(
Container( width: 4.w,
width: 4.w, height: 18.h,
height: 18.h, decoration: BoxDecoration(
decoration: BoxDecoration( gradient: new LinearGradient(
gradient: new LinearGradient( begin: Alignment.bottomCenter,
begin: Alignment.bottomCenter, end: Alignment.topCenter,
end: Alignment.topCenter, colors: [
colors: [ Color(0xFF000000),
Color(0xFF000000), Color(0xFF585858),
Color(0xFF585858), ],
], ),
), ),
), ),
), SizedBox(
SizedBox( width: 4.w,
width: 4.w,
),
Text(
S.of(context).huiyuanquanyi,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Colors.black,
), ),
), Text(
], S.of(context).huiyuanquanyi,
), style: TextStyle(
SizedBox( fontWeight: MyFontWeight.medium,
height: 12.h, fontSize: 16.sp,
), color: Colors.black,
vipLegalRight(),
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 4.w,
height: 18.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Color(0xFF000000),
Color(0xFF585858),
],
), ),
), ),
), ],
SizedBox(
width: 4.w,
),
Text(
S.of(context).huiyuanguize,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Colors.black,
),
),
],
),
SizedBox(
height: 12.h,
),
if (vipRuleDetails?.qa?.isNotEmpty ?? false)
Container(
color: Colors.white,
padding: EdgeInsets.only(left: 8.w),
child: Html(
data: vipRuleDetails?.qa ?? "",
),
), ),
], SizedBox(
), height: 12.h,
), ),
vipLegalRight(),
/// ],
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
), ),
), ),
child: Column( ///
mainAxisAlignment: MainAxisAlignment.start, Container(
crossAxisAlignment: CrossAxisAlignment.start, margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
children: [ padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
Row( decoration: BoxDecoration(
children: [ color: Colors.white,
Container( borderRadius: BorderRadius.only(
width: 4.w, topLeft: Radius.circular(8),
height: 18.h, topRight: Radius.circular(8),
decoration: BoxDecoration( ),
gradient: new LinearGradient( ),
begin: Alignment.bottomCenter, child: Column(
end: Alignment.topCenter, mainAxisAlignment: MainAxisAlignment.start,
colors: [ crossAxisAlignment: CrossAxisAlignment.start,
Color(0xFF000000), children: [
Color(0xFF585858), Row(
], children: [
Container(
width: 4.w,
height: 18.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Color(0xFF000000),
Color(0xFF585858),
],
),
), ),
), ),
), SizedBox(
SizedBox( width: 4.w,
width: 4.w, ),
), Text(
Text( S.of(context).huiyuanguize,
S.of(context).huiyuanjibieduizhao, style: TextStyle(
style: TextStyle( fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, fontSize: 16.sp,
fontSize: 16.sp, color: Colors.black,
color: Colors.black, ),
),
],
),
SizedBox(
height: 12.h,
),
if (vipRuleDetails?.qa?.isNotEmpty ?? false)
Container(
color: Colors.white,
padding: EdgeInsets.only(left: 8.w),
child: Html(
data: vipRuleDetails?.qa ?? "",
), ),
), ),
], ],
),
SizedBox(
height: 12.h,
),
MImage(
vipRuleDetails?.contrast ?? "",
width: double.infinity,
height: 281.h,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
height: 16.h,
),
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
), ),
), ),
child: Column( ///
mainAxisAlignment: MainAxisAlignment.start, Container(
crossAxisAlignment: CrossAxisAlignment.start, margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
children: [ padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
Container( decoration: BoxDecoration(
padding: color: Colors.white,
EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), borderRadius: BorderRadius.only(
child: Column( topLeft: Radius.circular(8),
mainAxisAlignment: MainAxisAlignment.start, topRight: Radius.circular(8),
crossAxisAlignment: CrossAxisAlignment.start, ),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [ children: [
Row( Container(
children: [ width: 4.w,
Container( height: 18.h,
width: 4.w, decoration: BoxDecoration(
height: 18.h, gradient: new LinearGradient(
decoration: BoxDecoration( begin: Alignment.bottomCenter,
gradient: new LinearGradient( end: Alignment.topCenter,
begin: Alignment.bottomCenter, colors: [
end: Alignment.topCenter, Color(0xFF000000),
colors: [ Color(0xFF585858),
Color(0xFF000000), ],
Color(0xFF585858),
],
),
),
),
SizedBox(
width: 4.w,
), ),
Text( ),
S.of(context).huiyuanhuodejifen,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Colors.black,
),
),
],
), ),
SizedBox( SizedBox(
height: 12.h, width: 4.w,
), ),
if (vipRuleDetails?.rule?.isNotEmpty ?? false) Text(
Container( S.of(context).huiyuanjibieduizhao,
color: Colors.white, style: TextStyle(
child: Html( fontWeight: MyFontWeight.medium,
data: vipRuleDetails?.rule ?? "", fontSize: 16.sp,
), color: Colors.black,
), ),
),
], ],
), ),
SizedBox(
height: 12.h,
),
MImage(
vipRuleDetails?.contrast ?? "",
width: double.infinity,
height: 281.h,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
height: 16.h,
),
],
),
),
///
Container(
margin: EdgeInsets.fromLTRB(0, 16.h, 0, 0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
), ),
], ),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:
EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 4.w,
height: 18.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
colors: [
Color(0xFF000000),
Color(0xFF585858),
],
),
),
),
SizedBox(
width: 4.w,
),
Text(
S.of(context).huiyuanhuodejifen,
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 16.sp,
color: Colors.black,
),
),
],
),
SizedBox(
height: 12.h,
),
if (vipRuleDetails?.rule?.isNotEmpty ?? false)
Container(
color: Colors.white,
child: Html(
data: vipRuleDetails?.rule ?? "",
),
),
],
),
),
],
),
), ),
), ],
], ),
), ),
), ),
)), ),
], ],
), ),
if (ranks.length > checkIndex && if (ranks.length > checkIndex && widget.arguments["rankLevel"] < ranks[checkIndex].level && ranks[checkIndex].price != "0.00")
widget.arguments["rankLevel"] < ranks[checkIndex].level &&
ranks[checkIndex].price != "0.00")
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: InkWell( child: InkWell(
@ -651,11 +648,9 @@ class _MineVipCore extends State<MineVipCore> {
Widget vipCar(int position) { Widget vipCar(int position) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 16.h, 8.w, 8.h), margin: EdgeInsets.fromLTRB(12.w, 8.h, 12.w, 8.h),
width: MediaQuery.of(context).size.width - 32.w, width: MediaQuery.of(context).size.width - 24.w,
height: ((MediaQuery.of(context).size.width - 32.w) / height: ((MediaQuery.of(context).size.width - 16.w) / 2.11 * AppUtils.textScale(context)),
2.11 *
AppUtils.textScale(context)),
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
colors: [ colors: [
@ -678,14 +673,13 @@ class _MineVipCore extends State<MineVipCore> {
], ],
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
height: 86.w, height: 86,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -718,10 +712,7 @@ class _MineVipCore extends State<MineVipCore> {
child: Text( child: Text(
"VIP ${ranks[position].rankName ?? ""}", "VIP ${ranks[position].rankName ?? ""}",
style: TextStyle( style: TextStyle(
color: Color(int.parse( color: Color(int.parse((ranks[position].textColor ?? "").replaceAll("#", "FF"), radix: 16)),
(ranks[position].textColor ?? "")
.replaceAll("#", "FF"),
radix: 16)),
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
fontSize: 22.sp, fontSize: 22.sp,
), ),
@ -731,11 +722,11 @@ class _MineVipCore extends State<MineVipCore> {
), ),
), ),
Container( Container(
margin: EdgeInsets.only(right: 11.w, bottom: 9.h), margin: EdgeInsets.only(right: 11.w, bottom: 9),
child: Image.asset( child: Image.asset(
"assets/image/icon_mine_huixiang_logo.webp", "assets/image/icon_mine_huixiang_logo.webp",
width: 86.w, width: 86,
height: 86.w, height: 86,
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
), ),
@ -749,151 +740,123 @@ class _MineVipCore extends State<MineVipCore> {
bottom: 12.h, bottom: 12.h,
), ),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
if (userInfo?.memberRankVo?.rankName != if (userInfo?.memberRankVo?.rankName != ranks[position].rankName || (userInfo?.memberRankVo?.rankName == "共创会员" && ranks[position].rankName == "共创会员"))
ranks[position].rankName ||
(userInfo?.memberRankVo?.rankName == "共创会员" &&
ranks[position].rankName == "共创会员"))
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Text( child: Text(
(ranks[position].rankName == "共创会员") (ranks[position].rankName == "共创会员") ? (userInfo?.memberRankVo?.rankName == "共创会员" ? "永久VIP"
? (userInfo?.memberRankVo?.rankName == "共创会员" : "${AppUtils.calculateDouble(double.tryParse("${ranks[position].price}") ?? 0)}/")
? "永久VIP"
: "${AppUtils.calculateDouble(double.tryParse("${ranks[position].price}") ?? 0)}/")
: (ranks[position].originScore ?? 0).toString(), : (ranks[position].originScore ?? 0).toString(),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Color(int.parse( color: Color(int.parse((ranks[position].textColor ?? "").replaceAll("#", "FF"), radix: 16)),
(ranks[position].textColor ?? "") fontWeight: ranks[position].rankName == "共创会员" ? MyFontWeight.regular : MyFontWeight.bold,
.replaceAll("#", "FF"), fontSize: ranks[position].rankName == "共创会员" ? 14.sp : 20.sp,
radix: 16)),
fontWeight: ranks[position].rankName == "共创会员"
? MyFontWeight.regular
: MyFontWeight.bold,
fontSize: ranks[position].rankName == "共创会员"
? 14.sp
: 20.sp,
), ),
), ),
), ),
if (userInfo?.memberRankVo?.rankName == if (userInfo?.memberRankVo?.rankName == ranks[position].rankName && (userInfo?.memberRankVo?.rankName != "共创会员" && ranks[position].rankName != "共创会员")) ... [
ranks[position].rankName && Padding(
(userInfo?.memberRankVo?.rankName != "共创会员" && padding: EdgeInsets.only(bottom: 8),
ranks[position].rankName != "共创会员")) child: Row(
Padding( children: [
padding: EdgeInsets.only(bottom: 12.h), Expanded(
child: Row( child: Text(
children: [ "消费满 ¥${userInfo?.memberRankVo?.nextOrigin ?? "0"} 升级为 ${userInfo?.memberRankVo?.nextName ?? ""}",
Expanded( overflow: TextOverflow.ellipsis,
child: Text( style: TextStyle(
"消费满 ¥${userInfo?.memberRankVo?.nextOrigin ?? "0"} 升级为 ${userInfo?.memberRankVo?.nextName ?? ""}", color: Color(int.parse(
overflow: TextOverflow.ellipsis, (ranks[position].textColor ?? "")
style: TextStyle( .replaceAll("#", "FF"),
color: Color(int.parse( radix: 16)),
(ranks[position].textColor ?? "") fontWeight: MyFontWeight.regular,
.replaceAll("#", "FF"), fontSize: 14.sp,
radix: 16)), ),
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
), ),
), ),
), Text.rich(
Text.rich( TextSpan(
TextSpan( children: [
children: [ TextSpan(
TextSpan( text:
text: "${AppUtils.calculateDouble(double.tryParse("${userInfo?.expendAmount}") ?? 0)}",
"${AppUtils.calculateDouble(double.tryParse("${userInfo?.expendAmount}") ?? 0)}", style: TextStyle(
style: TextStyle( fontSize: 24.sp,
fontSize: 24.sp, fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, color: Color(int.parse(
color: Color(int.parse( (ranks[position].textColor ?? "")
(ranks[position].textColor ?? "") .replaceAll("#", "FF"),
.replaceAll("#", "FF"), radix: 16)),
radix: 16)), ),
), ),
), TextSpan(
TextSpan( text:
text: "/${userInfo?.memberRankVo?.nextOrigin ?? "0"}",
"/${userInfo?.memberRankVo?.nextOrigin ?? "0"}", style: TextStyle(
style: TextStyle( fontSize: 14.sp,
fontSize: 14.sp, fontWeight: MyFontWeight.regular,
fontWeight: MyFontWeight.regular, color: Color(int.parse(
color: Color(int.parse( (ranks[position].textColor ?? "")
(ranks[position].textColor ?? "") .replaceAll("#", "FF"),
.replaceAll("#", "FF"), radix: 16)),
radix: 16)), ),
), ),
), ],
], ),
), ),
), ],
], ),
), ),
), Container(
if (userInfo?.memberRankVo?.rankName == height: 8,
ranks[position].rankName && child: ClipRRect(
(userInfo?.memberRankVo?.rankName != "共创会员" && borderRadius: BorderRadius.circular(6.5),
ranks[position].rankName != "共创会员")) child: LinearProgressIndicator(
Container( value: (userInfo?.memberRankVo?.nextOrigin ?? 0) >
height: 8.h, ((double.tryParse(
child: ClipRRect( "${userInfo?.expendAmount}") ??
borderRadius: BorderRadius.circular(6.5), 0)
child: LinearProgressIndicator( .toInt())
value: (userInfo?.memberRankVo?.nextOrigin ?? 0) > ? ((checkIndex < (rankNameIndex ?? 0))
((double.tryParse( ? (userInfo?.memberRankVo?.nextOrigin ?? 0) /
"${userInfo?.expendAmount}") ?? (userInfo?.memberRankVo?.nextOrigin ?? 0)
0) : ((double.tryParse(
.toInt()) "${userInfo?.expendAmount}") ??
? ((checkIndex < (rankNameIndex ?? 0)) 0)
? (userInfo?.memberRankVo?.nextOrigin ?? 0) / .toInt()) /
(userInfo?.memberRankVo?.nextOrigin ?? 0) (userInfo?.memberRankVo?.nextOrigin ?? 0))
: ((double.tryParse( : 0,
"${userInfo?.expendAmount}") ?? backgroundColor: Colors.white,
0) color: AppUtils.getLighterColor(
.toInt()) / ranks[position].color ?? ""),
(userInfo?.memberRankVo?.nextOrigin ?? 0)) ),
: 0,
backgroundColor: Colors.white,
color: AppUtils.getLighterColor(
ranks[position].color ?? ""),
), ),
), ),
), ],
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
S.of(context).kaitongriqi( S.of(context).kaitongriqi((widget.arguments["createTime"] != null && widget.arguments["createTime"] != "") ? widget.arguments["createTime"].split(" ")[0] : widget.arguments["createTime"]),
(widget.arguments["createTime"] != null &&
widget.arguments["createTime"] != "")
? widget.arguments["createTime"].split(" ")[0]
: widget.arguments["createTime"]),
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
fontSize: 12.sp, fontSize: 12.sp,
color: Color(int.parse( color: Color(int.parse(("${ranks[position].textColor}").replaceAll("#", "FF"), radix: 16)),
("${ranks[position].textColor}") ),
.replaceAll("#", "FF"),
radix: 16))),
), ),
Icon( Icon(
Icons.qr_code, Icons.qr_code,
size: 24, size: 24,
color: Color(int.parse( color: Color(int.parse(("${ranks[position].textColor}").replaceAll("#", "FF"), radix: 16)),
("${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.baseUrl,
this.errorLogger, this.errorLogger,
}) { }) {
baseUrl ??= 'https://pos.api.yixinhuixiang.com/app/'; baseUrl ??= 'http://192.168.10.54:8765/app/';
} }
final Dio _dio; final Dio _dio;

61
lib/view_widget/custom_image.dart

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

22
pubspec.yaml

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

Loading…
Cancel
Save