|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
|
import 'package:huixiang/data/base_data.dart';
|
|
|
|
import 'package:huixiang/data/invoice_list.dart';
|
|
|
|
import 'package:huixiang/generated/l10n.dart';
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart';
|
|
|
|
import 'package:huixiang/utils/flutter_utils.dart';
|
|
|
|
import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart';
|
|
|
|
import 'package:huixiang/view_widget/my_footer.dart';
|
|
|
|
import 'package:huixiang/view_widget/no_data_view.dart';
|
|
|
|
import 'package:huixiang/view_widget/settlement_tips_dialog.dart';
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
|
|
|
|
class InvoicesManagePage extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _InvoicesManagePage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _InvoicesManagePage extends State<InvoicesManagePage> {
|
|
|
|
final RefreshController refreshController = RefreshController();
|
|
|
|
ApiService? apiService;
|
|
|
|
String networkError = "";
|
|
|
|
int networkStatus = 0;
|
|
|
|
int _pageNum = 1;
|
|
|
|
var allCheckIndex = false;
|
|
|
|
List<Records> records = [];
|
|
|
|
List<Records> unRecords = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_onRefresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
///离开页面记着销毁和清除
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
refreshController.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
///开票列表
|
|
|
|
queryInvoiceList() async {
|
|
|
|
if (apiService == null) {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
apiService = ApiService(Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
showLoading: false);
|
|
|
|
}
|
|
|
|
BaseData<InvoiceList>? baseData = await apiService?.invoiceOrderList({
|
|
|
|
"current": _pageNum,
|
|
|
|
"size": 10,
|
|
|
|
"searchKey": "",
|
|
|
|
}).catchError((error) {
|
|
|
|
networkError = AppUtils.dioErrorTypeToString(error.type);
|
|
|
|
networkStatus = -1;
|
|
|
|
setState(() {});
|
|
|
|
refreshController.refreshFailed();
|
|
|
|
refreshController.loadFailed();
|
|
|
|
});
|
|
|
|
if (!mounted) return;
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
records.addAll(baseData?.data?.records ?? []);
|
|
|
|
baseData?.data?.records?.forEach((element) {
|
|
|
|
if ((double.tryParse(element.payedPrice ?? "")??0) > 0)
|
|
|
|
unRecords.add(element);
|
|
|
|
});
|
|
|
|
if ((baseData?.data?.records ?? []).isEmpty ||
|
|
|
|
records.length.toString() == baseData?.data?.total)
|
|
|
|
refreshController.loadNoData();
|
|
|
|
else
|
|
|
|
refreshController.loadComplete();
|
|
|
|
networkStatus = 1;
|
|
|
|
} else {
|
|
|
|
SmartDialog.showToast("${baseData?.msg}", alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_onRefresh({bool isShowLoad = true}) async {
|
|
|
|
if (isShowLoad)
|
|
|
|
EasyLoading.show(
|
|
|
|
status: S.current.zhengzaijiazai,
|
|
|
|
maskType: EasyLoadingMaskType.black);
|
|
|
|
await queryInvoiceList();
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
if (!mounted) return;
|
|
|
|
if (refreshController.isRefresh) refreshController.refreshCompleted();
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
appBar: MyAppBar(
|
|
|
|
title: "发票管理",
|
|
|
|
titleColor: Colors.black,
|
|
|
|
background: Colors.white,
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
),
|
|
|
|
body: networkStatus == -1
|
|
|
|
? noNetwork()
|
|
|
|
: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
color: Colors.white,
|
|
|
|
padding: EdgeInsets.only(top: 15.h, bottom: 10.h),
|
|
|
|
margin: EdgeInsets.only(bottom: 12.h),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/invoices_title_info',arguments:{
|
|
|
|
"enterType":1,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/invoice_title.webp",
|
|
|
|
width: 26.h,
|
|
|
|
height: 26.h,
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 7.6.h),
|
|
|
|
child: Text(
|
|
|
|
"抬头管理",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/invoices_history');
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
"assets/image/invoice_history.webp",
|
|
|
|
width: 26.h,
|
|
|
|
height: 26.h,
|
|
|
|
fit: BoxFit.fitWidth,
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 7.6.h),
|
|
|
|
child: Text(
|
|
|
|
"开票历史",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: 14.w, bottom: 6.h),
|
|
|
|
child: Text(
|
|
|
|
"可开票订单",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
child: SmartRefresher(
|
|
|
|
controller: refreshController,
|
|
|
|
enablePullDown: true,
|
|
|
|
enablePullUp:records.length == 0 ? false :true,
|
|
|
|
header: MyHeader(),
|
|
|
|
footer: CustomFooter(
|
|
|
|
builder: (context, mode) {
|
|
|
|
return MyFooter(mode);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
onRefresh: () {
|
|
|
|
_pageNum = 1;
|
|
|
|
records.clear();
|
|
|
|
unRecords.clear();
|
|
|
|
_onRefresh(isShowLoad: false);
|
|
|
|
},
|
|
|
|
onLoading: () {
|
|
|
|
_pageNum++;
|
|
|
|
_onRefresh(isShowLoad: false);
|
|
|
|
},
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
scrollController: ScrollController(),
|
|
|
|
child: Container(
|
|
|
|
child: networkStatus == 0
|
|
|
|
? ListView.builder(
|
|
|
|
itemCount: 10,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {},
|
|
|
|
child: invoicesOrderItemSm(),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
)
|
|
|
|
: ((records == null || records.length == 0)
|
|
|
|
? NoDataView(
|
|
|
|
src: "assets/image/ding_dan.webp",
|
|
|
|
isShowBtn: false,
|
|
|
|
text: "暂无可开票的订单",
|
|
|
|
fontSize: 16,
|
|
|
|
margin: EdgeInsets.only(top: 120,left: 20,right: 20),
|
|
|
|
)
|
|
|
|
: ListView.builder(
|
|
|
|
itemCount: records?.length ?? 0,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, position) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
records[position].isSelect =
|
|
|
|
!records[position].isSelect;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child:
|
|
|
|
invoicesOrderItem(records[position]),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
if (records != null && records.length > 0)
|
|
|
|
Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
top: 16.h, bottom: 45.h, left: 14.w, right: 17.w),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(bottom: 10.h),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(right: 6.w),
|
|
|
|
child: Text(
|
|
|
|
"已选${selectNum()}个订单合计:",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
"¥${selectPrice()}",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF32A060),
|
|
|
|
fontSize: 20.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Text(
|
|
|
|
"开票金额以实际发票为准",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF727272),
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
records.forEach((element) {
|
|
|
|
element.isSelect = !allCheckIndex;
|
|
|
|
});
|
|
|
|
allCheckIndex = !allCheckIndex;
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(right: 8.w),
|
|
|
|
child: Image.asset(
|
|
|
|
allCheckIndex
|
|
|
|
? "assets/image/icon_radio_selected.webp"
|
|
|
|
: "assets/image/icon_radio_unselected.webp",
|
|
|
|
width: 16.w,
|
|
|
|
height: 16.h,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
records.forEach((element) {
|
|
|
|
element.isSelect = !allCheckIndex;
|
|
|
|
});
|
|
|
|
allCheckIndex = !allCheckIndex;
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
"全选",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
List<dynamic> ids = [];
|
|
|
|
records.forEach((element) {
|
|
|
|
if (element.isSelect) ids.add(element.id);
|
|
|
|
});
|
|
|
|
if((double.tryParse(selectNum())??0) > 0)
|
|
|
|
Navigator.of(context)
|
|
|
|
.pushNamed('/router/edit_invoices_info',arguments:{
|
|
|
|
"selectPrice": selectPrice(),
|
|
|
|
"ids":ids ?? []
|
|
|
|
}).then((value) async{
|
|
|
|
if(value ==1){
|
|
|
|
_pageNum = 1;
|
|
|
|
records.clear();
|
|
|
|
unRecords.clear();
|
|
|
|
await _onRefresh();
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
SmartDialog.show(
|
|
|
|
widget: SettlementTips(
|
|
|
|
() {},
|
|
|
|
text: "已成功提交发票信息",
|
|
|
|
),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: ((double.tryParse(selectNum()) ?? 0) > 0)
|
|
|
|
? Color(0xFF32A060)
|
|
|
|
: Color(0xFFd6d6d6),
|
|
|
|
borderRadius: BorderRadius.circular(4),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: 23.w, vertical: 8.h),
|
|
|
|
child: Text(
|
|
|
|
"去开票",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///选中数量
|
|
|
|
String selectNum() {
|
|
|
|
return unRecords.where((element) => element.isSelect).length.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
///选中的总价格
|
|
|
|
String selectPrice() {
|
|
|
|
return unRecords
|
|
|
|
.where((element) => element.isSelect)
|
|
|
|
.fold(
|
|
|
|
0.0,
|
|
|
|
(previousValue, element) =>
|
|
|
|
((double.tryParse(previousValue.toString()) ?? 0.0) + (double.tryParse(element.payedPrice ?? "0") ?? 0.0)))
|
|
|
|
.toStringAsFixed(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
///可开票订单list
|
|
|
|
Widget invoicesOrderItem(Records records) {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(top: 12.h, bottom: 12.h, right: 20.w),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x0F06152E),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 4,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
((double.tryParse(records?.payedPrice ?? "0") ?? 0) > 0)
|
|
|
|
? GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
records.isSelect = !records.isSelect;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: 15.w, left: 12.w, top: 5.h, bottom: 5.h),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Image.asset(
|
|
|
|
(records?.isSelect ?? false)
|
|
|
|
? "assets/image/icon_radio_selected.webp"
|
|
|
|
: "assets/image/icon_radio_unselected.webp",
|
|
|
|
width: 15.w,
|
|
|
|
height: 15.h,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: 15.w, left: 12.w, top: 5.h, bottom: 5.h),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/image/disenable_seletor_tow.webp",
|
|
|
|
width: 15.w,
|
|
|
|
height: 15.h,
|
|
|
|
)),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
records?.storeName ?? "",
|
|
|
|
maxLines: 2,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(top: 8.h, bottom: 14.h),
|
|
|
|
child: Text(
|
|
|
|
"订单编号:${records?.id ?? ""}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Text(
|
|
|
|
"下单时间: ${records?.createTime ?? ""}",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 10.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: records?.finalPayPrice ?? "0.00",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "元",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF4D4D4D),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget invoicesOrderItemSm() {
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x0F06152E),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 4,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 13.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 16,
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 180,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 14.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 182,
|
|
|
|
height: 17,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 170,
|
|
|
|
height: 14,
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 13.w),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 49,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget noNetwork() {
|
|
|
|
return Container(
|
|
|
|
color: Colors.white,
|
|
|
|
width: double.infinity,
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
networkError.substring(0, networkError.indexOf(",")),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Color(0xFF0D0D0D),
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
|
|
child: Text(
|
|
|
|
"请检查网络设置或稍后重试",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
color: Color(0xFF7A797F),
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
GestureDetector(
|
|
|
|
behavior: HitTestBehavior.opaque,
|
|
|
|
onTap: () {
|
|
|
|
_onRefresh();
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
),
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 3),
|
|
|
|
child: Text(
|
|
|
|
"重试",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: Colors.white,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|