add carton api

This commit is contained in:
Sai Naw Wun
2020-10-20 06:19:10 +06:30
parent 453cb71fa8
commit 4d0e5b6833
15 changed files with 685 additions and 950 deletions

View File

@@ -0,0 +1,87 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/local_title.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
typedef OnSelect = Function(Carton carton, bool checked);
class CartonMixTable extends StatelessWidget {
final List<Carton> cartons;
final OnSelect onSelect;
const CartonMixTable({Key key, this.cartons, this.onSelect})
: super(key: key);
@override
Widget build(BuildContext context) {
final tableTitle = Container(
padding: EdgeInsets.only(right: 10.0, top: 20),
child: Row(
children: <Widget>[
Container(
width: 30,
),
Expanded(
child: LocalText(context, 'box.mix.number', color: Colors.grey),
),
LocalText(context, 'box.cargo.total', color: Colors.grey),
],
),
);
final rows = cartons.asMap().entries.map((p) {
return Container(
color: p.value.isChecked
? Colors.grey.withOpacity(0.2)
: Colors.grey[50].withOpacity(0.2),
child: Container(
padding:
EdgeInsets.only(left: 0.0, right: 10.0, top: 3.0, bottom: 3.0),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: p.key == cartons.length - 1
? Colors.white
: Colors.grey[350],
width: 1),
),
),
child: Row(
children: <Widget>[
Checkbox(
value: p.value.isChecked,
activeColor: primaryColor,
onChanged: (bool check) {
if (onSelect != null) onSelect(p.value, check);
}),
Expanded(
child: new Text(
p.value.cartonNumber ?? "",
style: textStyle,
)),
new Text(
p.value?.actualWeight?.toString() ?? "",
style: textStyle,
),
],
),
),
);
}).toList();
return Column(
children: [
LocalTitle(textKey: "box.shipment.boxes"),
tableTitle,
Divider(
color: Colors.grey[400],
),
Column(
children: rows,
),
],
);
}
}