Merge branch 'master' of sma/fcs into master
This commit is contained in:
@@ -19,6 +19,7 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
|
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late String dialCode;
|
late String dialCode;
|
||||||
|
final _inviteFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -34,9 +35,17 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final nameBox = InputText(
|
final nameBox = InputText(
|
||||||
labelTextKey: 'customer.name',
|
labelTextKey: 'customer.name',
|
||||||
iconData: Icons.person,
|
iconData: Icons.person,
|
||||||
controller: _nameController);
|
controller: _nameController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert name";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -56,73 +65,88 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
padding: EdgeInsets.all(18),
|
key: _inviteFormKey,
|
||||||
child: ListView(
|
child: Container(
|
||||||
children: <Widget>[
|
padding: EdgeInsets.all(18),
|
||||||
nameBox,
|
child: ListView(
|
||||||
SizedBox(height: 10),
|
children: <Widget>[
|
||||||
Row(
|
nameBox,
|
||||||
children: <Widget>[
|
SizedBox(height: 10),
|
||||||
Padding(
|
Row(
|
||||||
padding: const EdgeInsets.all(8.0),
|
children: <Widget>[
|
||||||
child: Icon(
|
Padding(
|
||||||
Icons.phone,
|
padding: const EdgeInsets.all(8.0),
|
||||||
color: primaryColor,
|
child: Icon(
|
||||||
|
Icons.phone,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Container(
|
||||||
Container(
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
border:
|
||||||
border:
|
Border.all(color: Colors.grey.shade400, width: 1),
|
||||||
Border.all(color: Colors.grey.shade400, width: 1),
|
borderRadius:
|
||||||
borderRadius: BorderRadius.all(Radius.circular(12.0))),
|
BorderRadius.all(Radius.circular(12.0))),
|
||||||
child: CountryCodePicker(
|
child: CountryCodePicker(
|
||||||
onChanged: _countryChange,
|
onChanged: _countryChange,
|
||||||
initialSelection: dialCode,
|
initialSelection: dialCode,
|
||||||
countryFilter: ['mm', 'us'],
|
countryFilter: ['mm', 'us'],
|
||||||
showCountryOnly: false,
|
showCountryOnly: false,
|
||||||
showOnlyCountryWhenClosed: false,
|
showOnlyCountryWhenClosed: false,
|
||||||
alignLeft: false,
|
alignLeft: false,
|
||||||
textStyle: TextStyle(fontSize: 16, color: Colors.black87),
|
textStyle:
|
||||||
searchDecoration: InputDecoration(
|
TextStyle(fontSize: 16, color: Colors.black87),
|
||||||
focusedBorder: UnderlineInputBorder(
|
searchDecoration: InputDecoration(
|
||||||
borderSide:
|
focusedBorder: UnderlineInputBorder(
|
||||||
BorderSide(color: Colors.black, width: 1.0))),
|
borderSide: BorderSide(
|
||||||
|
color: Colors.black, width: 1.0))),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: 10,
|
||||||
width: 10,
|
),
|
||||||
),
|
Flexible(
|
||||||
Flexible(
|
child: Container(
|
||||||
child: Container(
|
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
child: TextFormField(
|
||||||
child: TextFormField(
|
controller: _phoneController,
|
||||||
controller: _phoneController,
|
cursorColor: primaryColor,
|
||||||
cursorColor: primaryColor,
|
textAlign: TextAlign.left,
|
||||||
textAlign: TextAlign.left,
|
keyboardType: TextInputType.phone,
|
||||||
keyboardType: TextInputType.phone,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 18,
|
||||||
fontSize: 18,
|
),
|
||||||
),
|
decoration: InputDecoration(
|
||||||
decoration: InputDecoration(
|
fillColor: Colors.white,
|
||||||
fillColor: Colors.white,
|
labelText:
|
||||||
labelText: getLocalString(context, "customer.phone"),
|
getLocalString(context, "customer.phone"),
|
||||||
labelStyle:
|
labelStyle:
|
||||||
TextStyle(fontSize: 16, color: Colors.grey),
|
TextStyle(fontSize: 16, color: Colors.grey),
|
||||||
filled: true,
|
filled: true,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide:
|
borderSide: BorderSide(
|
||||||
BorderSide(color: Colors.grey, width: 1.0)),
|
color: Colors.grey, width: 1.0)),
|
||||||
|
errorStyle: TextStyle(
|
||||||
|
color: dangerColor,
|
||||||
|
)),
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert phone no";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
SizedBox(height: 20),
|
||||||
SizedBox(height: 20),
|
fcsButton(context, getLocalString(context, "invite.btn"),
|
||||||
fcsButton(context, getLocalString(context, "invite.btn"),
|
callack: _invite),
|
||||||
callack: _invite),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -138,9 +162,9 @@ class _InvitationCreateState extends State<InvitationCreate> {
|
|||||||
_invite() async {
|
_invite() async {
|
||||||
String userName = _nameController.text;
|
String userName = _nameController.text;
|
||||||
String phoneNumber = dialCode + _phoneController.text;
|
String phoneNumber = dialCode + _phoneController.text;
|
||||||
if (userName == "" || phoneNumber == "") {
|
|
||||||
showMsgDialog(context, "Error", "Invalid name or phone number");
|
if (!_inviteFormKey.currentState!.validate()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.number",
|
labelTextKey: "FCSshipment.number",
|
||||||
iconData: Ionicons.ios_airplane,
|
iconData: Ionicons.ios_airplane,
|
||||||
controller: _shipmentNumberController,
|
controller: _shipmentNumberController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Enter shipment number";
|
return "Enter shipment number";
|
||||||
@@ -132,6 +133,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.cutoff_date",
|
labelTextKey: "FCSshipment.cutoff_date",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _cutoffDateController,
|
controller: _cutoffDateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Select cutoff date";
|
return "Select cutoff date";
|
||||||
@@ -143,6 +145,7 @@ class _FcsShipmentEditorState extends State<FcsShipmentEditor> {
|
|||||||
labelTextKey: "FCSshipment.ETA",
|
labelTextKey: "FCSshipment.ETA",
|
||||||
iconData: Icons.date_range,
|
iconData: Icons.date_range,
|
||||||
controller: _arrivalDateController,
|
controller: _arrivalDateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return "Select ETA date";
|
return "Select ETA date";
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late CargoType _cargo;
|
late CargoType _cargo;
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
final _cargoFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -47,11 +48,26 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
final typeBox = InputText(
|
final typeBox = InputText(
|
||||||
labelTextKey: 'cargo.type',
|
labelTextKey: 'cargo.type',
|
||||||
iconData: Icons.text_format,
|
iconData: Icons.text_format,
|
||||||
controller: _descController);
|
controller: _descController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "Please insert cargo type";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},);
|
||||||
final rateBox = InputText(
|
final rateBox = InputText(
|
||||||
labelTextKey: 'cargo.rate',
|
labelTextKey: 'cargo.rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _rateController);
|
controller: _rateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -78,23 +94,26 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
padding: EdgeInsets.all(18),
|
key: _cargoFormKey,
|
||||||
child: Column(
|
child: Container(
|
||||||
children: <Widget>[
|
padding: EdgeInsets.all(18),
|
||||||
Expanded(
|
child: Column(
|
||||||
child: ListView(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
typeBox,
|
child: ListView(
|
||||||
rateBox,
|
children: <Widget>[
|
||||||
SizedBox(height: 30),
|
typeBox,
|
||||||
],
|
rateBox,
|
||||||
|
SizedBox(height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
fcsButton(context, getLocalString(context, "btn.save"),
|
||||||
fcsButton(context, getLocalString(context, "btn.save"),
|
callack: _save),
|
||||||
callack: _save),
|
SizedBox(height: 10)
|
||||||
SizedBox(height: 10)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -102,8 +121,7 @@ class _CargoEditorState extends State<CargoEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_rateController.text == "") {
|
if (!_cargoFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
CargoType _custom = new CargoType();
|
CargoType _custom = new CargoType();
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
|
final _customFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -50,16 +51,39 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
final productBox = InputText(
|
final productBox = InputText(
|
||||||
labelTextKey: 'rate.cutom.product_type',
|
labelTextKey: 'rate.cutom.product_type',
|
||||||
iconData: FontAwesomeIcons.weightHanging,
|
iconData: FontAwesomeIcons.weightHanging,
|
||||||
controller: _productController);
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
controller: _productController,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "Please insert product type";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},);
|
||||||
final feeBox = InputText(
|
final feeBox = InputText(
|
||||||
labelTextKey: 'rate.custom.fee',
|
labelTextKey: 'rate.custom.fee',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _feeController);
|
controller: _feeController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert fee";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
final shipmentRateBox = InputText(
|
final shipmentRateBox = InputText(
|
||||||
labelTextKey: 'rate.custom.shipment_rate',
|
labelTextKey: 'rate.custom.shipment_rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _shipmentRateController);
|
controller: _shipmentRateController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert shipment rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
@@ -86,24 +110,27 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
padding: EdgeInsets.all(18),
|
key: _customFormKey,
|
||||||
child: Column(
|
child: Container(
|
||||||
children: <Widget>[
|
padding: EdgeInsets.all(18),
|
||||||
Expanded(
|
child: Column(
|
||||||
child: ListView(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
productBox,
|
child: ListView(
|
||||||
feeBox,
|
children: <Widget>[
|
||||||
shipmentRateBox,
|
productBox,
|
||||||
SizedBox(height: 30),
|
feeBox,
|
||||||
],
|
shipmentRateBox,
|
||||||
|
SizedBox(height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
fcsButton(context, getLocalString(context, "btn.save"),
|
||||||
fcsButton(context, getLocalString(context, "btn.save"),
|
callack: _save),
|
||||||
callack: _save),
|
SizedBox(height: 10)
|
||||||
SizedBox(height: 10)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -111,13 +138,7 @@ class _CustomEditorState extends State<CustomEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_feeController.text == "") {
|
if (!_customFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert fee");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_shipmentRateController.text == "") {
|
|
||||||
showMsgDialog(context, "Error", "Please insert shipment rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
bool _isNew = false;
|
bool _isNew = false;
|
||||||
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
DiscountByWeight _discountByWeight = new DiscountByWeight();
|
||||||
|
final _discountFormKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -46,13 +47,29 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final weightBox = InputText(
|
final weightBox = InputText(
|
||||||
labelTextKey: 'rate.discount.weight',
|
labelTextKey: 'rate.discount.weight',
|
||||||
iconData: FontAwesomeIcons.weightHanging,
|
iconData: FontAwesomeIcons.weightHanging,
|
||||||
controller: _weightController);
|
controller: _weightController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please inset weight";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
final discountRateBox = InputText(
|
final discountRateBox = InputText(
|
||||||
labelTextKey: 'rate.discount.rate',
|
labelTextKey: 'rate.discount.rate',
|
||||||
iconData: Icons.attach_money,
|
iconData: Icons.attach_money,
|
||||||
controller: _discountController);
|
controller: _discountController,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value) {
|
||||||
|
if (value == null || value.isEmpty) {
|
||||||
|
return "Please insert discount rate";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
@@ -80,23 +97,26 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Form(
|
||||||
padding: EdgeInsets.all(18),
|
key: _discountFormKey,
|
||||||
child: Column(
|
child: Container(
|
||||||
children: <Widget>[
|
padding: EdgeInsets.all(18),
|
||||||
Expanded(
|
child: Column(
|
||||||
child: ListView(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
weightBox,
|
child: ListView(
|
||||||
discountRateBox,
|
children: <Widget>[
|
||||||
SizedBox(height: 30),
|
weightBox,
|
||||||
],
|
discountRateBox,
|
||||||
|
SizedBox(height: 30),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
fcsButton(context, getLocalString(context, "btn.save"),
|
||||||
fcsButton(context, getLocalString(context, "btn.save"),
|
callack: _save),
|
||||||
callack: _save),
|
SizedBox(height: 10)
|
||||||
SizedBox(height: 10)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -104,13 +124,7 @@ class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_save() async {
|
_save() async {
|
||||||
if (_weightController.text == "") {
|
if (!_discountFormKey.currentState!.validate()) {
|
||||||
showMsgDialog(context, "Error", "Please insert weight");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_discountController.text == "") {
|
|
||||||
showMsgDialog(context, "Error", "Please insert discount rate");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late bool _isNew;
|
late bool _isNew;
|
||||||
User? user;
|
User? user;
|
||||||
|
final _receiveFormKey=GlobalKey<FormState>();
|
||||||
TextEditingController _trackingIDCtl = new TextEditingController();
|
TextEditingController _trackingIDCtl = new TextEditingController();
|
||||||
TextEditingController _remarkCtl = new TextEditingController();
|
TextEditingController _remarkCtl = new TextEditingController();
|
||||||
MultiImgController _multiImgController = MultiImgController();
|
MultiImgController _multiImgController = MultiImgController();
|
||||||
@@ -93,6 +94,14 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
iconData: MaterialCommunityIcons.barcode_scan,
|
iconData: MaterialCommunityIcons.barcode_scan,
|
||||||
labelTextKey: "receiving.tracking.id",
|
labelTextKey: "receiving.tracking.id",
|
||||||
controller: _trackingIDCtl,
|
controller: _trackingIDCtl,
|
||||||
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
|
validator: (value){
|
||||||
|
if(value==null || value.isEmpty){
|
||||||
|
return "invalid tracking ID";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
)),
|
)),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: _scan,
|
onTap: _scan,
|
||||||
@@ -159,29 +168,32 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
padding: const EdgeInsets.only(left: 12.0, right: 12),
|
||||||
child: ListView(
|
child: Form(
|
||||||
children: <Widget>[
|
key: _receiveFormKey,
|
||||||
trackingIDBox,
|
child: ListView(
|
||||||
SizedBox(
|
children: <Widget>[
|
||||||
height: 10,
|
trackingIDBox,
|
||||||
),
|
SizedBox(
|
||||||
remarkBox,
|
height: 10,
|
||||||
Divider(),
|
),
|
||||||
img,
|
remarkBox,
|
||||||
Divider(),
|
Divider(),
|
||||||
SizedBox(
|
img,
|
||||||
height: 10,
|
Divider(),
|
||||||
),
|
SizedBox(
|
||||||
fcsIDBox,
|
height: 10,
|
||||||
namebox,
|
),
|
||||||
SizedBox(
|
fcsIDBox,
|
||||||
height: 20,
|
namebox,
|
||||||
),
|
SizedBox(
|
||||||
_isNew ? createButton : updateButton,
|
height: 20,
|
||||||
SizedBox(
|
),
|
||||||
height: 10,
|
_isNew ? createButton : updateButton,
|
||||||
),
|
SizedBox(
|
||||||
],
|
height: 10,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@@ -216,8 +228,11 @@ class _ReceivingEditorState extends State<ReceivingEditor> {
|
|||||||
Package _p =
|
Package _p =
|
||||||
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
|
Package(trackingID: _trackingIDCtl.text, remark: _remarkCtl.text);
|
||||||
|
|
||||||
if (_p.trackingID == null || _p.trackingID == "") {
|
// if (_p.trackingID == null || _p.trackingID == "") {
|
||||||
showMsgDialog(context, "Error", "Invalid tracking ID!");
|
// showMsgDialog(context, "Error", "Invalid tracking ID!");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
if (!_receiveFormKey.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ class InputDate extends StatelessWidget {
|
|||||||
final TextInputType? textInputType;
|
final TextInputType? textInputType;
|
||||||
final bool autoFocus;
|
final bool autoFocus;
|
||||||
final String dateFormatString;
|
final String dateFormatString;
|
||||||
|
final AutovalidateMode? autovalidateMode;
|
||||||
|
|
||||||
const InputDate(
|
const InputDate(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
@@ -23,6 +24,7 @@ class InputDate extends StatelessWidget {
|
|||||||
required this.iconData,
|
required this.iconData,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.autovalidateMode,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
@@ -126,7 +128,8 @@ class InputDate extends StatelessWidget {
|
|||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: borderColor ?? dangerColor, width: 1.0)),
|
color: borderColor ?? dangerColor, width: 1.0)),
|
||||||
),
|
),
|
||||||
validator: validator),
|
validator: validator,
|
||||||
|
autovalidateMode: autovalidateMode,),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class InputText extends StatelessWidget {
|
|||||||
final IconData? iconData;
|
final IconData? iconData;
|
||||||
final TextEditingController? controller;
|
final TextEditingController? controller;
|
||||||
final FormFieldValidator<String>? validator;
|
final FormFieldValidator<String>? validator;
|
||||||
|
final AutovalidateMode? autovalidateMode;
|
||||||
final int maxLines;
|
final int maxLines;
|
||||||
final bool withBorder;
|
final bool withBorder;
|
||||||
final Color? borderColor;
|
final Color? borderColor;
|
||||||
@@ -26,6 +27,7 @@ class InputText extends StatelessWidget {
|
|||||||
this.iconData,
|
this.iconData,
|
||||||
this.controller,
|
this.controller,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.autovalidateMode,
|
||||||
this.maxLines = 1,
|
this.maxLines = 1,
|
||||||
this.withBorder = false,
|
this.withBorder = false,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
@@ -114,7 +116,8 @@ class InputText extends StatelessWidget {
|
|||||||
borderSide: BorderSide(
|
borderSide: BorderSide(
|
||||||
color: borderColor ?? dangerColor, width: 1.0)),
|
color: borderColor ?? dangerColor, width: 1.0)),
|
||||||
),
|
),
|
||||||
validator: validator),
|
validator: validator,
|
||||||
|
autovalidateMode: autovalidateMode,),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user