119 lines
3.7 KiB
Dart
119 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:pad_scanner/services/api_service.dart';
|
|
|
|
class BoxingDetailPage extends StatelessWidget {
|
|
final String paichanNo;
|
|
final List<BoxDetailData> existingBoxes;
|
|
|
|
const BoxingDetailPage({
|
|
super.key,
|
|
required this.paichanNo,
|
|
required this.existingBoxes,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Row(
|
|
children: [
|
|
const Text('装箱详情'),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
paichanNo,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.normal,
|
|
),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
Expanded(
|
|
child: existingBoxes.isEmpty
|
|
? const Center(child: Text('暂无装箱记录'))
|
|
: ListView.builder(
|
|
padding: const EdgeInsets.all(12),
|
|
itemCount: existingBoxes.length,
|
|
itemBuilder: (context, index) {
|
|
return _buildBoxGroup(context, existingBoxes[index]);
|
|
},
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
|
|
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
|
child: Text(
|
|
'共 ${existingBoxes.length} 箱',
|
|
style: const TextStyle(fontSize: 14),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildBoxGroup(BuildContext context, BoxDetailData box) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(bottom: 12),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'箱号 ${box.boxNo}',
|
|
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.all(8),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey.shade300),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: Column(
|
|
children: box.items.map((item) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
flex: 3,
|
|
child: Text(
|
|
item.zongpaiNo,
|
|
style: const TextStyle(fontSize: 14),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Expanded(
|
|
flex: 2,
|
|
child: Text(
|
|
item.workOrderNo ?? '--',
|
|
style: const TextStyle(fontSize: 14),
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
Text(
|
|
'数量:${item.quantity}',
|
|
style: const TextStyle(fontSize: 14),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|