소스 검색

1.优化明细无数据显示

tags/0.0.2+1
杨华轩 4 년 전
부모
커밋
fa382d724c
2개의 변경된 파일256개의 추가작업 그리고 689개의 파일을 삭제
  1. +256
    -83
      lib/widgets/wallet_bil_detail/wallet_bil_detail.dart
  2. +0
    -606
      lib/widgets/wallet_bil_detail/wallet_list_widget.dart

+ 256
- 83
lib/widgets/wallet_bil_detail/wallet_bil_detail.dart 파일 보기

@@ -6,6 +6,7 @@ import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'package:zhiying_base_widget/dialog/select_date_ym_dialog/select_date_ym_dialog.dart';
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_bloc.dart';
import 'package:zhiying_base_widget/widgets/wallet_bil_detail/wallet_bil_detail_widget_bloc.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
@@ -26,7 +27,8 @@ class WalletBilDetail extends StatefulWidget {
_WalletBilDetailState createState() => _WalletBilDetailState();
}

class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
class _WalletBilDetailState extends State<WalletBilDetail>
with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
WalletBilDetailWidgetBloc _bloc;

TabController _tabController;
@@ -35,7 +37,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
void initState() {
_bloc = WalletBilDetailWidgetBloc();
_bloc.initStyleData(json.decode(widget.data['data']));
_tabController = TabController(length: _bloc.styleData.tabList.length, vsync: this);
_tabController =
TabController(length: _bloc.styleData.tabList.length, vsync: this);
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate);
_bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate);

@@ -51,7 +54,8 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
AppBar(
brightness: Brightness.light,
backgroundColor: HexColor.fromHex(_bloc.styleData.appBarBgColor),
backgroundColor:
HexColor.fromHex(_bloc.styleData.appBarBgColor),
centerTitle: true,
leading: IconButton(
icon: Icon(
@@ -64,7 +68,10 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
}),
title: Text(
_bloc.styleData.appBarName ?? "",
style: TextStyle(color: HexColor.fromHex(_bloc.styleData.appBarNameColor), fontWeight: FontWeight.bold, fontSize: 18),
style: TextStyle(
color: HexColor.fromHex(_bloc.styleData.appBarNameColor),
fontWeight: FontWeight.bold,
fontSize: 18),
),
),
Container(
@@ -81,15 +88,22 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
controller: _tabController,
tabs: _buildTabBarItem(),
indicatorWeight: 9.5,
labelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
unselectedLabelStyle: TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
labelStyle:
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
unselectedLabelStyle:
TextStyle(fontSize: 15, fontWeight: FontWeight.bold),
labelColor: HexColor.fromHex(_bloc.styleData.tabSeletedColor),
unselectedLabelColor: HexColor.fromHex(_bloc.styleData.tabNoSeletedColor),
indicatorColor: HexColor.fromHex(_bloc.styleData.tabLineColor),
unselectedLabelColor:
HexColor.fromHex(_bloc.styleData.tabNoSeletedColor),
indicatorColor:
HexColor.fromHex(_bloc.styleData.tabLineColor),
indicatorSize: TabBarIndicatorSize.label,
),
),
Expanded(child: TabBarView(controller: _tabController, children: _buildTabViewPage()))
Expanded(
child: TabBarView(
controller: _tabController,
children: _buildTabViewPage()))
],
),
));
@@ -125,8 +139,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
},
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(tabList.type == "input" ? _bloc.inputShowDate : _bloc.outputShowDate,
style: TextStyle(fontSize: 28.sp, color: HexColor.fromHex(_bloc.styleData.timeSelectColor), fontWeight: FontWeight.bold))),
child: Text(
tabList.type == "input"
? _bloc.inputShowDate
: _bloc.outputShowDate,
style: TextStyle(
fontSize: 28.sp,
color: HexColor.fromHex(_bloc.styleData.timeSelectColor),
fontWeight: FontWeight.bold))),
),
Icon(
Icons.arrow_drop_down,
@@ -146,11 +166,15 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
if (tabList.type == 'input') {
_bloc.inputSelectType = tabViewBtns[index].type;
_bloc.inPutCurrentPage = 1;
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate, type: _bloc.inputSelectType);
_bloc.loadInputData(
_bloc.inPutCurrentPage, _bloc.inputShowDate,
type: _bloc.inputSelectType);
} else {
_bloc.outputSelectType = tabViewBtns[index].type;
_bloc.outPutCurrentPage = 1;
_bloc.loadOutputData(_bloc.outPutCurrentPage, _bloc.outputShowDate, type: _bloc.outputSelectType);
_bloc.loadOutputData(
_bloc.outPutCurrentPage, _bloc.outputShowDate,
type: _bloc.outputSelectType);
}
_bloc.refresh();
},
@@ -158,16 +182,24 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(right: 12.5),
padding: EdgeInsets.only(left: 16, right: 16, top: 2.5, bottom: 2.5),
padding: EdgeInsets.only(
left: 16, right: 16, top: 2.5, bottom: 2.5),
decoration: BoxDecoration(
border: Border.all(
color: HexColor.fromHex(selectType == tabViewBtns[index].type ? _bloc.styleData.btnSelectedColor : _bloc.styleData.btnNoSelectedColor),
color: HexColor.fromHex(
selectType == tabViewBtns[index].type
? _bloc.styleData.btnSelectedColor
: _bloc.styleData.btnNoSelectedColor),
),
borderRadius: BorderRadius.circular(50)),
child: Text(
tabViewBtns[index].name ?? "",
style: TextStyle(
fontSize: 11, color: HexColor.fromHex(selectType == tabViewBtns[index].type ? _bloc.styleData.btnSelectedColor : _bloc.styleData.btnNoSelectedColor)),
fontSize: 11,
color: HexColor.fromHex(
selectType == tabViewBtns[index].type
? _bloc.styleData.btnSelectedColor
: _bloc.styleData.btnNoSelectedColor)),
),
),
);
@@ -178,9 +210,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
}

_selectDate(TabList tabList) async {
var result = await showDialog(context: context, builder: (context) => SelectDateYMDialog());
var result = await showDialog(
context: context, builder: (context) => SelectDateYMDialog());
if (result != null) {
var dataTime = DateFormat('yyyy-MM').format(DateTime(int.parse(result['year']), int.parse(result['month'])));
var dataTime = DateFormat('yyyy-MM').format(
DateTime(int.parse(result['year']), int.parse(result['month'])));
if (tabList.type == "input") {
_bloc.inputShowDate = dataTime;
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate);
@@ -195,7 +229,9 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
_buildBottomItem(TabList tabList) {
return ListView.builder(
shrinkWrap: true,
itemCount: tabList.type == 'input' ? _bloc.inputDataVM.length : _bloc.outputDataVM.length,
itemCount: tabList.type == 'input'
? _bloc.inputDataVM.length
: _bloc.outputDataVM.length,
itemBuilder: (context, index) {
return _buildItem(context, index, tabList);
});
@@ -207,8 +243,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
var modelItem = _bloc.inputDataVM[index];
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4),
padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)),
padding:
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: HexColor.fromHex("#FFFFFF"),
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
Row(
@@ -218,13 +257,21 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4), color: HexColor.fromHex("#FFFFF3F3"), border: Border.all(color: HexColor.fromHex(inputItemStyle.typeNameColor))),
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex("#FFFFF3F3"),
border: Border.all(
color: HexColor.fromHex(
inputItemStyle.typeNameColor))),
child: Padding(
padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2),
padding: const EdgeInsets.only(
left: 4, right: 4, top: 2, bottom: 2),
child: Center(
child: Text(
modelItem['type'] ?? "",
style: TextStyle(color: HexColor.fromHex(inputItemStyle.typeNameColor), fontSize: 20.sp),
style: TextStyle(
color: HexColor.fromHex(
inputItemStyle.typeNameColor),
fontSize: 20.sp),
),
),
),
@@ -244,11 +291,16 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
"+ ",
style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor)),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.amountColor)),
),
Text(
"¥ " + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(inputItemStyle.amountColor), fontSize: 30.sp, fontFamily: 'Din', package: 'zhiying_base_widget'),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.amountColor),
fontSize: 30.sp,
fontFamily: 'Din',
package: 'zhiying_base_widget'),
)
],
)
@@ -263,33 +315,44 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
inputItemStyle.orderIdText,
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_id'],
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 28.w,
),
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: modelItem['order_id']));
Clipboard.setData(
ClipboardData(text: modelItem['order_id']));
Fluttertoast.showToast(msg: "已复制");
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex(inputItemStyle.copyBtnBgColor),
border: Border.all(color: HexColor.fromHex(inputItemStyle.contentColor))),
border: Border.all(
color:
HexColor.fromHex(inputItemStyle.contentColor))),
child: Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1),
padding: EdgeInsets.only(
left: 16, right: 16, top: 1, bottom: 1),
child: Text(
inputItemStyle.copyBtnText,
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
),
),
@@ -306,14 +369,18 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
inputItemStyle.orderTypeText,
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_type'] ?? "",
style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
@@ -322,7 +389,9 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
inputItemStyle.amountText + " ¥" + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
@@ -338,14 +407,18 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
inputItemStyle.timeText,
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['time'] ?? "",
style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
@@ -353,8 +426,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
child: Row(
children: <Widget>[
Text(
inputItemStyle.settleTimeText + " " + modelItem['settle_time'] ?? "",
style: TextStyle(color: HexColor.fromHex(inputItemStyle.contentColor), fontSize: 22.sp),
inputItemStyle.settleTimeText +
" " +
modelItem['settle_time'] ??
"",
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
@@ -370,8 +448,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
///消费返回的Item
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4),
padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)),
padding:
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: HexColor.fromHex("#FFFFFF"),
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
Row(
@@ -383,13 +464,19 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex("#FFFFF3F3"),
border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))),
border: Border.all(
color: HexColor.fromHex(
outputItemStyle.typeNameColor))),
child: Padding(
padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2),
padding: const EdgeInsets.only(
left: 4, right: 4, top: 2, bottom: 2),
child: Center(
child: Text(
modelItem['type'] ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp),
style: TextStyle(
color: HexColor.fromHex(
outputItemStyle.typeNameColor),
fontSize: 20.sp),
),
),
),
@@ -409,11 +496,16 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
"- ",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.amountColor)),
),
Text(
"¥ " + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.amountColor),
fontSize: 30.sp),
)
],
)
@@ -428,33 +520,45 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.orderIdText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_id'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 28.w,
),
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: modelItem['order_id']));
Clipboard.setData(
ClipboardData(text: modelItem['order_id']));
Fluttertoast.showToast(msg: "已复制");
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex(outputItemStyle.copyBtnBgColor),
border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))),
color:
HexColor.fromHex(outputItemStyle.copyBtnBgColor),
border: Border.all(
color: HexColor.fromHex(
outputItemStyle.contentColor))),
child: Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1),
padding: EdgeInsets.only(
left: 16, right: 16, top: 1, bottom: 1),
child: Text(
outputItemStyle.copyBtnText ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(
outputItemStyle.contentColor),
fontSize: 22.sp),
),
),
),
@@ -471,14 +575,19 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.consumeOrderTypeText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_type'] ?? "",
style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
@@ -486,8 +595,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
child: Row(
children: <Widget>[
Text(
outputItemStyle.consumeAmountText + " ¥" + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
outputItemStyle.consumeAmountText +
" ¥" +
modelItem['amount'],
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
@@ -503,14 +617,19 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.consumeTimeText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['time'] ?? "",
style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
@@ -536,8 +655,11 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
} else if (modelItem['type'] == '提现') {
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4),
padding: EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(color: HexColor.fromHex("#FFFFFF"), borderRadius: BorderRadius.circular(8)),
padding:
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: HexColor.fromHex("#FFFFFF"),
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
Row(
@@ -549,13 +671,19 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex("#FFFFF3F3"),
border: Border.all(color: HexColor.fromHex(outputItemStyle.typeNameColor))),
border: Border.all(
color: HexColor.fromHex(
outputItemStyle.typeNameColor))),
child: Padding(
padding: const EdgeInsets.only(left: 4, right: 4, top: 2, bottom: 2),
padding: const EdgeInsets.only(
left: 4, right: 4, top: 2, bottom: 2),
child: Center(
child: Text(
modelItem['type'] ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.typeNameColor), fontSize: 20.sp),
style: TextStyle(
color: HexColor.fromHex(
outputItemStyle.typeNameColor),
fontSize: 20.sp),
),
),
),
@@ -575,11 +703,16 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
"- ",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor)),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.amountColor)),
),
Text(
"¥ " + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.amountColor), fontSize: 30.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.amountColor),
fontSize: 30.sp),
)
],
)
@@ -594,33 +727,45 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.orderIdText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_id'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 28.w,
),
GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(text: modelItem['order_id']));
Clipboard.setData(
ClipboardData(text: modelItem['order_id']));
Fluttertoast.showToast(msg: "已复制");
},
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex(outputItemStyle.copyBtnBgColor),
border: Border.all(color: HexColor.fromHex(outputItemStyle.contentColor))),
color:
HexColor.fromHex(outputItemStyle.copyBtnBgColor),
border: Border.all(
color: HexColor.fromHex(
outputItemStyle.contentColor))),
child: Padding(
padding: EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1),
padding: EdgeInsets.only(
left: 16, right: 16, top: 1, bottom: 1),
child: Text(
outputItemStyle.copyBtnText ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex(
outputItemStyle.contentColor),
fontSize: 22.sp),
),
),
),
@@ -637,14 +782,20 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.withdrawAccountText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['account'] ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
],
)),
@@ -652,8 +803,13 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
child: Row(
children: <Widget>[
Text(
outputItemStyle.withdrawAmountText + " ¥" + modelItem['amount'],
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
outputItemStyle.withdrawAmountText +
" ¥" +
modelItem['amount'],
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
@@ -669,14 +825,19 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
children: <Widget>[
Text(
outputItemStyle.withdrawTimeText,
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['time'] ?? "",
style: TextStyle(color: HexColor.fromHex("#FF999999"), fontSize: 22.sp),
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
@@ -684,8 +845,14 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
child: Row(
children: <Widget>[
Text(
outputItemStyle.withdrawOrderStatusText + " " + modelItem['order_status'] ?? "",
style: TextStyle(color: HexColor.fromHex(outputItemStyle.contentColor), fontSize: 22.sp),
outputItemStyle.withdrawOrderStatusText +
" " +
modelItem['order_status'] ??
"",
style: TextStyle(
color:
HexColor.fromHex(outputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
@@ -724,7 +891,10 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
onRefresh: () {
_bloc.inputRefresh();
},
child: _bloc.inputDataVM == null ? Container() : _buildBottomItem(item)),
child: _bloc.inputDataVM == null ||
_bloc.inputDataVM.length == 0
? EmptyWidget()
: _buildBottomItem(item)),
)
],
),
@@ -752,7 +922,10 @@ class _WalletBilDetailState extends State<WalletBilDetail> with TickerProviderSt
onRefresh: () {
_bloc.outputRefresh();
},
child: _bloc.outputDataVM == null ? Container() : _buildBottomItem(item)),
child: _bloc.outputDataVM == null ||
_bloc.outputDataVM.length == 0
? EmptyWidget()
: _buildBottomItem(item)),
)
],
),


+ 0
- 606
lib/widgets/wallet_bil_detail/wallet_list_widget.dart 파일 보기

@@ -1,606 +0,0 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/dialog/select_date_ym_dialog/select_date_ym_dialog.dart';
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/wallet_detail_bloc.dart';
import 'package:zhiying_base_widget/widgets/wallet_bil_detail/wallet_bil_detail_widget_bloc.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

import 'model/wallet_style_model.dart';

class WalletListWidget extends StatefulWidget {
final TabList tabList;
final List<InputTabViewBtns> tabViewBtns;
const WalletListWidget({Key key,this.tabViewBtns, this.tabList}) : super(key: key);
@override
_WalletListWidgetState createState() => _WalletListWidgetState();
}

class _WalletListWidgetState extends State<WalletListWidget> with AutomaticKeepAliveClientMixin {
WalletBilDetailWidgetBloc _bloc;
List<InputTabViewBtns> tabViewBtns;
TabList item;

@override
void initState() {
item=widget.tabList;
tabViewBtns=widget.tabViewBtns;
super.initState();
}

@override
Widget build(BuildContext context) {
_bloc = BlocProvider.of(context);
if(item.type=='input'){
return StreamBuilder(
stream: _bloc.inputOutData,
builder: (context, asny) {
// dataVM = asny.data;

return Container(
child: Column(
children: <Widget>[
_buildType(tabViewBtns, item),
Expanded(
child: SmartRefresher(
controller: _bloc.inputRefreshController,
enablePullDown: true,
enablePullUp: true,
onLoading: _bloc.outputLoad(),
onRefresh: _bloc.outputRefresh(),
child: _bloc.inputDataVM == null
? Container()
: _buildBottomItem(item)),
)
],
),
);
});
}else{
return StreamBuilder(
stream: _bloc.outputOutData,
builder: (context, asny) {
// dataVM = asny.data;

return Container(
child: Column(
children: <Widget>[
_buildType(tabViewBtns, item),
Expanded(
child: SmartRefresher(
controller: _bloc.outputRefreshController,
enablePullDown: true,
enablePullUp: true,
onLoading: _bloc.outputLoad(),
onRefresh: _bloc.outputRefresh(),
child: _bloc.outputDataVM == null
? Container()
: _buildBottomItem(item)),
)
],
),
);
});
}


}



_buildType(List<InputTabViewBtns> tabViewBtns, TabList tabList) {
var selectType;
if (tabList.type == 'input') {
selectType = _bloc.inputSelectType;
} else {
selectType = _bloc.outputSelectType;
;
}
return Row(
children: <Widget>[
SizedBox(width: 12.5),
InkWell(
onTap: () {
///显示日期选择弹窗
_selectDate(tabList);
},
child: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 8),
child: Text(
tabList.type == "input"
? _bloc.inputShowDate
: _bloc.outputShowDate,
style: TextStyle(
fontSize: 28.sp,
color:
HexColor.fromHex(_bloc.styleData.timeSelectColor)))),
),
Icon(
Icons.arrow_drop_down,
color: HexColor.fromHex(_bloc.styleData.timeSelectColor),
),
Expanded(
child: Container(
height: 50,
child: ListView.builder(
scrollDirection: Axis.horizontal,
shrinkWrap: true,
itemCount: tabViewBtns.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () async {
if (tabList.type == 'input') {
_bloc.inputSelectType = tabViewBtns[index].type;
_bloc.loadInputData(
_bloc.inPutCurrentPage, _bloc.inputShowDate,
type: _bloc.inputSelectType);
} else {
_bloc.outputSelectType = tabViewBtns[index].type;
_bloc.loadOutputData(
_bloc.outPutCurrentPage, _bloc.outputShowDate,
type: _bloc.outputSelectType);
}
_bloc.refresh();
},
child: Container(
margin: EdgeInsets.only(
top: 10, left: 8, right: 8, bottom: 10),
decoration: BoxDecoration(
border: Border.all(
color: HexColor.fromHex(
selectType == tabViewBtns[index].type
? _bloc.styleData.btnSelectedColor
: _bloc.styleData.btnNoSelectedColor),
),
borderRadius: BorderRadius.circular(50)),
child: Padding(
padding: EdgeInsets.only(left: 16, right: 16),
child: Center(
child: Text(
tabViewBtns[index].name ?? "",
style: TextStyle(
color: HexColor.fromHex(
selectType == tabViewBtns[index].type
? _bloc.styleData.btnSelectedColor
: _bloc.styleData.btnNoSelectedColor)),
)),
),
));
}),
))
],
);
}

_selectDate(TabList tabList) async {
var result = await showDialog(
context: context, builder: (context) => SelectDateYMDialog());
if (result != null) {
var dataTime = DateFormat('yyyy-MM').format(
DateTime(int.parse(result['year']), int.parse(result['month'])));
if (tabList.type == "input") {
_bloc.inputShowDate = dataTime;
_bloc.loadInputData(_bloc.inPutCurrentPage, _bloc.inputShowDate);
} else {
_bloc.outputShowDate = dataTime;
_bloc.loadInputData(_bloc.outPutCurrentPage, _bloc.outputShowDate);
}
_bloc.refresh();
}
}




_buildBottomItem(TabList tabList) {
return ListView.builder(
shrinkWrap: true,
itemCount: tabList.type == 'input'
? _bloc.inputDataVM?.length??0
: _bloc.outputDataVM?.length??0,
itemBuilder: (context, index) {
return _buildItem(context, index, tabList);
});
}

Widget _buildItem(BuildContext context, int index, TabList tabList) {
if (tabList.type == 'input') {
InputItemStyle inputItemStyle = _bloc.styleData.inputItemStyle;
var modelItem = _bloc.inputDataVM[index];
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4),
padding:
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: HexColor.fromHex("#FFFFFF"),
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex("#FFFFF3F3"),
border: Border.all(
color: HexColor.fromHex(
inputItemStyle.typeNameColor))),
child: Padding(
padding: const EdgeInsets.only(
left: 4, right: 4, top: 2, bottom: 2),
child: Center(
child: Text(
modelItem['type'] ?? "",
style: TextStyle(
color: HexColor.fromHex(
inputItemStyle.typeNameColor),
fontSize: 20.sp),
),
),
),
),
Container(
width: 353.w,
margin: EdgeInsets.only(left: 15.w),
child: Text(
modelItem['title'] ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 28.sp),
))
],
),
Row(
children: <Widget>[
Text(
"+ ",
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.amountColor)),
),
Text(
"¥ " + modelItem['amount'],
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.amountColor),
fontSize: 30.sp),
)
],
)
],
),
SizedBox(
height: 4,
),

///订单编号
Row(
children: <Widget>[
Text(
inputItemStyle.orderIdText,
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_id'],
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 28.w,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex(inputItemStyle.copyBtnBgColor),
border: Border.all(
color:
HexColor.fromHex(inputItemStyle.contentColor))),
child: Padding(
padding:
EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1),
child: Text(
inputItemStyle.copyBtnText,
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
),
)
],
),
SizedBox(
height: 4,
),
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.orderTypeText,
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_type'] ?? "",
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.amountText + " ¥" + modelItem['amount'],
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
],
),
SizedBox(
height: 4,
),
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.timeText,
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['time'] ?? "",
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.settleTimeText +
" " +
modelItem['settle_time'] ??
"",
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
],
),
],
),
);
} else if (tabList.type == 'output') {
OutputItemStyle inputItemStyle = _bloc.styleData.outputItemStyle;
var modelItem = _bloc.outputDataVM[index];
if (modelItem['type'] == '消费') {
///消费返回的Item
return Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4),
padding:
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h),
decoration: BoxDecoration(
color: HexColor.fromHex("#FFFFFF"),
borderRadius: BorderRadius.circular(8)),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex("#FFFFF3F3"),
border: Border.all(
color: HexColor.fromHex(
inputItemStyle.typeNameColor))),
child: Padding(
padding: const EdgeInsets.only(
left: 4, right: 4, top: 2, bottom: 2),
child: Center(
child: Text(
modelItem['type'] ?? "",
style: TextStyle(
color: HexColor.fromHex(
inputItemStyle.typeNameColor),
fontSize: 20.sp),
),
),
),
),
Container(
width: 353.w,
margin: EdgeInsets.only(left: 15.w),
child: Text(
modelItem['title'] ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 28.sp),
))
],
),
Row(
children: <Widget>[
Text(
"- ",
style: TextStyle(color: Colors.red),
),
Text(
"¥ " + modelItem['amount'],
style: TextStyle(color: Colors.red, fontSize: 30.sp),
)
],
)
],
),
SizedBox(
height: 4,
),

///订单编号
Row(
children: <Widget>[
Text(
inputItemStyle.orderIdText,
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_id'],
style: TextStyle(
color: HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 28.w,
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: HexColor.fromHex(inputItemStyle.copyBtnBgColor),
border: Border.all(
color:
HexColor.fromHex(inputItemStyle.contentColor))),
child: Padding(
padding: EdgeInsets.only(
left: 16, right: 16, top: 1, bottom: 1),
child: Text(
inputItemStyle.copyBtnText ?? "",
style: TextStyle(
color:
HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
),
)
],
),
SizedBox(
height: 4,
),
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.consumeOrderTypeText,
style: TextStyle(
color:
HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['order_type'] ?? "",
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.consumeAmountText +
" ¥" +
modelItem['amount'],
style: TextStyle(
color:
HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
],
))
],
),
SizedBox(
height: 4,
),
Row(
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Text(
inputItemStyle.consumeTimeText,
style: TextStyle(
color:
HexColor.fromHex(inputItemStyle.contentColor),
fontSize: 22.sp),
),
SizedBox(
width: 4,
),
Text(
modelItem['time'] ?? "",
style: TextStyle(
color: HexColor.fromHex("#FF999999"),
fontSize: 22.sp),
),
],
)),
// Expanded(
// child: Row(
// children: <Widget>[
// Text(
// inputItemStyle.consumeTimeText +
// " " +
// modelItem['settle_time'] ??
// "",
// style: TextStyle(
// color: HexColor.fromHex(inputItemStyle.contentColor),
// fontSize: 22.sp),
// ),
// ],
// ))
],
),
],
),
);
} else {}
}
}

@override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true;
}

불러오는 중...
취소
저장