|
|
@ -31,6 +31,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
final RefreshController refreshController = RefreshController(); |
|
|
|
List<Farmers> farmersList = []; |
|
|
|
List<Farmers> farmersList = []; |
|
|
|
int tabIndex = 0; |
|
|
|
int tabIndex = 0; |
|
|
|
|
|
|
|
int farmersListData = 0; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
@ -57,10 +58,11 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
if (baseData?.isSuccess ?? false) { |
|
|
|
farmersList.clear(); |
|
|
|
farmersList.clear(); |
|
|
|
farmersList.addAll(baseData!.data ?? []); |
|
|
|
farmersList.addAll(baseData?.data ?? []); |
|
|
|
refreshController.refreshCompleted(); |
|
|
|
refreshController.refreshCompleted(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
refreshController.refreshFailed(); |
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
|
|
|
farmersListData = 1; |
|
|
|
} |
|
|
|
} |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
@ -100,7 +102,9 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
centerTitle: true, |
|
|
|
centerTitle: true, |
|
|
|
flexibleSpace: FlexibleSpaceBar( |
|
|
|
flexibleSpace: FlexibleSpaceBar( |
|
|
|
background: MImage( |
|
|
|
background: MImage( |
|
|
|
farmersList[tabIndex].agriculturaListImg ?? "", |
|
|
|
farmersList.isEmpty |
|
|
|
|
|
|
|
? "" |
|
|
|
|
|
|
|
: (farmersList[tabIndex].agriculturaListImg ?? ""), |
|
|
|
fit: BoxFit.fill, |
|
|
|
fit: BoxFit.fill, |
|
|
|
width: double.infinity, |
|
|
|
width: double.infinity, |
|
|
|
height: 354.h, |
|
|
|
height: 354.h, |
|
|
@ -127,7 +131,7 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
//可滚动 |
|
|
|
//可滚动 |
|
|
|
indicatorColor: Colors.white, |
|
|
|
indicatorColor: Colors.white, |
|
|
|
//tab排放方向 |
|
|
|
//tab排放方向 |
|
|
|
tabAlignment:TabAlignment.start, |
|
|
|
tabAlignment: TabAlignment.start, |
|
|
|
//去掉底部线条 |
|
|
|
//去掉底部线条 |
|
|
|
dividerHeight: 0, |
|
|
|
dividerHeight: 0, |
|
|
|
labelColor: Colors.white, |
|
|
|
labelColor: Colors.white, |
|
|
@ -146,9 +150,8 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
indicatorSize: TabBarIndicatorSize.label, |
|
|
|
indicatorSize: TabBarIndicatorSize.label, |
|
|
|
//指示器与文字等宽 |
|
|
|
//指示器与文字等宽 |
|
|
|
tabs: farmersList |
|
|
|
tabs: farmersList |
|
|
|
?.map((e) => MyTab(text: "${e.typeName}")) |
|
|
|
.map((e) => MyTab(text: "${e.typeName}")) |
|
|
|
.toList() ?? |
|
|
|
.toList(), |
|
|
|
[], |
|
|
|
|
|
|
|
onTap: (index) { |
|
|
|
onTap: (index) { |
|
|
|
// queryConfig("AgriculturalList"); |
|
|
|
// queryConfig("AgriculturalList"); |
|
|
|
tabIndex = index; |
|
|
|
tabIndex = index; |
|
|
@ -172,8 +175,8 @@ class _HelpFarmersPage extends State<HelpFarmersPage> { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
color: Colors.white, |
|
|
|
color: Colors.white, |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w), |
|
|
|
padding: EdgeInsets.symmetric(horizontal: 10.w), |
|
|
|
child: (farmersList.isNotEmpty && |
|
|
|
child: (farmersList.isEmpty || |
|
|
|
(farmersList[tabIndex].goodList?.isEmpty ?? false)) |
|
|
|
(farmersList[tabIndex].goodList ?? []).isEmpty) |
|
|
|
? NoDataView( |
|
|
|
? NoDataView( |
|
|
|
src: "assets/image/xiao_fei.webp", |
|
|
|
src: "assets/image/xiao_fei.webp", |
|
|
|
isShowBtn: false, |
|
|
|
isShowBtn: false, |
|
|
|