From 4c93484e58b7fd9262117a735af7711499707dba Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Thu, 28 Jan 2021 15:09:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=90=AC=E5=AE=B6=E5=85=AC=E5=8F=B8=E7=94=B5?= =?UTF-8?q?=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../select_move_company_page.dart | 49 +++++++++++++------ lib/pages/manager_func.dart | 5 +- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/lib/pages/goods_deto_page/select_move_company_page.dart b/lib/pages/goods_deto_page/select_move_company_page.dart index 4a43f9f1..cc10ee1b 100644 --- a/lib/pages/goods_deto_page/select_move_company_page.dart +++ b/lib/pages/goods_deto_page/select_move_company_page.dart @@ -19,6 +19,19 @@ class SelectMoveCompanyPage extends StatefulWidget { class _SelectMoveCompanyPageState extends State { int _selected; MovingCompanyModel _companyModel; + EasyRefreshController _controller; + bool _onloading = true; + @override + void initState() { + super.initState(); + _controller = EasyRefreshController(); + } + + @override + void dispose() { + _controller = EasyRefreshController(); + super.dispose(); + } Widget _buildCard(int index, String name, String tel) { return Container( @@ -94,29 +107,37 @@ class _SelectMoveCompanyPageState extends State { ); } + Widget _emptyWidget() { + return Container(); + } + @override Widget build(BuildContext context) { return BeeScaffold( title: '搬家公司', body: EasyRefresh( + firstRefresh: true, + controller: _controller, onRefresh: () async { _companyModel = await ManagerFunc.getMovingCompanyTel(); + _onloading = false; + setState(() {}); }, header: MaterialHeader(), - child: ListView( - padding: EdgeInsets.all(32.w), - children: [ - ..._companyModel.appMovingCompanyVoList - .map((e) => _buildCard( - _companyModel.appMovingCompanyVoList.indexOf(e), - e.name, - e.tel)) - .toList(), - _buildForself( - _companyModel.appMovingCompanyVoList.length - ) - ].sepWidget(separate: BeeDivider.horizontal()), - ), + child: _onloading + ? _emptyWidget() + : ListView( + padding: EdgeInsets.all(32.w), + children: [ + ..._companyModel.appMovingCompanyVoList + .map((e) => _buildCard( + _companyModel.appMovingCompanyVoList.indexOf(e), + e.name, + e.tel)) + .toList(), + _buildForself(_companyModel.appMovingCompanyVoList.length) + ].sepWidget(separate: BeeDivider.horizontal()), + ), ), ); } diff --git a/lib/pages/manager_func.dart b/lib/pages/manager_func.dart index 40e5f3b0..f6ace3cf 100644 --- a/lib/pages/manager_func.dart +++ b/lib/pages/manager_func.dart @@ -96,10 +96,9 @@ class ManagerFunc { } static Future getMovingCompanyTel() async { - BaseModel baseModel = await NetUtil().get( + Response response= await NetUtil().dio.get( API.manager.getMovingCompanyTel, - showMessage: false, ); - return MovingCompanyModel.fromJson(baseModel.data); + return MovingCompanyModel.fromJson(response.data); } }