update carton list and editor

This commit is contained in:
tzw
2024-02-01 18:07:40 +06:30
parent eff1ae4688
commit 24f2dc110c
20 changed files with 1951 additions and 954 deletions

View File

@@ -1,15 +1,11 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
typedef OnRemove(Carton carton);
class CartonRow extends StatelessWidget {
final Carton box;
final OnRemove? onRemove;
CartonRow({Key? key, required this.box, this.onRemove}) : super(key: key);
CartonRow({Key? key, required this.box}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@@ -18,68 +14,34 @@ class CartonRow extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: Colors.grey.shade300),
),
border: Border(bottom: BorderSide(color: Colors.grey.shade300)),
),
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 13.0),
padding: const EdgeInsets.symmetric(vertical: 5.0),
child: new Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 5, right: 10),
child: Icon(MaterialCommunityIcons.package,
color: primaryColor, size: 30)),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
box.cartonNumber ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
box.userName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
)
],
),
),
new Text(box.cartonNumber ?? "",
style:
new TextStyle(fontSize: 15.0, color: Colors.black)),
const SizedBox(width: 15),
IconButton(onPressed: () {}, icon: Icon(AntDesign.qrcode)),
],
),
),
),
Column(
children: <Widget>[
onRemove == null
? Container()
: IconButton(
icon: Icon(
Icons.remove_circle,
color: primaryColor,
),
onPressed: () {
if (onRemove != null) onRemove!(box);
}),
box.actualWeight == 0
box.cartonWeight == 0
? Container()
: Padding(
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${box.actualWeight.toStringAsFixed(2)} lb",
"${box.cartonWeight.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),