|
|
|
@ -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, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
)), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|