|
|
|
import 'package:dio/dio.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.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:shared_preferences/shared_preferences.dart';
|
|
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
|
|
|
|
import '../../data/base_data.dart';
|
|
|
|
import '../../data/title_info_list.dart';
|
|
|
|
import '../../generated/l10n.dart';
|
|
|
|
import '../../retrofit/retrofit_api.dart';
|
|
|
|
import '../../utils/flutter_utils.dart';
|
|
|
|
import '../../utils/font_weight.dart';
|
|
|
|
import '../../view_widget/border_text.dart';
|
|
|
|
import '../../view_widget/my_appbar.dart';
|
|
|
|
|
|
|
|
class AddInvoicesTitle extends StatefulWidget {
|
|
|
|
final Map<String, dynamic>? arguments;
|
|
|
|
|
|
|
|
AddInvoicesTitle({this.arguments});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() {
|
|
|
|
return _AddInvoicesTitle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AddInvoicesTitle extends State<AddInvoicesTitle> {
|
|
|
|
bool isKeyBoardShow = false;
|
|
|
|
FocusNode _focusNode = FocusNode();
|
|
|
|
final TextEditingController editNameController = TextEditingController();
|
|
|
|
final TextEditingController editDutyCodeController = TextEditingController();
|
|
|
|
final TextEditingController editAddressController = TextEditingController();
|
|
|
|
final TextEditingController editPhoneController = TextEditingController();
|
|
|
|
final TextEditingController editBankController = TextEditingController();
|
|
|
|
final TextEditingController editAccountController = TextEditingController();
|
|
|
|
int? titleType;
|
|
|
|
ApiService? apiService;
|
|
|
|
String? userId;
|
|
|
|
String? titleName;
|
|
|
|
Records? records;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
titleName = widget.arguments?["titleName"] ?? "";
|
|
|
|
records = widget.arguments?["records"];
|
|
|
|
titleType = ((widget.arguments?["titleType"] == 1) ? 1 : 0) ?? 0;
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
setState(() {
|
|
|
|
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
|
|
|
|
if (MediaQuery.of(context).viewInsets.bottom == 0) {
|
|
|
|
if (isKeyBoardShow) {
|
|
|
|
isKeyBoardShow = false;
|
|
|
|
//关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
isKeyBoardShow = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///离开页面记着销毁和清除
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
_focusNode.unfocus();
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
///添加抬头信息
|
|
|
|
addInvoiceHeaders() async {
|
|
|
|
try {
|
|
|
|
EasyLoading.show(
|
|
|
|
status: S.current.zhengzaijiazai,
|
|
|
|
maskType: EasyLoadingMaskType.black);
|
|
|
|
if (apiService == null) {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
userId = value.getString('userId');
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
BaseData? baseData = await apiService?.invoiceHeader({
|
|
|
|
"bank": editBankController.text == "" ? (records?.bank??"") : editBankController.text, //开户银行
|
|
|
|
"bankNumber": editAccountController.text == "" ? (records?.bankNumber??"") : editAccountController.text, //开户账号
|
|
|
|
"companyAddr":editAddressController.text == "" ? (records?.companyAddr??"") : editAddressController.text, //单位地址
|
|
|
|
"companyPhone":editPhoneController.text == "" ? (records?.companyPhone??"") : editPhoneController.text, //单位电话
|
|
|
|
"id": "", //修改信息时传修改id
|
|
|
|
"isDefault": 1, //是否默认
|
|
|
|
"isDelete": 0, //逻辑删除
|
|
|
|
"name": editNameController.text == "" ? (records?.name??"") : editNameController.text, //名称
|
|
|
|
"taxId": editDutyCodeController.text == "" ? (records?.taxId??"") : editDutyCodeController.text, //税号
|
|
|
|
"type": titleType == 0 ? "PERSONAL" : "COMPANY", //抬头类型
|
|
|
|
"userId": userId, //所属用户ID
|
|
|
|
}).catchError((error) {
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
|
|
|
|
alignment: Alignment.center);
|
|
|
|
});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
SmartDialog.showToast("添加抬头信息成功", alignment: Alignment.center);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
SmartDialog.showToast("${baseData?.msg}", alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///编辑抬头信息
|
|
|
|
editInvoiceHeaders() async {
|
|
|
|
try {
|
|
|
|
EasyLoading.show(
|
|
|
|
status: S.current.zhengzaijiazai,
|
|
|
|
maskType: EasyLoadingMaskType.black);
|
|
|
|
if (apiService == null) {
|
|
|
|
SharedPreferences value = await SharedPreferences.getInstance();
|
|
|
|
userId = value.getString('userId');
|
|
|
|
apiService = ApiService(
|
|
|
|
Dio(),
|
|
|
|
context: context,
|
|
|
|
token: value.getString("token"),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
BaseData? baseData = await apiService?.invoiceHeaders({
|
|
|
|
"bank": editBankController.text == "" ? (records?.bank??"") : editBankController.text, //开户银行
|
|
|
|
"bankNumber": editAccountController.text == "" ? (records?.bankNumber??"") : editAccountController.text, //开户账号
|
|
|
|
"companyAddr":editAddressController.text == "" ? (records?.companyAddr??"") : editAddressController.text, //单位地址
|
|
|
|
"companyPhone":editPhoneController.text == "" ? (records?.companyPhone??"") : editPhoneController.text, //单位电话
|
|
|
|
"id": records?.id ?? "", //修改信息时传修改id
|
|
|
|
"isDefault": 1, //是否默认
|
|
|
|
"isDelete": 0, //逻辑删除
|
|
|
|
"name": editNameController.text == "" ? (records?.name??"") : editNameController.text, //名称
|
|
|
|
"taxId": editDutyCodeController.text == "" ? (records?.taxId??"") : editDutyCodeController.text, //税号
|
|
|
|
"type": titleType == 0 ? "PERSONAL" : "COMPANY", //抬头类型
|
|
|
|
"userId": userId, //所属用户ID
|
|
|
|
}).catchError((error) {
|
|
|
|
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
|
|
|
|
alignment: Alignment.center);});
|
|
|
|
if (baseData?.isSuccess ?? false) {
|
|
|
|
Navigator.of(context).pop(1);
|
|
|
|
Future.delayed(Duration(milliseconds: 500), () {
|
|
|
|
SmartDialog.showToast("编辑抬头信息成功", alignment: Alignment.center);
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
EasyLoading.dismiss();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return GestureDetector(
|
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
},
|
|
|
|
child: Scaffold(
|
|
|
|
resizeToAvoidBottomInset: false,
|
|
|
|
appBar: MyAppBar(
|
|
|
|
title: titleName??"",
|
|
|
|
titleColor: Colors.black,
|
|
|
|
background: Colors.white,
|
|
|
|
leadingColor: Colors.black,
|
|
|
|
),
|
|
|
|
body: Container(
|
|
|
|
color: Colors.white,
|
|
|
|
margin: EdgeInsets.only(top: 12.h),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 17.w),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 16.h),
|
|
|
|
child: Text(
|
|
|
|
"请填写抬头信息",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF000000),
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(right: 13.w),
|
|
|
|
child: Text(
|
|
|
|
"抬头类型",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(right: 8.w),
|
|
|
|
child: InkWell(
|
|
|
|
child: BorderText(
|
|
|
|
text: "个人",
|
|
|
|
textColor: titleType == 0
|
|
|
|
? Color(0xff32A060)
|
|
|
|
: Color(0xff181818),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
borderColor: titleType == 0
|
|
|
|
? Color(0xff32A060)
|
|
|
|
: Color(0xffE6E6E6),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 6.h, horizontal: 13.w),
|
|
|
|
borderWidth: 1,
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
titleType = 0;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
InkWell(
|
|
|
|
child: BorderText(
|
|
|
|
text: "单位",
|
|
|
|
textColor: titleType == 1
|
|
|
|
? Color(0xff32A060)
|
|
|
|
: Color(0xff181818),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular,
|
|
|
|
borderColor: titleType == 1
|
|
|
|
? Color(0xff32A060)
|
|
|
|
: Color(0xffE6E6E6),
|
|
|
|
radius: 2,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
vertical: 6.h, horizontal: 13.w),
|
|
|
|
borderWidth: 1,
|
|
|
|
),
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
titleType = 1;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "*",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFBC161C),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "名称 ",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editNameController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.name ?? (titleType == 0
|
|
|
|
? "建议填写个人姓名(必填)"
|
|
|
|
: "单位名称(必填)"),
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.name??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding: EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color:Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
if (titleType == 1)
|
|
|
|
Column(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: "*",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFFBC161C),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: "税号 ",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editDutyCodeController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.taxId ?? "纳税人识别号(必填)",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.taxId??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"单位地址",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editAddressController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.companyAddr ?? "请输入单位地址",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.companyAddr??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"单位电话",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editPhoneController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.companyPhone ?? "请输入单位电话",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.companyPhone??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"开户银行",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editBankController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.bank ?? "请输入开户银行",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.bank??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
"开户账号",
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color(0xFF353535),
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: TextField(
|
|
|
|
controller: editAccountController,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: records?.bankNumber ?? "请输入开户账号",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: ((records?.bankNumber??"") == "") ? Color(0xFFACACAC) : Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
border: InputBorder.none,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets.only(left: 16.w),
|
|
|
|
),
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.black,
|
|
|
|
fontSize: 14.sp,
|
|
|
|
fontWeight: MyFontWeight.regular),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
if (editNameController.text == "" && ((records?.name ??"") == "")) {
|
|
|
|
SmartDialog.showToast("请输入名称",
|
|
|
|
alignment: Alignment.center);
|
|
|
|
return;
|
|
|
|
} else if (titleType == 1 &&
|
|
|
|
editDutyCodeController.text == ""&& ((records?.taxId ??"") == "")) {
|
|
|
|
SmartDialog.showToast("请输入税号",
|
|
|
|
alignment: Alignment.center);
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if(titleName == "编辑抬头"){
|
|
|
|
editInvoiceHeaders();
|
|
|
|
}else{
|
|
|
|
addInvoiceHeaders();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(bottom:25.h,left:20.w,right: 20.w),
|
|
|
|
padding: EdgeInsets.symmetric(vertical:16.h),
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0xff32A060),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
45
|
|
|
|
),
|
|
|
|
),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
S.of(context).baocun,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.white,
|
|
|
|
fontSize: 16.sp,
|
|
|
|
fontWeight: MyFontWeight.medium,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget addInvoiceTitleSm() {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
|
|
|
|
margin: EdgeInsets.only(top: 12.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Colors.white,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
color: Color(0x0F06152E),
|
|
|
|
offset: Offset(0, 2),
|
|
|
|
blurRadius: 4,
|
|
|
|
spreadRadius: 0,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(bottom: 16),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 162,
|
|
|
|
height: 22,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 12),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 59,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 54,
|
|
|
|
height: 28,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 54,
|
|
|
|
height: 28,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 61,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 134,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 61,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 134,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 61,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 134,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 61,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 134,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 61,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(right: 8.h),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: 134,
|
|
|
|
height: 20,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 1.h,
|
|
|
|
color: Color(0xffF4F4F4),
|
|
|
|
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
))),
|
|
|
|
Shimmer.fromColors(
|
|
|
|
baseColor: Color(0XFFD8D8D8),
|
|
|
|
highlightColor: Color(0XFFD8D8D8),
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: Color(0XFFD8D8D8),
|
|
|
|
borderRadius: BorderRadius.circular(2),
|
|
|
|
),
|
|
|
|
width: double.infinity,
|
|
|
|
height: 54,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|