Merge branch 'master' of sma/fcs into master

This commit is contained in:
tzw
2024-02-28 17:48:29 +06:30
committed by Gogs
8 changed files with 278 additions and 177 deletions

View File

@@ -30,6 +30,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
bool _isLoading = false;
late bool _isNew;
User? user;
final _receiveFormKey=GlobalKey<FormState>();
TextEditingController _trackingIDCtl = new TextEditingController();
TextEditingController _remarkCtl = new TextEditingController();
MultiImgController _multiImgController = MultiImgController();
@@ -93,6 +94,14 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
iconData: MaterialCommunityIcons.barcode_scan,
labelTextKey: "receiving.tracking.id",
controller: _trackingIDCtl,
autovalidateMode: AutovalidateMode.onUserInteraction,
validator: (value){
if(value==null || value.isEmpty){
return "invalid tracking ID";
}
return null;
},
)),
InkWell(
onTap: _scan,
@@ -159,29 +168,32 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
),
body: Padding(
padding: const EdgeInsets.only(left: 12.0, right: 12),
child: ListView(
children: <Widget>[
trackingIDBox,
SizedBox(
height: 10,
),
remarkBox,
Divider(),
img,
Divider(),
SizedBox(
height: 10,
),
fcsIDBox,
namebox,
SizedBox(
height: 20,
),
_isNew ? createButton : updateButton,
SizedBox(
height: 10,
),
],
child: Form(
key: _receiveFormKey,
child: ListView(
children: <Widget>[
trackingIDBox,
SizedBox(
height: 10,
),
remarkBox,
Divider(),
img,
Divider(),
SizedBox(
height: 10,
),
fcsIDBox,
namebox,
SizedBox(
height: 20,
),
_isNew ? createButton : updateButton,
SizedBox(
height: 10,
),
],
),
),
),
));
@@ -216,8 +228,11 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
Package _p =
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
if (_p.trackingID == null || _p.trackingID == "") {
showMsgDialog(context, "Error", "Invalid tracking ID!");
// if (_p.trackingID == null || _p.trackingID == "") {
// showMsgDialog(context, "Error", "Invalid tracking ID!");
// return;
// }
if (!_receiveFormKey.currentState!.validate()) {
return;
}