2020-12-10 20:06:15 +06:30
|
|
|
import 'package:fcs/domain/entities/carton.dart';
|
|
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
2021-09-10 12:00:08 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
2020-12-10 20:06:15 +06:30
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
|
|
|
|
|
typedef OnRemove(Carton carton);
|
|
|
|
|
|
|
|
|
|
class CartonRow extends StatelessWidget {
|
2021-09-10 16:33:52 +06:30
|
|
|
final Carton box;
|
2021-09-10 12:00:08 +06:30
|
|
|
final OnRemove? onRemove;
|
2021-09-10 16:33:52 +06:30
|
|
|
CartonRow({Key? key, required this.box, this.onRemove}) : super(key: key);
|
2020-12-10 20:06:15 +06:30
|
|
|
|
|
|
|
|
final double dotSize = 15.0;
|
|
|
|
|
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
border: Border(
|
2021-09-10 12:00:08 +06:30
|
|
|
bottom: BorderSide(color: Colors.grey.shade300),
|
2020-12-10 20:06:15 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new Padding(
|
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 13.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(
|
2021-09-10 16:33:52 +06:30
|
|
|
box.cartonNumber ?? "",
|
2020-12-10 20:06:15 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10.0, top: 10),
|
|
|
|
|
child: new Text(
|
2021-09-10 16:33:52 +06:30
|
|
|
box.userName ?? "",
|
2020-12-10 20:06:15 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
onRemove == null
|
|
|
|
|
? Container()
|
|
|
|
|
: IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.remove_circle,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
2021-09-10 16:33:52 +06:30
|
|
|
if (onRemove != null) onRemove!(box);
|
2020-12-10 20:06:15 +06:30
|
|
|
}),
|
2021-09-10 16:33:52 +06:30
|
|
|
box.actualWeight == 0
|
2020-12-10 20:06:15 +06:30
|
|
|
? Container()
|
|
|
|
|
: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
new Text(
|
2021-09-10 16:33:52 +06:30
|
|
|
"${box.actualWeight.toStringAsFixed(2)} lb",
|
2020-12-10 20:06:15 +06:30
|
|
|
style: new TextStyle(
|
|
|
|
|
fontSize: 15.0, color: Colors.grey),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|