Browse Source

视频详情数据异常处理;

引导页弹窗ui显示异常处理;
结算页优惠券数据异常处理;
购物车数据异常处理;
dart3
wurong 5 months ago
parent
commit
79e34c355a
  1. 17
      lib/community/community_view/class_details.dart
  2. 61
      lib/home/guide_page.dart
  3. 193
      lib/home/help_farmers/help_farmers_page.dart
  4. 2
      lib/retrofit/retrofit_api.dart
  5. 12
      lib/settlement/settlement.dart
  6. 6
      lib/store/store_view/shop_goods_car.dart

17
lib/community/community_view/class_details.dart

@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
@ -15,6 +16,7 @@ import 'package:huixiang/view_widget/tips_dialog.dart';
import 'package:huixiang/web/web_view/comment_list.dart';
import 'package:huixiang/web/web_view/input_comment.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_defines.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
import 'package:sharesdk_plugin/sharesdk_map.dart';
@ -60,8 +62,17 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
super.initState();
WidgetsBinding.instance.addObserver(this);
commentFocus.addListener(_focusNodeListener);
courseDetails(widget.arguments["id"]);
queryChapterList(widget.arguments["id"]);
if (apiService == null) {
SharedPreferences.getInstance().then((value) {
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
courseDetails(widget.arguments["id"]);
queryChapterList(widget.arguments["id"]);
});
}
}
///
@ -333,7 +344,7 @@ class _ClassDetails extends State<ClassDetails> with WidgetsBindingObserver {
children: [
Expanded(
child: Text(
"${S.of(context).jiangshi}:${course?.author?.name}",
"${S.of(context).jiangshi}:${course?.author?.name ?? ""}",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(

61
lib/home/guide_page.dart

@ -535,8 +535,8 @@ class _GuidePage extends State<GuidePage> {
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 24.w,
right: 24.w,
left: 36.w,
right: 36.w,
),
text: S.of(context).jujue,
fontSize: 12.sp,
@ -547,38 +547,37 @@ class _GuidePage extends State<GuidePage> {
),
),
),
15.vd,
Expanded(
child: Container(
height: 40.h,
margin: EdgeInsets.only(bottom: 20.h),
alignment: Alignment.bottomCenter,
child: RoundButton(
text: S.of(context).tongyibingjixu,
textColor: Colors.white,
fontSize: 12.sp,
callback: () {
SharedPreferences.getInstance().then((value) {
value.setBool("isShowPrivacyPolicy", true);
});
SharesdkPlugin.uploadPrivacyPermissionStatus(
1,
(success) {
Navigator.of(context).pop();
},
);
},
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 21.5.w,
right: 21.5.w,
),
backgroup: Color(0xff32A060),
radius: 23,
21.vd,
Container(
height: 40.h,
margin: EdgeInsets.only(bottom: 20.h),
alignment: Alignment.bottomCenter,
child: RoundButton(
text: S.of(context).tongyibingjixu,
textColor: Colors.white,
fontSize: 12.sp,
callback: () {
SharedPreferences.getInstance().then((value) {
value.setBool("isShowPrivacyPolicy", true);
});
SharesdkPlugin.uploadPrivacyPermissionStatus(
1,
(success) {
Navigator.of(context).pop();
},
);
},
padding: EdgeInsets.only(
top: 10.h,
bottom: 10.h,
left: 21.5.w,
right: 21.5.w,
),
backgroup: Color(0xff32A060),
radius: 23,
),
),
20.vd
],
),
],

193
lib/home/help_farmers/help_farmers_page.dart

@ -9,6 +9,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../data/base_data.dart';
@ -32,6 +33,8 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
List<Farmers> farmersList = [];
int tabIndex = 0;
int farmersListData = 0;
int networkStatus = 0;
String dataErrorText = "";
@override
void initState() {
@ -41,7 +44,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
Dio(),
context: context,
token: value.getString('token'),
// showLoading: true
showLoading: true
),
queryConfig(),
});
@ -54,15 +57,19 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
await apiService?.getConfig().catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
networkStatus = -1;
refreshController.refreshFailed();
});
if (baseData?.isSuccess ?? false) {
farmersList.clear();
farmersList.addAll(baseData?.data ?? []);
refreshController.refreshCompleted();
networkStatus= 1;
} else {
refreshController.refreshFailed();
farmersListData = 1;
dataErrorText = baseData?.msg ?? "";
networkStatus=2;
}
} finally {
setState(() {});
@ -74,7 +81,17 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: NestedScrollView(
body: networkStatus == 0 ? recommendSm():
(networkStatus == 2 ?Container(
color: Colors.white,
child: NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: dataErrorText,
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
)
):NestedScrollView(
headerSliverBuilder: (context, inner) {
return [
SliverAppBar(
@ -166,7 +183,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
];
},
body: recommend(),
),
)),
);
}
@ -300,4 +317,174 @@ class _HelpFarmersPage extends State<HelpFarmersPage> {
),
);
}
Widget recommendSm() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12,
spreadRadius: 0,
)
]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
color: Color(0XFFD8D8D8),
width: double.infinity,
height:289.h,
),
),
Row(
children: [
Padding(
padding: EdgeInsets.only(left: 6.w, bottom: 5.h, top: 12.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width:64.w,
height: 20.h,
),
),
),
Padding(
padding: EdgeInsets.only(left: 12.w, bottom: 5.h, top: 12.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 64.w,
height: 20.h,
),
),
),
Padding(
padding: EdgeInsets.only(left: 12.w, bottom: 5.h, top: 12.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 64.w,
height: 20.h,
),
),
),
Padding(
padding: EdgeInsets.only(left: 12.w, bottom: 5.h, top: 12.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 64.w,
height: 20.h,
),
),
),
],
),
Expanded(child: ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin:EdgeInsets.symmetric(horizontal:6.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
height: 174.h,
),
),
Padding(
padding: EdgeInsets.only(top: 7.h, left: 10.w, bottom: 8.h),
child: Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width:106.w,
height: 20.h,
),
),
),
Padding(
padding: EdgeInsets.only(left: 10.w, bottom: 12.h),
child:Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 166.w,
height: 20.h,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(100),
),
width: 86.w,
height: 25.h,
),
),
],
),
),
],
),
);
},
)),
],
),
);
}
}

2
lib/retrofit/retrofit_api.dart

@ -63,7 +63,7 @@ import 'package:huixiang/login/captcha/click_word_captcha.dart';
part 'retrofit_api.g.dart';
const localBaseUrl = "https://pos.platform.lotus-wallet.com/app//";///
const localBaseUrl = "http://192.168.10.54:8766/app/";///
// const localBaseUrl = "http://platform.test.api.lotus-wallet.com/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线

12
lib/settlement/settlement.dart

@ -89,7 +89,7 @@ class _Settlement extends State<Settlement> {
bool isRaiseChannel = false;
ShoppingCart? shopCarGoods;
String? vipLevelName;
bool isVips = false;
bool? isVips = false;
SubscribeParam? subscribeParam;
String? reservationTime;
String? subscribeStoresName;
@ -1619,7 +1619,7 @@ class _Settlement extends State<Settlement> {
///
activityCart() async {
// if (couponListBean != null) return;
PromotionInfoListBean pro = await showModalBottomSheet(
PromotionInfoListBean? pro = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
@ -1639,19 +1639,19 @@ class _Settlement extends State<Settlement> {
selectedBtn != 2)
? diningStatus
: selectedBtn,
(((pro.id ?? 0) ?? (productId ?? 0)) == 0 &&
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0 &&
(couponListBean?.id ?? 0) != 0)
? couponListBean?.id
: 0,
0,
(((pro.id ?? 0) ?? (productId ?? 0)) == 0 &&
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0 &&
(couponListBean?.id ?? 0) != 0)
? 0
: ((pro.id ?? 0) ?? productId),
: ((pro?.id ?? 0) ?? productId),
productSkuId ?? "",
actProductId ?? "",
actProductSkuId ?? "",
(((pro.id ?? 0) ?? (productId ?? 0)) == 0
(((pro?.id ?? 0) ?? (productId ?? 0)) == 0
? ((couponListBean?.id ?? 0) != 0 ? "COUPON" : "AUTO")
: "ACTIVITY"),
// useVipPriceSelect,

6
lib/store/store_view/shop_goods_car.dart

@ -55,7 +55,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
children: [
SizedBox(width: 12.w),
MImage(
widget.productListBean!.imgPath ?? widget.shoppingCartSkuItemListBean!.skuImg ?? "",
widget.productListBean?.imgPath ?? widget.shoppingCartSkuItemListBean!.skuImg ?? "",
width: 70.h,
height: 70.h,
radius: BorderRadius.circular(4),
@ -74,7 +74,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
children: [
Expanded(
child: Text(
widget.productListBean!.productName ?? widget.shoppingCartSkuItemListBean!.productName ?? "",
widget.productListBean?.productName ?? widget.shoppingCartSkuItemListBean!.productName ?? "",
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
@ -107,7 +107,7 @@ class _ShopGoodsCar extends State<ShopGoodsCar> {
children: [
Expanded(
child: Text(
widget.productListBean!.shortName
widget.productListBean?.shortName
?? ((widget.shoppingCartSkuItemListBean?.skuName == "0")
? "" : widget.shoppingCartSkuItemListBean?.skuName) ?? "",
overflow: TextOverflow.ellipsis,

Loading…
Cancel
Save