XuGongTeJi_flutter/lib/component/card/stock_in_card_xugong.dart
2025-02-24 15:52:03 +08:00

76 lines
2.6 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:wms_app/model/bo/stock_in_data_xugong.dart';
import 'package:wms_app/utils/dialogUtils.dart';
import 'package:wms_app/utils/stringUtils.dart';
class StockInCardXuGong extends StatefulWidget {
final List<StockInDataXuGong> stockInDataXuGong;
const StockInCardXuGong({super.key,required this.stockInDataXuGong });
@override
State<StockInCardXuGong> createState() => _StockInCardXuGongState();
}
class _StockInCardXuGongState extends State<StockInCardXuGong> {
@override
Widget build(BuildContext context) {
if(widget.stockInDataXuGong.isEmpty) {
return const Column();
}
return createListView();
}
/// 创建列表
Column createListView() {
List<Widget> children = [];
for (var item in widget.stockInDataXuGong) {
children.add(BrnRichInfoGrid(
themeData: BrnPairRichInfoGridConfig(
),
pairInfoList: [
BrnRichGridInfo('物料号:', item.goodsId),
BrnRichGridInfo.valueLastClickInfo(context, '物料数量', item.goodsNum.toString(),
clickTitle: "修改", clickCallback: (clickValue) {
DialogUtils.showInputMessage(context, "请输入要修改的数量", message: "仅支持数字", confirm: (value) {
if(!StringUtils.isNumber(value)) {
DialogUtils.showWarningMessage(context, "警告", "该文本框仅支持数字");
return;
}
setState((){
item.goodsNum = int.parse(value);
});
});
}
),
BrnRichGridInfo('单据号:', item.listId),
BrnRichGridInfo('单据类型:', item.orderType),
BrnRichGridInfo('客户名称:', item.customerName),
BrnRichGridInfo('物料描述:', item.goodsDesc),
BrnRichGridInfo('重量:', item.weight.toString()),
BrnRichGridInfo('尺寸:', item.size),
BrnRichGridInfo('备用1', item.spare1),
BrnRichGridInfo('备用2', item.spare2),
BrnRichGridInfo.valueLastClickInfo(context, '操作', '',
themeData: BrnPairRichInfoGridConfig(
linkTextStyle: BrnTextStyle(color: Colors.red),
),
clickTitle: "点此删除", clickCallback: (value) {
setState(() {
widget.stockInDataXuGong.remove(item);
BrnToast.show("删除一个数据", context);
});
}),
],
));
children.add(const Divider());
}
return Column(children: children);
}
}