This commit is contained in:
quantulr
2024-06-18 17:18:35 +08:00
parent d2091a90dd
commit 1238802598

View File

@ -300,139 +300,18 @@ class _LogisticsState extends State<Logistics> {
itemBuilder:
(BuildContext context, int index) {
return PackageCard(
onLogisticsChanged: (value) {
_packages[index]
["logisticsNumber"] =
value;
},
onTap: () {
setState(() {
_activePackage = index;
});
},
isActive:
_activePackage == index,
package: _packages[index],
index: index)
/*GestureDetector(
onTap: () {
setState(() {
_activePackage = index;
});
},
child: Card(
elevation: _activePackage == index
? 5
: null,
shape: _activePackage == index
? RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(
12.0),
side: const BorderSide(
color: Colors.blue,
width: 1.0,
),
)
: null,
child: Stack(
// clipBehavior: Clip.none,
children: [
const SizedBox(
height: 100,
),
Padding(
padding:
const EdgeInsets.fromLTRB(
20, 30, 20, 20),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.stretch,
children: [
TextField(
decoration:
const InputDecoration(
border:
OutlineInputBorder(),
labelText:
"物流单号"),
),
const SizedBox(
height: 20,
),
DataTable(columns: const [
DataColumn(
label: Text("名称")),
DataColumn(
label: Text("规格")),
DataColumn(
label: Text("数量"))
], rows: [
for (var goodsItem
in _packages[index]
["goods"])
DataRow(cells: [
DataCell(Text(
"${goodsItem["name"]}")),
DataCell(Text(
"${goodsItem["spec"]}")),
DataCell(Text(
"${goodsItem["num"]}")),
])
]),
],
),
),
Positioned(
left: 20,
top: 2,
child: Text("包裹${index + 1}"),
),
_packages.length > 1
? Positioned(
top: 2,
right: 2,
child: SizedBox(
width: 20,
height: 20,
child: IconButton(
color: Colors
.redAccent,
iconSize: 20,
padding:
EdgeInsets.zero,
icon: const Icon(
Icons.close),
onPressed: () {
var curId =
_packages[
index]
["id"];
setState(() {
_activePackage =
_activePackage >=
index
? _activePackage -
1
: _activePackage;
_packages = _packages
.where((el) =>
el["id"] !=
curId)
.toList();
});
},
),
))
: const SizedBox(
width: 0,
)
],
),
),
)*/
;
onLogisticsChanged: (value) {
_packages[index]
["logisticsNumber"] = value;
},
onTap: () {
setState(() {
_activePackage = index;
});
},
isActive: _activePackage == index,
package: _packages[index],
index: index);
},
)),
ElevatedButton(
@ -451,17 +330,6 @@ class _LogisticsState extends State<Logistics> {
child: const Text("添加包裹"))
],
))
/*
GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
childAspectRatio: 1.0),
itemCount: goodsList.length,
itemBuilder: (context, index) {
return Icon(Icons.add);
}),
*/
],
)),
);
@ -506,11 +374,6 @@ class _PackageCardState extends State<PackageCard> {
Widget build(BuildContext context) {
return GestureDetector(
onTap: widget.onTap,
/* () {
setState(() {
_activePackage = index;
});
},*/
child: Card(
elevation: widget.isActive ? 5 : null,
shape: widget.isActive
@ -561,34 +424,6 @@ class _PackageCardState extends State<PackageCard> {
top: 2,
child: Text("包裹${widget.index + 1}"),
),
/* _packages.length > 1
? Positioned(
top: 2,
right: 2,
child: SizedBox(
width: 20,
height: 20,
child: IconButton(
color: Colors.redAccent,
iconSize: 20,
padding: EdgeInsets.zero,
icon: const Icon(Icons.close),
onPressed: () {
var curId = _packages[index]["id"];
setState(() {
_activePackage = _activePackage >= index
? _activePackage - 1
: _activePackage;
_packages = _packages
.where((el) => el["id"] != curId)
.toList();
});
},
),
))
: const SizedBox(
width: 0,
)*/
],
),
),