add scroll bar
Before Width: | Height: | Size: 544 B After Width: | Height: | Size: 492 B |
Before Width: | Height: | Size: 442 B After Width: | Height: | Size: 429 B |
Before Width: | Height: | Size: 721 B After Width: | Height: | Size: 517 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 647 B |
BIN
assets/launcher_icon/icon.png
Normal file
After Width: | Height: | Size: 419 B |
8
flutter_launcher_icons.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
ios: true
|
||||
image_path: "assets/launcher_icon/icon.png"
|
||||
windows:
|
||||
generate: true
|
||||
image_path: "assets/launcher_icon/icon.png"
|
||||
icon_size: 48
|
@ -427,7 +427,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
@ -484,7 +484,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 319 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 450 B After Width: | Height: | Size: 456 B |
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 379 B |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 500 B |
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 586 B After Width: | Height: | Size: 497 B |
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 571 B |
After Width: | Height: | Size: 431 B |
After Width: | Height: | Size: 528 B |
After Width: | Height: | Size: 449 B |
After Width: | Height: | Size: 553 B |
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 661 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 622 B |
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 485 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 637 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 651 B |
@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:async/async.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@ -18,7 +19,10 @@ class Logistics extends StatefulWidget {
|
||||
class _LogisticsState extends State<Logistics> {
|
||||
List<dynamic> goodsList = [];
|
||||
String _orderPayWay = "";
|
||||
|
||||
// String _logistics = "";
|
||||
List _packages = [];
|
||||
bool _packageInit = false;
|
||||
int _activePackage = 0;
|
||||
final TextEditingController _goodsNameController =
|
||||
TextEditingController(text: "");
|
||||
@ -43,6 +47,8 @@ class _LogisticsState extends State<Logistics> {
|
||||
GoRouterState.of(context).uri.queryParameters["orderNumber"];
|
||||
String? orderPayWay =
|
||||
GoRouterState.of(context).uri.queryParameters["orderPayWay"];
|
||||
String? logistics =
|
||||
GoRouterState.of(context).uri.queryParameters["logistics"];
|
||||
_orderPayWay = orderPayWay!;
|
||||
|
||||
if (orderNumber?.isEmpty ?? true) {
|
||||
@ -54,6 +60,30 @@ class _LogisticsState extends State<Logistics> {
|
||||
queryParameters: {"orderNumber": orderNumber});
|
||||
});
|
||||
goodsList = response.data["value"];
|
||||
|
||||
if (logistics != null && logistics.isNotEmpty && !_packageInit) {
|
||||
try {
|
||||
List packages = jsonDecode(logistics);
|
||||
|
||||
_packages = packages;
|
||||
|
||||
if (_orderPayWay != "套餐商品") {
|
||||
for (var p in _packages) {
|
||||
p["goods"].forEach((g) {
|
||||
var targetGoods = goodsList
|
||||
.firstWhere((tg) => g["id"] == tg["id"], orElse: () => null);
|
||||
if (targetGoods != null) {
|
||||
targetGoods["goodsNum"] -= g["num"];
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
_packageInit = true;
|
||||
} catch (e) {
|
||||
e;
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -73,6 +103,7 @@ class _LogisticsState extends State<Logistics> {
|
||||
if (hasUnAddedGoods) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text("有未添加至包裹的商品"),
|
||||
showCloseIcon: true,
|
||||
backgroundColor: Colors.redAccent,
|
||||
));
|
||||
return;
|
||||
@ -90,6 +121,7 @@ class _LogisticsState extends State<Logistics> {
|
||||
if (!result) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
backgroundColor: Colors.redAccent,
|
||||
showCloseIcon: true,
|
||||
content: Text("有未填写的数据")));
|
||||
return;
|
||||
}
|
||||
@ -184,8 +216,9 @@ class _LogisticsState extends State<Logistics> {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
"请填写完整商品信息")));
|
||||
content: Text("请填写完整商品信息"),
|
||||
showCloseIcon: true,
|
||||
));
|
||||
return;
|
||||
}
|
||||
int goodsNum = int.parse(
|
||||
@ -216,77 +249,89 @@ class _LogisticsState extends State<Logistics> {
|
||||
child: const Text("添加到包裹"))
|
||||
],
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: goodsList
|
||||
: goodsList
|
||||
.where((el) => el["goodsNum"] > 0)
|
||||
.length,
|
||||
itemBuilder: (context, index) {
|
||||
final goods = goodsList
|
||||
.where((el) => el["goodsNum"] > 0)
|
||||
.toList()[index];
|
||||
return ListTile(
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
// 检查商品及规格是否已存在于目标包裹
|
||||
int targetIndex = _packages[
|
||||
_activePackage]["goods"]
|
||||
.indexWhere((el) =>
|
||||
el["id"] ==
|
||||
goods["id"] &&
|
||||
goods["wisdGoodsSpec"]
|
||||
["id"] ==
|
||||
el["specId"]);
|
||||
if (targetIndex != -1) {
|
||||
setState(() {
|
||||
_packages[_activePackage]
|
||||
["goods"]
|
||||
[targetIndex]
|
||||
["num"] += 1;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_packages[_activePackage]
|
||||
.isNotEmpty
|
||||
? ListView.builder(
|
||||
itemCount: goodsList
|
||||
.where(
|
||||
(el) => el["goodsNum"] > 0)
|
||||
.length,
|
||||
itemBuilder: (context, index) {
|
||||
final goods = goodsList
|
||||
.where((el) =>
|
||||
el["goodsNum"] > 0)
|
||||
.toList()[index];
|
||||
return ListTile(
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () {
|
||||
// 检查商品及规格是否已存在于目标包裹
|
||||
int targetIndex = _packages[
|
||||
_activePackage]
|
||||
["goods"]
|
||||
.add({
|
||||
"id": goods["id"],
|
||||
"specId":
|
||||
goods["wisdGoodsSpec"]
|
||||
.indexWhere((el) =>
|
||||
el["id"] ==
|
||||
goods["id"] &&
|
||||
goods["wisdGoodsSpec"]
|
||||
["id"] ==
|
||||
el["specId"]);
|
||||
if (targetIndex != -1) {
|
||||
setState(() {
|
||||
_packages[_activePackage]
|
||||
["goods"]
|
||||
[targetIndex]
|
||||
["num"] += 1;
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
_packages[_activePackage]
|
||||
["goods"]
|
||||
.add({
|
||||
"id": goods["id"],
|
||||
"specId": goods[
|
||||
"wisdGoodsSpec"]
|
||||
["id"],
|
||||
"name":
|
||||
goods["goodsName"],
|
||||
"spec":
|
||||
goods?["wisdGoodsSpec"]
|
||||
"name": goods[
|
||||
"goodsName"],
|
||||
"spec": goods?[
|
||||
"wisdGoodsSpec"]
|
||||
?[
|
||||
"specName"] ??
|
||||
"",
|
||||
"num": 1
|
||||
});
|
||||
});
|
||||
}
|
||||
var curGoods =
|
||||
goodsList.firstWhere(
|
||||
(el) =>
|
||||
el["id"] ==
|
||||
goods["id"],
|
||||
orElse: () => -1);
|
||||
"num": 1
|
||||
});
|
||||
});
|
||||
}
|
||||
var curGoods =
|
||||
goodsList.firstWhere(
|
||||
(el) =>
|
||||
el["id"] ==
|
||||
goods["id"],
|
||||
orElse: () => -1);
|
||||
|
||||
setState(() {
|
||||
curGoods["goodsNum"] -= 1;
|
||||
});
|
||||
},
|
||||
setState(() {
|
||||
curGoods["goodsNum"] -= 1;
|
||||
});
|
||||
},
|
||||
),
|
||||
leading: Image.network(
|
||||
goods["goodsPhoto"],
|
||||
width: 100,
|
||||
height: 100,
|
||||
),
|
||||
title: Text(
|
||||
"${goods["goodsName"]} - ${goods?["wisdGoodsSpec"]?["specName"] ?? ''}"),
|
||||
subtitle: Text(
|
||||
"数量 : ${goods?["goodsNum"]}"),
|
||||
);
|
||||
})
|
||||
: const Center(
|
||||
child: Icon(
|
||||
CupertinoIcons.circle,
|
||||
size: 36,
|
||||
),
|
||||
leading: Image.network(
|
||||
goods["goodsPhoto"],
|
||||
width: 100,
|
||||
height: 100,
|
||||
),
|
||||
title: Text(
|
||||
"${goods["goodsName"]} - ${goods?["wisdGoodsSpec"]?["specName"] ?? ''}"),
|
||||
subtitle: Text(
|
||||
"数量 : ${goods?["goodsNum"]}"),
|
||||
);
|
||||
})),
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 20,
|
||||
),
|
||||
@ -300,10 +345,39 @@ class _LogisticsState extends State<Logistics> {
|
||||
itemBuilder:
|
||||
(BuildContext context, int index) {
|
||||
return PackageCard(
|
||||
logisticsNumber: _packages[index]
|
||||
["logisticsNumber"],
|
||||
onDeleteGoods: (goods) {
|
||||
if (goods["num"] == 1) {
|
||||
setState(() {
|
||||
_packages[index]["goods"] =
|
||||
_packages[index]["goods"]
|
||||
.where((el) =>
|
||||
el["id"] !=
|
||||
goods["id"])
|
||||
.toList();
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
goods["num"] -= 1;
|
||||
});
|
||||
}
|
||||
if (_orderPayWay != "套餐商品") {
|
||||
setState(() {
|
||||
goodsList.firstWhere(
|
||||
(e) =>
|
||||
goods["id"] ==
|
||||
e["id"],
|
||||
orElse: () => null)?[
|
||||
"goodsNum"] += 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
onLogisticsChanged: (value) {
|
||||
_packages[index]
|
||||
["logisticsNumber"] = value;
|
||||
},
|
||||
orderPayWay: _orderPayWay,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_activePackage = index;
|
||||
@ -312,6 +386,23 @@ class _LogisticsState extends State<Logistics> {
|
||||
onClose: () {
|
||||
var curId =
|
||||
_packages[index]["id"];
|
||||
if (_orderPayWay != "套餐商品") {
|
||||
_packages[index]["goods"]
|
||||
.forEach((el) {
|
||||
var targetGoods =
|
||||
goodsList.firstWhere(
|
||||
(goodsItem) =>
|
||||
goodsItem["id"] ==
|
||||
el["id"],
|
||||
orElse: () => -1);
|
||||
if (targetGoods != -1) {
|
||||
setState(() {
|
||||
targetGoods["goodsNum"] +=
|
||||
el["num"];
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
setState(() {
|
||||
_activePackage =
|
||||
_activePackage >= index
|
||||
@ -341,6 +432,7 @@ class _LogisticsState extends State<Logistics> {
|
||||
"goods": []
|
||||
}
|
||||
];
|
||||
_activePackage += 1;
|
||||
});
|
||||
},
|
||||
child: const Text("添加包裹"))
|
||||
@ -351,10 +443,14 @@ class _LogisticsState extends State<Logistics> {
|
||||
);
|
||||
} else if (snapshot.hasError) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error_outline,
|
||||
color: Colors.red,
|
||||
size: 60,
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
color: Colors.red,
|
||||
size: 60,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@ -375,21 +471,36 @@ class PackageCard extends StatefulWidget {
|
||||
required this.onLogisticsChanged,
|
||||
required this.totalPackagesCount,
|
||||
required this.onClose,
|
||||
required this.orderPayWay,
|
||||
required this.onDeleteGoods,
|
||||
required this.logisticsNumber,
|
||||
});
|
||||
|
||||
final bool isActive;
|
||||
final Function() onTap;
|
||||
final Function() onClose;
|
||||
final Function(Map<String, dynamic> goods) onDeleteGoods;
|
||||
final Map<String, dynamic> package;
|
||||
final int index;
|
||||
final Function(String) onLogisticsChanged;
|
||||
final int totalPackagesCount;
|
||||
final String orderPayWay;
|
||||
final String logisticsNumber;
|
||||
|
||||
@override
|
||||
State<PackageCard> createState() => _PackageCardState();
|
||||
}
|
||||
|
||||
class _PackageCardState extends State<PackageCard> {
|
||||
final TextEditingController _logisticsController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
_logisticsController.text = widget.logisticsNumber;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
@ -417,6 +528,7 @@ class _PackageCardState extends State<PackageCard> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TextField(
|
||||
controller: _logisticsController,
|
||||
onChanged: widget.onLogisticsChanged,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), labelText: "物流单号"),
|
||||
@ -427,13 +539,26 @@ class _PackageCardState extends State<PackageCard> {
|
||||
DataTable(columns: const [
|
||||
DataColumn(label: Text("名称")),
|
||||
DataColumn(label: Text("规格")),
|
||||
DataColumn(label: Text("数量"))
|
||||
DataColumn(label: Text("数量")),
|
||||
DataColumn(label: Text("操作"))
|
||||
], rows: [
|
||||
for (var goodsItem in widget.package["goods"])
|
||||
for (var goodsItem
|
||||
in widget.package["goods"].asMap().entries)
|
||||
DataRow(cells: [
|
||||
DataCell(Text("${goodsItem["name"]}")),
|
||||
DataCell(Text("${goodsItem["spec"]}")),
|
||||
DataCell(Text("${goodsItem["num"]}")),
|
||||
DataCell(Text("${goodsItem.value["name"]}")),
|
||||
DataCell(Text("${goodsItem.value["spec"]}")),
|
||||
DataCell(Text("${goodsItem.value["num"]}")),
|
||||
DataCell(SizedBox(
|
||||
width: 24,
|
||||
height: 24,
|
||||
child: IconButton(
|
||||
icon: const Icon(CupertinoIcons.delete),
|
||||
iconSize: 16,
|
||||
padding: const EdgeInsets.all(4),
|
||||
onPressed: () {
|
||||
widget.onDeleteGoods(goodsItem.value);
|
||||
}),
|
||||
)),
|
||||
])
|
||||
]),
|
||||
],
|
||||
|
@ -5,6 +5,8 @@ import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class OrderList extends StatefulWidget {
|
||||
const OrderList({super.key});
|
||||
@ -61,155 +63,163 @@ class _OrderListState extends State<OrderList> {
|
||||
Card(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.zero,
|
||||
child: /*Scrollbar(
|
||||
// controller: scrollController,
|
||||
child:*/
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: DataTable(
|
||||
columns: _headers.map((el) {
|
||||
return DataColumn(label: Text(el));
|
||||
}).toList(),
|
||||
rows: _data.asMap().entries.map((row) {
|
||||
return DataRow(
|
||||
cells: row.value.asMap().entries.map((col) {
|
||||
String colTitle = _headers[col.key];
|
||||
return DataCell(colTitle == "物流名称"
|
||||
? Row(
|
||||
children: [
|
||||
Text("${col.value}"),
|
||||
IconButton(
|
||||
// padding: EdgeInsets.all(2),
|
||||
iconSize: 12,
|
||||
onPressed: () {
|
||||
_logComController.text =
|
||||
_data[row.key][col.key]
|
||||
.toString();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext
|
||||
context) =>
|
||||
AlertDialog(
|
||||
// icon: const Icon(Icons.edit),
|
||||
title: const Text(
|
||||
"填写物流公司"),
|
||||
content: Column(
|
||||
mainAxisSize:
|
||||
MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
decoration:
|
||||
const InputDecoration(
|
||||
labelText:
|
||||
"物流公司"),
|
||||
controller:
|
||||
_logComController,
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: const Text(
|
||||
"取消")),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
String
|
||||
logisticsCom =
|
||||
_logComController
|
||||
.text;
|
||||
if (logisticsCom
|
||||
.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(const SnackBar(
|
||||
content:
|
||||
Text("请输入物流公司")));
|
||||
return;
|
||||
}
|
||||
final data =
|
||||
_data;
|
||||
_data[row.key][
|
||||
col.key] =
|
||||
logisticsCom;
|
||||
setState(() {
|
||||
_data = data;
|
||||
});
|
||||
context.pop();
|
||||
},
|
||||
child: const Text(
|
||||
"确认")),
|
||||
],
|
||||
));
|
||||
},
|
||||
icon: const Icon(Icons.edit))
|
||||
],
|
||||
)
|
||||
: colTitle == "物流信息"
|
||||
child: Scrollbar(
|
||||
controller: scrollController,
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: DataTable(
|
||||
columns: _headers.map((el) {
|
||||
return DataColumn(label: Text(el));
|
||||
}).toList(),
|
||||
rows: _data.asMap().entries.map((row) {
|
||||
return DataRow(
|
||||
cells: row.value.asMap().entries.map((col) {
|
||||
String colTitle = _headers[col.key];
|
||||
return DataCell(colTitle == "物流名称"
|
||||
? Row(
|
||||
children: [
|
||||
_data[row.key][col.key]
|
||||
.toString()
|
||||
.isNotEmpty
|
||||
? SizedBox(
|
||||
width: 120,
|
||||
child: Text(
|
||||
_data[row.key][col.key].toString(),
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
String orderNumber =
|
||||
_data[row.key][2]
|
||||
.toString();
|
||||
String orderPayWay =
|
||||
_data[row.key][15]
|
||||
.toString();
|
||||
if (orderPayWay.isEmpty ||
|
||||
orderNumber.isEmpty) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
"该行数据有误")));
|
||||
return;
|
||||
}
|
||||
context.pushNamed("logistics",
|
||||
queryParameters: {
|
||||
"orderNumber":
|
||||
_data[row.key][2]
|
||||
.toString(),
|
||||
"orderPayWay":
|
||||
_data[row.key][15]
|
||||
.toString(),
|
||||
}).then((value) {
|
||||
if (value != null) {
|
||||
var newData = _data;
|
||||
newData[row.key][col.key] =
|
||||
value;
|
||||
setState(() {
|
||||
_data = newData;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
child: const Text("填写"),
|
||||
)
|
||||
Text("${col.value}"),
|
||||
IconButton(
|
||||
// padding: EdgeInsets.all(2),
|
||||
iconSize: 12,
|
||||
onPressed: () {
|
||||
_logComController.text =
|
||||
_data[row.key][col.key]
|
||||
.toString();
|
||||
showDialog(
|
||||
context: context,
|
||||
builder:
|
||||
(BuildContext
|
||||
context) =>
|
||||
AlertDialog(
|
||||
// icon: const Icon(Icons.edit),
|
||||
title: const Text(
|
||||
"填写物流公司"),
|
||||
content: Column(
|
||||
mainAxisSize:
|
||||
MainAxisSize
|
||||
.min,
|
||||
children: [
|
||||
TextField(
|
||||
decoration:
|
||||
const InputDecoration(
|
||||
labelText: "物流公司"),
|
||||
controller:
|
||||
_logComController,
|
||||
)
|
||||
],
|
||||
),
|
||||
actions: [
|
||||
ElevatedButton(
|
||||
onPressed:
|
||||
() {
|
||||
context
|
||||
.pop();
|
||||
},
|
||||
child: const Text(
|
||||
"取消")),
|
||||
ElevatedButton(
|
||||
onPressed:
|
||||
() {
|
||||
String
|
||||
logisticsCom =
|
||||
_logComController.text;
|
||||
if (logisticsCom
|
||||
.isEmpty) {
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(const SnackBar(content: Text("请输入物流公司")));
|
||||
return;
|
||||
}
|
||||
final data =
|
||||
_data;
|
||||
_data[row.key][col.key] =
|
||||
logisticsCom;
|
||||
setState(
|
||||
() {
|
||||
_data =
|
||||
data;
|
||||
});
|
||||
context
|
||||
.pop();
|
||||
},
|
||||
child: const Text(
|
||||
"确认")),
|
||||
],
|
||||
));
|
||||
},
|
||||
icon: const Icon(Icons.edit))
|
||||
],
|
||||
)
|
||||
: Text("${col.value}"));
|
||||
}).toList());
|
||||
}).toList(),
|
||||
),
|
||||
)
|
||||
/*)*/
|
||||
,
|
||||
: colTitle == "物流信息"
|
||||
? Row(
|
||||
children: [
|
||||
_data[row.key][col.key]
|
||||
.toString()
|
||||
.isNotEmpty
|
||||
? SizedBox(
|
||||
width: 120,
|
||||
child: Text(
|
||||
_data[row.key]
|
||||
[col.key]
|
||||
.toString(),
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
String orderNumber =
|
||||
_data[row.key][2]
|
||||
.toString();
|
||||
String orderPayWay =
|
||||
_data[row.key][15]
|
||||
.toString();
|
||||
if (orderPayWay.isEmpty ||
|
||||
orderNumber.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context)
|
||||
.showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text("该行数据有误"),
|
||||
showCloseIcon: true,
|
||||
));
|
||||
return;
|
||||
}
|
||||
context.pushNamed(
|
||||
"logistics",
|
||||
queryParameters: {
|
||||
"orderNumber":
|
||||
_data[row.key][2]
|
||||
.toString(),
|
||||
"orderPayWay":
|
||||
_data[row.key][15]
|
||||
.toString(),
|
||||
"logistics":
|
||||
_data[row.key][12]
|
||||
.toString()
|
||||
}).then((value) {
|
||||
if (value != null) {
|
||||
var newData = _data;
|
||||
newData[row.key]
|
||||
[col.key] = value;
|
||||
setState(() {
|
||||
_data = newData;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
child: const Text("填写"),
|
||||
)
|
||||
],
|
||||
)
|
||||
: Text("${col.value}"));
|
||||
}).toList());
|
||||
}).toList(),
|
||||
),
|
||||
)),
|
||||
)
|
||||
],
|
||||
)
|
||||
@ -268,18 +278,34 @@ class _OrderListState extends State<OrderList> {
|
||||
});
|
||||
});
|
||||
var fileBytes = _excel.save();
|
||||
String? directory =
|
||||
await FilePicker.platform.getDirectoryPath(dialogTitle: "选择保存位置");
|
||||
if (directory == null || directory.isEmpty) {
|
||||
String fileName = "导出订单${DateTime.now().millisecondsSinceEpoch}.xlsx";
|
||||
String? outputPath = await FilePicker.platform.saveFile(
|
||||
dialogTitle: "选择保存位置",
|
||||
fileName: fileName,
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ["xlsx", "xls"]);
|
||||
if (outputPath == null || outputPath.isEmpty) {
|
||||
return;
|
||||
}
|
||||
File("$directory\\导出订单${DateTime.now().millisecondsSinceEpoch}.xlsx")
|
||||
File(outputPath)
|
||||
..createSync(recursive: true)
|
||||
..writeAsBytesSync(fileBytes!);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text("导出文件成功"),
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: const Text("导出文件成功"),
|
||||
backgroundColor: Colors.green,
|
||||
action: SnackBarAction(
|
||||
label: "打开文件所在位置",
|
||||
onPressed: () {
|
||||
final Uri fileUrl = Uri(
|
||||
scheme: "file",
|
||||
path: p.dirname(outputPath),
|
||||
);
|
||||
launchUrl(fileUrl, mode: LaunchMode.externalApplication);
|
||||
},
|
||||
backgroundColor: Colors.white,
|
||||
textColor: Colors.green,
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,10 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_linux
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
@ -6,7 +6,9 @@ import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import path_provider_foundation
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
122
pubspec.lock
@ -9,6 +9,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.4.9"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: args
|
||||
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.5.0"
|
||||
async:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -33,6 +41,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.3"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -142,6 +166,14 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_launcher_icons:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_launcher_icons
|
||||
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.13.1"
|
||||
flutter_lints:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@ -184,6 +216,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.2"
|
||||
image:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: image
|
||||
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.0"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -192,6 +232,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.1"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -257,7 +305,7 @@ packages:
|
||||
source: hosted
|
||||
version: "1.12.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: path
|
||||
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||
@ -413,6 +461,70 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.3"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
uuid:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -469,6 +581,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.5.0"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: yaml
|
||||
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.4.1 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
|
@ -42,6 +42,9 @@ dependencies:
|
||||
path_provider: ^2.1.3
|
||||
uuid: ^4.4.0
|
||||
async: ^2.11.0
|
||||
url_launcher: ^6.3.0
|
||||
path: ^1.9.0
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -6,6 +6,9 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 451 B |