mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 05:08:53 +03:30
fix bugs!
This commit is contained in:
@@ -33,6 +33,7 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
final batchId = randomString(10);
|
||||
|
||||
int curLabelVal = 1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
descriptionCTRL.text = '';
|
||||
@@ -43,46 +44,62 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _saveForm(String name, String size, String specific, String udi,String description) {
|
||||
void _saveForm(String name, String size, String specific, String udi,
|
||||
String description) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false)
|
||||
.createItemResult(
|
||||
name,
|
||||
size,
|
||||
specific,
|
||||
udi,
|
||||
description,
|
||||
batchId,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) =>
|
||||
Navigator.of(context).popAndPushNamed(Routes.itemResultScreen));
|
||||
} else if (result == 'error') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('error.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false)
|
||||
.createItemResult(
|
||||
name,
|
||||
size,
|
||||
specific,
|
||||
udi,
|
||||
description,
|
||||
batchId,
|
||||
)
|
||||
.then(
|
||||
(result) {
|
||||
setState(() {
|
||||
isLoading = false;
|
||||
});
|
||||
if (result == 'done') {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((value) => Navigator.of(context)
|
||||
.popAndPushNamed(Routes.itemResultScreen));
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -129,7 +146,12 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
titleSpacing: -10,
|
||||
title: Text('Items', style: TextStyle(color: Colors.white,),),
|
||||
title: Text(
|
||||
'Items',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
@@ -360,13 +382,13 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
|
||||
height: 70,
|
||||
),
|
||||
ItemAddSaveButton(
|
||||
onTap: (){
|
||||
onTap: () {
|
||||
_saveForm(
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
);
|
||||
},
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
|
||||
Reference in New Issue
Block a user