From 123880259864935978413ff8921350c8cc49aac3 Mon Sep 17 00:00:00 2001 From: quantulr <35954003+quantulr@users.noreply.github.com> Date: Tue, 18 Jun 2024 17:18:35 +0800 Subject: [PATCH] fix --- lib/logistics.dart | 189 +++------------------------------------------ 1 file changed, 12 insertions(+), 177 deletions(-) diff --git a/lib/logistics.dart b/lib/logistics.dart index f25a8de..1e05572 100644 --- a/lib/logistics.dart +++ b/lib/logistics.dart @@ -300,139 +300,18 @@ class _LogisticsState extends State { 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 { 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 { 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 { 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, - )*/ ], ), ),