mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 01:28:56 +03:30
Fix some issue
This commit is contained in:
@@ -36,6 +36,7 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
|
|||||||
|
|
||||||
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
||||||
int curLabelVal = 1;
|
int curLabelVal = 1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
descriptionCTRL.text = '';
|
descriptionCTRL.text = '';
|
||||||
@@ -73,276 +74,296 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
|
|||||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return WillPopScope(
|
return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) {
|
||||||
onWillPop: () async {
|
return WillPopScope(
|
||||||
Navigator.pushReplacementNamed(
|
onWillPop: () async {
|
||||||
context,
|
cyclesProvider.resetLoadingButton();
|
||||||
Routes.cycleResultScreen,
|
Navigator.pushReplacementNamed(
|
||||||
);
|
context,
|
||||||
return true;
|
Routes.cycleResultScreen,
|
||||||
},
|
);
|
||||||
child: SafeArea(
|
return true;
|
||||||
child: GestureDetector(
|
},
|
||||||
onTap: () {
|
child: SafeArea(
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
child: GestureDetector(
|
||||||
},
|
onTap: () {
|
||||||
child: Scaffold(
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
appBar: AppBar(
|
},
|
||||||
titleSpacing: -10,
|
child: Scaffold(
|
||||||
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
|
appBar: AppBar(
|
||||||
backgroundColor: Colors.black,
|
titleSpacing: -10,
|
||||||
leading: IconButton(
|
title: Text(
|
||||||
icon: Icon(
|
'Cycles',
|
||||||
Icons.keyboard_arrow_left,
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
size: 35,
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
cyclesProvider.resetLoadingButton();
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.cycleResultScreen);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context)
|
|
||||||
.pushReplacementNamed(Routes.cycleResultScreen),
|
|
||||||
),
|
),
|
||||||
),
|
body: Consumer<ConnectivityProvider>(
|
||||||
body: Consumer<ConnectivityProvider>(
|
builder: (ct, connection, _) {
|
||||||
builder: (ct, connection, _) {
|
return connection.conStatus != 'offline'
|
||||||
return connection.conStatus != 'offline'
|
? isInit
|
||||||
? isInit
|
? Center(
|
||||||
? Center(
|
child: CircularProgressIndicator(
|
||||||
child: CircularProgressIndicator(
|
color: Colors.black,
|
||||||
color: Colors.black,
|
),
|
||||||
),
|
)
|
||||||
)
|
: Form(
|
||||||
: Form(
|
key: _form,
|
||||||
key: _form,
|
child: Padding(
|
||||||
child: Padding(
|
padding: EdgeInsets.all(20),
|
||||||
padding: EdgeInsets.all(20),
|
child: ListView(
|
||||||
child: ListView(
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Text(
|
||||||
Text(
|
'Add a Cycle',
|
||||||
'Add a Cycle',
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 6 * _deviceBlockSize,
|
|
||||||
letterSpacing: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 8,
|
|
||||||
child: TextFormField(
|
|
||||||
validator: (val) {
|
|
||||||
if (val!.isEmpty) {
|
|
||||||
return 'Strilizer ID required!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: striizerIdCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.sortNumericDown,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Strilizer ID',
|
|
||||||
contentPadding:
|
|
||||||
EdgeInsets.symmetric(
|
|
||||||
vertical: 2,
|
|
||||||
horizontal: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.visiblePassword,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
FocusScope.of(context).requestFocus(
|
|
||||||
_cycleNumberFocusNode);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
scan().then(
|
|
||||||
(String result) {
|
|
||||||
if (result == 'cancel') {
|
|
||||||
print('cancel');
|
|
||||||
} else if (result == 'error') {
|
|
||||||
print('error');
|
|
||||||
} else if (result == 'access') {
|
|
||||||
print('access');
|
|
||||||
} else {
|
|
||||||
print(result);
|
|
||||||
striizerIdCTRL.text = result;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.qr_code_scanner,
|
|
||||||
size: 5 * _deviceBlockSize,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
validator: (val) {
|
|
||||||
if (val!.isEmpty) {
|
|
||||||
return 'Cycle number required!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: cycleNumberCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.sortNumericDown,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Cycle Number',
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
focusNode: _cycleNumberFocusNode,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
FocusScope.of(context)
|
|
||||||
.requestFocus(_descriptionFocosNode);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
CycleAddDatePicker(
|
|
||||||
dateCTRL: dateCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20.0,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.symmetric(vertical: 10),
|
|
||||||
child: Text(
|
|
||||||
'Labels included',
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: kPink,
|
fontWeight: FontWeight.w700,
|
||||||
letterSpacing: 2,
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
flex: 8,
|
||||||
|
child: TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons
|
||||||
|
.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
textInputAction:
|
||||||
|
TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result ==
|
||||||
|
'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result ==
|
||||||
|
'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text =
|
||||||
|
result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
fontSize: 5 * _deviceBlockSize,
|
fontSize: 5 * _deviceBlockSize,
|
||||||
),
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_descriptionFocosNode);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
Consumer<CyclesProvider>(
|
height: 30,
|
||||||
builder: (ctx, cycleProvider, _) =>
|
),
|
||||||
ListView.builder(
|
CycleAddDatePicker(
|
||||||
physics: NeverScrollableScrollPhysics(),
|
dateCTRL: dateCTRL,
|
||||||
shrinkWrap: true,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
itemBuilder: (ctx, index) => AddLabelBox(
|
),
|
||||||
text: 'Select Labels included',
|
SizedBox(
|
||||||
iconColor: kPinkSub,
|
height: 20.0,
|
||||||
deviceBlockSize: _deviceBlockSize,
|
),
|
||||||
values:
|
Container(
|
||||||
cycleProvider.labelValues[index],
|
margin:
|
||||||
vals: cycleProvider.labelVals,
|
EdgeInsets.symmetric(vertical: 10),
|
||||||
initialLabelValue:
|
child: Text(
|
||||||
cycleProvider.initialLabelValue,
|
'Labels included',
|
||||||
index: index,
|
style: TextStyle(
|
||||||
hasRemoveButton:
|
color: kPink,
|
||||||
cycleProvider.labelValues.length > 1
|
letterSpacing: 2,
|
||||||
? true
|
fontSize: 5 * _deviceBlockSize,
|
||||||
: false,
|
),
|
||||||
),
|
),
|
||||||
itemCount:
|
|
||||||
cycleProvider.labelValues.length,
|
|
||||||
),
|
),
|
||||||
),
|
Consumer<CyclesProvider>(
|
||||||
SizedBox(
|
builder: (ctx, cycleProvider, _) =>
|
||||||
height: 30,
|
ListView.builder(
|
||||||
),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
TextFormField(
|
shrinkWrap: true,
|
||||||
controller: descriptionCTRL,
|
itemBuilder: (ctx, index) =>
|
||||||
decoration: InputDecoration(
|
AddLabelBox(
|
||||||
icon: Icon(
|
text: 'Select Labels included',
|
||||||
FontAwesomeIcons.alignLeft,
|
iconColor: kPinkSub,
|
||||||
size: 7 * _deviceBlockSize,
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values:
|
||||||
|
cycleProvider.labelValues[index],
|
||||||
|
vals: cycleProvider.labelVals,
|
||||||
|
initialLabelValue:
|
||||||
|
cycleProvider.initialLabelValue,
|
||||||
|
index: index,
|
||||||
|
hasRemoveButton:
|
||||||
|
cycleProvider.labelValues.length >
|
||||||
|
1
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
),
|
||||||
|
itemCount:
|
||||||
|
cycleProvider.labelValues.length,
|
||||||
),
|
),
|
||||||
labelStyle: TextStyle(
|
),
|
||||||
fontWeight: FontWeight.w100,
|
SizedBox(
|
||||||
fontSize: 4 * _deviceBlockSize,
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
),
|
),
|
||||||
isDense: true,
|
style: TextStyle(
|
||||||
labelText: 'Description',
|
fontWeight: FontWeight.w700,
|
||||||
contentPadding: EdgeInsets.symmetric(
|
fontSize: 5 * _deviceBlockSize,
|
||||||
vertical: 2, horizontal: 3),
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocosNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
),
|
),
|
||||||
style: TextStyle(
|
SizedBox(
|
||||||
fontWeight: FontWeight.w700,
|
height: 70,
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.multiline,
|
CycleAddSaveButton(
|
||||||
focusNode: _descriptionFocosNode,
|
form: _form,
|
||||||
minLines: 1,
|
labelValues: Provider.of<CyclesProvider>(
|
||||||
maxLines: 5,
|
context,
|
||||||
),
|
listen: false,
|
||||||
SizedBox(
|
).labelValues,
|
||||||
height: 70,
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
),
|
dateValue: dateCTRL.text,
|
||||||
CycleAddSaveButton(
|
descriptionCTRL: descriptionCTRL,
|
||||||
form: _form,
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
labelValues: Provider.of<CyclesProvider>(
|
deviceBlockSize: _deviceBlockSize,
|
||||||
context,
|
),
|
||||||
listen: false,
|
SizedBox(
|
||||||
).labelValues,
|
height: 100,
|
||||||
cycleNumberCTRL: cycleNumberCTRL,
|
),
|
||||||
dateValue: dateCTRL.text,
|
],
|
||||||
descriptionCTRL: descriptionCTRL,
|
),
|
||||||
striizerIdCTRL: striizerIdCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 100,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
)
|
: ConnectionErrorBox();
|
||||||
: ConnectionErrorBox();
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,11 +31,13 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
|
|||||||
|
|
||||||
final _form = GlobalKey<FormState>();
|
final _form = GlobalKey<FormState>();
|
||||||
bool isInit = true;
|
bool isInit = true;
|
||||||
|
|
||||||
// String? packageId;
|
// String? packageId;
|
||||||
// String? previousRoute;
|
// String? previousRoute;
|
||||||
|
|
||||||
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
List<TextEditingController> labelsCTRL = [TextEditingController()];
|
||||||
int curLabelVal = 1;
|
int curLabelVal = 1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
sDateCTRL.text = DateEditor.DateFormat('y-M-d').format(DateTime.now());
|
||||||
@@ -72,291 +74,317 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
|
|||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
// String initialLabelValue;
|
// String initialLabelValue;
|
||||||
return WillPopScope(
|
return Consumer<LabelsProvider>(
|
||||||
onWillPop: () async {
|
builder: (context, labelsProvider, _) {
|
||||||
Navigator.pushReplacementNamed(
|
return WillPopScope(
|
||||||
context,
|
onWillPop: () async {
|
||||||
Routes.labelResultScreen,
|
labelsProvider.resetLoadingButton();
|
||||||
);
|
Navigator.pushReplacementNamed(
|
||||||
return true;
|
context,
|
||||||
},
|
Routes.labelResultScreen,
|
||||||
child: SafeArea(
|
);
|
||||||
child: GestureDetector(
|
return true;
|
||||||
onTap: () {
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: SafeArea(
|
||||||
appBar: AppBar(
|
child: GestureDetector(
|
||||||
titleSpacing: -10,
|
onTap: () {
|
||||||
title: Text('Labels', style: TextStyle(color: Colors.white,),),
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
backgroundColor: Colors.black,
|
},
|
||||||
leading: IconButton(
|
child: Scaffold(
|
||||||
icon: Icon(
|
appBar: AppBar(
|
||||||
Icons.keyboard_arrow_left,
|
titleSpacing: -10,
|
||||||
color: Colors.white,
|
title: Text(
|
||||||
size: 35,
|
'Labels',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
labelsProvider.resetLoadingButton();
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.labelResultScreen);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context)
|
body: Consumer<ConnectivityProvider>(
|
||||||
.pushReplacementNamed(Routes.labelResultScreen),
|
builder: (ct, connection, _) {
|
||||||
),
|
return connection.conStatus != 'offline'
|
||||||
),
|
? isInit
|
||||||
body: Consumer<ConnectivityProvider>(
|
? Center(
|
||||||
builder: (ct, connection, _) {
|
child: CircularProgressIndicator(
|
||||||
return connection.conStatus != 'offline'
|
color: Colors.black,
|
||||||
? isInit
|
),
|
||||||
? Center(
|
)
|
||||||
child: CircularProgressIndicator(
|
: Form(
|
||||||
color: Colors.black,
|
key: _form,
|
||||||
),
|
child: Padding(
|
||||||
)
|
padding: EdgeInsets.all(20),
|
||||||
: Form(
|
child: ListView(
|
||||||
key: _form,
|
children: <Widget>[
|
||||||
child: Padding(
|
Text(
|
||||||
padding: EdgeInsets.all(20),
|
'Add a Label',
|
||||||
child: ListView(
|
style: TextStyle(
|
||||||
children: <Widget>[
|
fontWeight: FontWeight.w700,
|
||||||
Text(
|
fontSize: 6 * _deviceBlockSize,
|
||||||
'Add a Label',
|
letterSpacing: 3,
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 6 * _deviceBlockSize,
|
|
||||||
letterSpacing: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 8,
|
|
||||||
child: TextFormField(
|
|
||||||
onChanged: (val) {
|
|
||||||
setState(() {
|
|
||||||
lotNumberCTRL.text = val +
|
|
||||||
' - ' +
|
|
||||||
cycleNumberCTRL.text;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
validator: (val) {
|
|
||||||
if (val!.isEmpty) {
|
|
||||||
return 'Strilizer ID required!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: striizerIdCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons
|
|
||||||
.sortNumericDown,
|
|
||||||
size: 7 * _deviceBlockSize),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Strilizer ID',
|
|
||||||
contentPadding:
|
|
||||||
EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
keyboardType:
|
|
||||||
TextInputType.visiblePassword,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
FocusScope.of(context).requestFocus(
|
|
||||||
_cycleNumberFocusNode);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
SizedBox(
|
||||||
flex: 1,
|
height: 20,
|
||||||
child: InkWell(
|
),
|
||||||
onTap: () {
|
Row(
|
||||||
scan().then(
|
children: [
|
||||||
(String result) {
|
Flexible(
|
||||||
if (result == 'cancel') {
|
flex: 8,
|
||||||
print('cancel');
|
child: TextFormField(
|
||||||
} else if (result == 'error') {
|
onChanged: (val) {
|
||||||
print('error');
|
setState(() {
|
||||||
} else if (result == 'access') {
|
lotNumberCTRL.text = val +
|
||||||
print('access');
|
' - ' +
|
||||||
} else {
|
cycleNumberCTRL.text;
|
||||||
print(result);
|
});
|
||||||
striizerIdCTRL.text = result;
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Strilizer ID required!';
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: striizerIdCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons
|
||||||
|
.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Strilizer ID',
|
||||||
|
contentPadding:
|
||||||
|
EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize:
|
||||||
|
4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
textInputAction:
|
||||||
|
TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context)
|
||||||
|
.requestFocus(
|
||||||
|
_cycleNumberFocusNode);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.qr_code_scanner,
|
|
||||||
size: 5 * _deviceBlockSize,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Flexible(
|
||||||
|
flex: 1,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {
|
||||||
|
scan().then(
|
||||||
|
(String result) {
|
||||||
|
if (result == 'cancel') {
|
||||||
|
print('cancel');
|
||||||
|
} else if (result ==
|
||||||
|
'error') {
|
||||||
|
print('error');
|
||||||
|
} else if (result ==
|
||||||
|
'access') {
|
||||||
|
print('access');
|
||||||
|
} else {
|
||||||
|
print(result);
|
||||||
|
striizerIdCTRL.text =
|
||||||
|
result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.qr_code_scanner,
|
||||||
|
size: 5 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
onChanged: (val) {
|
||||||
|
setState(
|
||||||
|
() {
|
||||||
|
lotNumberCTRL.text =
|
||||||
|
striizerIdCTRL.text +
|
||||||
|
' - ' +
|
||||||
|
val;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Cycle number required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: cycleNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Cycle Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
),
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
focusNode: _cycleNumberFocusNode,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
readOnly: true,
|
||||||
|
controller: lotNumberCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.sortNumericDown,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Lot Number',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType:
|
||||||
|
TextInputType.visiblePassword,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.symmetric(vertical: 10),
|
||||||
|
child: Text(
|
||||||
|
'Packages included',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kLightBlue,
|
||||||
|
letterSpacing: 2,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Consumer<LabelsProvider>(
|
||||||
|
builder: (ctx, labelProvider, _) {
|
||||||
|
return ListView.builder(
|
||||||
|
physics:
|
||||||
|
NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (ctx, index) =>
|
||||||
|
AddPackageBox(
|
||||||
|
text: 'Package ID',
|
||||||
|
iconColor: kLightBlueSub,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values: labelProvider
|
||||||
|
.packageValues[index],
|
||||||
|
vals: labelProvider.packageVals,
|
||||||
|
initialLabelValue: labelProvider
|
||||||
|
.initialPackageValue,
|
||||||
|
index: index,
|
||||||
|
),
|
||||||
|
itemCount: labelProvider
|
||||||
|
.packageValues.length,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: sDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Sterile Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
LabelAddDatePicker(
|
||||||
|
dateCTRL: eDateCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
label: 'Expire Date',
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
LabelAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
lotNumberCTRL: lotNumberCTRL,
|
||||||
|
cycleNumberCTRL: cycleNumberCTRL,
|
||||||
|
sDateCTRL: sDateCTRL,
|
||||||
|
packageValue:
|
||||||
|
Provider.of<LabelsProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).packageValues,
|
||||||
|
eDateCTRL: eDateCTRL,
|
||||||
|
striizerIdCTRL: striizerIdCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(
|
),
|
||||||
height: 20,
|
)
|
||||||
),
|
: ConnectionErrorBox();
|
||||||
TextFormField(
|
},
|
||||||
onChanged: (val) {
|
),
|
||||||
setState(
|
),
|
||||||
() {
|
|
||||||
lotNumberCTRL.text =
|
|
||||||
striizerIdCTRL.text + ' - ' + val;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
validator: (val) {
|
|
||||||
if (val!.isEmpty) {
|
|
||||||
return 'Cycle number required!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: cycleNumberCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.sortNumericDown,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Cycle Number',
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
focusNode: _cycleNumberFocusNode,
|
|
||||||
keyboardType: TextInputType.number,
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
readOnly: true,
|
|
||||||
controller: lotNumberCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.sortNumericDown,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Lot Number',
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2,
|
|
||||||
horizontal: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.symmetric(vertical: 10),
|
|
||||||
child: Text(
|
|
||||||
'Packages included',
|
|
||||||
style: TextStyle(
|
|
||||||
color: kLightBlue,
|
|
||||||
letterSpacing: 2,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Consumer<LabelsProvider>(
|
|
||||||
builder: (ctx, labelProvider, _) {
|
|
||||||
return ListView.builder(
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemBuilder: (ctx, index) =>
|
|
||||||
AddPackageBox(
|
|
||||||
text: 'Package ID',
|
|
||||||
iconColor: kLightBlueSub,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
values:
|
|
||||||
labelProvider.packageValues[index],
|
|
||||||
vals: labelProvider.packageVals,
|
|
||||||
initialLabelValue:
|
|
||||||
labelProvider.initialPackageValue,
|
|
||||||
index: index,
|
|
||||||
),
|
|
||||||
itemCount:
|
|
||||||
labelProvider.packageValues.length,
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
LabelAddDatePicker(
|
|
||||||
dateCTRL: sDateCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
label: 'Sterile Date',
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
LabelAddDatePicker(
|
|
||||||
dateCTRL: eDateCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
label: 'Expire Date',
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 70,
|
|
||||||
),
|
|
||||||
LabelAddSaveButton(
|
|
||||||
form: _form,
|
|
||||||
lotNumberCTRL: lotNumberCTRL,
|
|
||||||
cycleNumberCTRL: cycleNumberCTRL,
|
|
||||||
sDateCTRL: sDateCTRL,
|
|
||||||
packageValue: Provider.of<LabelsProvider>(
|
|
||||||
context,
|
|
||||||
listen: false,
|
|
||||||
).packageValues,
|
|
||||||
eDateCTRL: eDateCTRL,
|
|
||||||
striizerIdCTRL: striizerIdCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 100,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ConnectionErrorBox();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
|
|||||||
final _packageUdiFocusNode = FocusNode();
|
final _packageUdiFocusNode = FocusNode();
|
||||||
final _descriptionFocusNode = FocusNode();
|
final _descriptionFocusNode = FocusNode();
|
||||||
TextEditingController descriptionCTRL = new TextEditingController();
|
TextEditingController descriptionCTRL = new TextEditingController();
|
||||||
|
|
||||||
// TextEditingController udiCTRL = new TextEditingController();
|
// TextEditingController udiCTRL = new TextEditingController();
|
||||||
TextEditingController nameCTRL = new TextEditingController();
|
TextEditingController nameCTRL = new TextEditingController();
|
||||||
TextEditingController dateCTRL = new TextEditingController();
|
TextEditingController dateCTRL = new TextEditingController();
|
||||||
@@ -30,6 +31,7 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
|
|||||||
PackageFilterObject? filters;
|
PackageFilterObject? filters;
|
||||||
|
|
||||||
int curLabelVal = 1;
|
int curLabelVal = 1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
descriptionCTRL.text = '';
|
descriptionCTRL.text = '';
|
||||||
@@ -62,234 +64,246 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
|
|||||||
final _media = MediaQuery.of(context);
|
final _media = MediaQuery.of(context);
|
||||||
final double _devicewidth = _media.size.width;
|
final double _devicewidth = _media.size.width;
|
||||||
final double _deviceBlockSize = _devicewidth / 100;
|
final double _deviceBlockSize = _devicewidth / 100;
|
||||||
return WillPopScope(
|
return Consumer<PackageProvider>(
|
||||||
onWillPop: () async {
|
builder: (context, packageProvider, _) {
|
||||||
Navigator.pushReplacementNamed(
|
return WillPopScope(
|
||||||
context,
|
onWillPop: () async {
|
||||||
Routes.packageResultScreen,
|
packageProvider.resetLoadingButton();
|
||||||
);
|
Navigator.pushReplacementNamed(
|
||||||
return true;
|
context,
|
||||||
},
|
Routes.packageResultScreen,
|
||||||
child: SafeArea(
|
);
|
||||||
child: GestureDetector(
|
return true;
|
||||||
onTap: () {
|
|
||||||
FocusManager.instance.primaryFocus?.unfocus();
|
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: SafeArea(
|
||||||
appBar: AppBar(
|
child: GestureDetector(
|
||||||
titleSpacing: -10,
|
onTap: () {
|
||||||
title: Text(
|
FocusManager.instance.primaryFocus?.unfocus();
|
||||||
'Packages',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: Colors.black,
|
|
||||||
leading: IconButton(
|
|
||||||
icon: Icon(
|
|
||||||
Icons.keyboard_arrow_left,
|
|
||||||
color: Colors.white,
|
|
||||||
size: 35,
|
|
||||||
),
|
|
||||||
onPressed: () => Navigator.of(context)
|
|
||||||
.pushReplacementNamed(Routes.packageResultScreen),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
body: Consumer<ConnectivityProvider>(
|
|
||||||
builder: (ct, connection, _) {
|
|
||||||
return connection.conStatus != 'offline'
|
|
||||||
? isInit
|
|
||||||
? Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Form(
|
|
||||||
key: _form,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.all(20),
|
|
||||||
child: ListView(
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Add a Package',
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 6 * _deviceBlockSize,
|
|
||||||
letterSpacing: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
validator: (val) {
|
|
||||||
if (val!.isEmpty) {
|
|
||||||
return 'Name required!';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
controller: nameCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.alignLeft,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Package Name',
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2,
|
|
||||||
horizontal: 3,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.text,
|
|
||||||
textInputAction: TextInputAction.next,
|
|
||||||
onFieldSubmitted: (_) {
|
|
||||||
FocusScope.of(context)
|
|
||||||
.requestFocus(_packageUdiFocusNode);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
// TextFormField(
|
|
||||||
// validator: (val) {
|
|
||||||
// if (val!.isEmpty) {
|
|
||||||
// return 'UDI required!';
|
|
||||||
// }
|
|
||||||
// return null;
|
|
||||||
// },
|
|
||||||
// controller: udiCTRL,
|
|
||||||
// decoration: InputDecoration(
|
|
||||||
// icon: Icon(
|
|
||||||
// FontAwesomeIcons.alignLeft,
|
|
||||||
// size: 7 * _deviceBlockSize,
|
|
||||||
// ),
|
|
||||||
// labelStyle: TextStyle(
|
|
||||||
// fontWeight: FontWeight.w100,
|
|
||||||
// fontSize: 4 * _deviceBlockSize,
|
|
||||||
// ),
|
|
||||||
// isDense: true,
|
|
||||||
// labelText: 'UDI',
|
|
||||||
// contentPadding: EdgeInsets.symmetric(
|
|
||||||
// vertical: 2, horizontal: 3),
|
|
||||||
// ),
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontWeight: FontWeight.w700,
|
|
||||||
// fontSize: 5 * _deviceBlockSize,
|
|
||||||
// ),
|
|
||||||
// focusNode: _packageUdiFocusNode,
|
|
||||||
// keyboardType: TextInputType.visiblePassword,
|
|
||||||
// textInputAction: TextInputAction.next,
|
|
||||||
// onFieldSubmitted: (_) {
|
|
||||||
// FocusScope.of(context)
|
|
||||||
// .requestFocus(_descriptionFocusNode);
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// SizedBox(
|
|
||||||
// height: 20,
|
|
||||||
// ),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.symmetric(vertical: 5),
|
|
||||||
child: Text(
|
|
||||||
'Items included',
|
|
||||||
style: TextStyle(
|
|
||||||
color: kPurple,
|
|
||||||
letterSpacing: 2,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Consumer<PackageProvider>(
|
|
||||||
builder: (ctx, packageProvider, _) =>
|
|
||||||
ListView.builder(
|
|
||||||
physics: NeverScrollableScrollPhysics(),
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemBuilder: (ctx, index) => AddItemBox(
|
|
||||||
text: 'Select Items Included',
|
|
||||||
iconColor: kPurpleSub,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
values:
|
|
||||||
packageProvider.itemValues[index],
|
|
||||||
vals: packageProvider.itemVals,
|
|
||||||
initialItemValue:
|
|
||||||
packageProvider.initialItemValue,
|
|
||||||
index: index,
|
|
||||||
// filteredItems:
|
|
||||||
// packageProvider.filteredItems!,
|
|
||||||
hasRemoveButton:
|
|
||||||
packageProvider.itemValues.length >
|
|
||||||
1
|
|
||||||
? true
|
|
||||||
: false,
|
|
||||||
),
|
|
||||||
itemCount:
|
|
||||||
packageProvider.itemValues.length,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 30,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
controller: descriptionCTRL,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
icon: Icon(
|
|
||||||
FontAwesomeIcons.alignLeft,
|
|
||||||
size: 7 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
labelStyle: TextStyle(
|
|
||||||
fontWeight: FontWeight.w100,
|
|
||||||
fontSize: 4 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
isDense: true,
|
|
||||||
labelText: 'Description',
|
|
||||||
contentPadding: EdgeInsets.symmetric(
|
|
||||||
vertical: 2, horizontal: 3),
|
|
||||||
),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.w700,
|
|
||||||
fontSize: 5 * _deviceBlockSize,
|
|
||||||
),
|
|
||||||
keyboardType: TextInputType.multiline,
|
|
||||||
focusNode: _descriptionFocusNode,
|
|
||||||
minLines: 1,
|
|
||||||
maxLines: 5,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 70,
|
|
||||||
),
|
|
||||||
PackageAddSaveButton(
|
|
||||||
form: _form,
|
|
||||||
itemValues: Provider.of<PackageProvider>(
|
|
||||||
context,
|
|
||||||
listen: false,
|
|
||||||
).itemValues,
|
|
||||||
nameCTRL: nameCTRL,
|
|
||||||
// udiCTRL: udiCTRL,
|
|
||||||
dateValue: dateCTRL.text,
|
|
||||||
descriptionCTRL: descriptionCTRL,
|
|
||||||
deviceBlockSize: _deviceBlockSize,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 100,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: ConnectionErrorBox();
|
|
||||||
},
|
},
|
||||||
|
child: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
titleSpacing: -10,
|
||||||
|
title: Text(
|
||||||
|
'Packages',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
leading: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.keyboard_arrow_left,
|
||||||
|
color: Colors.white,
|
||||||
|
size: 35,
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
packageProvider.resetLoadingButton();
|
||||||
|
Navigator.of(context)
|
||||||
|
.pushReplacementNamed(Routes.packageResultScreen);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Consumer<ConnectivityProvider>(
|
||||||
|
builder: (ct, connection, _) {
|
||||||
|
return connection.conStatus != 'offline'
|
||||||
|
? isInit
|
||||||
|
? Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Form(
|
||||||
|
key: _form,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
'Add a Package',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 6 * _deviceBlockSize,
|
||||||
|
letterSpacing: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Name required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
controller: nameCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Package Name',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2,
|
||||||
|
horizontal: 3,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
onFieldSubmitted: (_) {
|
||||||
|
FocusScope.of(context).requestFocus(
|
||||||
|
_packageUdiFocusNode);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
// TextFormField(
|
||||||
|
// validator: (val) {
|
||||||
|
// if (val!.isEmpty) {
|
||||||
|
// return 'UDI required!';
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
// },
|
||||||
|
// controller: udiCTRL,
|
||||||
|
// decoration: InputDecoration(
|
||||||
|
// icon: Icon(
|
||||||
|
// FontAwesomeIcons.alignLeft,
|
||||||
|
// size: 7 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
// labelStyle: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w100,
|
||||||
|
// fontSize: 4 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
// isDense: true,
|
||||||
|
// labelText: 'UDI',
|
||||||
|
// contentPadding: EdgeInsets.symmetric(
|
||||||
|
// vertical: 2, horizontal: 3),
|
||||||
|
// ),
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontWeight: FontWeight.w700,
|
||||||
|
// fontSize: 5 * _deviceBlockSize,
|
||||||
|
// ),
|
||||||
|
// focusNode: _packageUdiFocusNode,
|
||||||
|
// keyboardType: TextInputType.visiblePassword,
|
||||||
|
// textInputAction: TextInputAction.next,
|
||||||
|
// onFieldSubmitted: (_) {
|
||||||
|
// FocusScope.of(context)
|
||||||
|
// .requestFocus(_descriptionFocusNode);
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// height: 20,
|
||||||
|
// ),
|
||||||
|
Container(
|
||||||
|
margin:
|
||||||
|
EdgeInsets.symmetric(vertical: 5),
|
||||||
|
child: Text(
|
||||||
|
'Items included',
|
||||||
|
style: TextStyle(
|
||||||
|
color: kPurple,
|
||||||
|
letterSpacing: 2,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Consumer<PackageProvider>(
|
||||||
|
builder: (ctx, packageProvider, _) =>
|
||||||
|
ListView.builder(
|
||||||
|
physics:
|
||||||
|
NeverScrollableScrollPhysics(),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemBuilder: (ctx, index) =>
|
||||||
|
AddItemBox(
|
||||||
|
text: 'Select Items Included',
|
||||||
|
iconColor: kPurpleSub,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
values: packageProvider
|
||||||
|
.itemValues[index],
|
||||||
|
vals: packageProvider.itemVals,
|
||||||
|
initialItemValue: packageProvider
|
||||||
|
.initialItemValue,
|
||||||
|
index: index,
|
||||||
|
// filteredItems:
|
||||||
|
// packageProvider.filteredItems!,
|
||||||
|
hasRemoveButton: packageProvider
|
||||||
|
.itemValues.length >
|
||||||
|
1
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
),
|
||||||
|
itemCount:
|
||||||
|
packageProvider.itemValues.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 30,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
controller: descriptionCTRL,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
icon: Icon(
|
||||||
|
FontAwesomeIcons.alignLeft,
|
||||||
|
size: 7 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
labelStyle: TextStyle(
|
||||||
|
fontWeight: FontWeight.w100,
|
||||||
|
fontSize: 4 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
isDense: true,
|
||||||
|
labelText: 'Description',
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
vertical: 2, horizontal: 3),
|
||||||
|
),
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
fontSize: 5 * _deviceBlockSize,
|
||||||
|
),
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
focusNode: _descriptionFocusNode,
|
||||||
|
minLines: 1,
|
||||||
|
maxLines: 5,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
),
|
||||||
|
PackageAddSaveButton(
|
||||||
|
form: _form,
|
||||||
|
itemValues:
|
||||||
|
Provider.of<PackageProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).itemValues,
|
||||||
|
nameCTRL: nameCTRL,
|
||||||
|
// udiCTRL: udiCTRL,
|
||||||
|
dateValue: dateCTRL.text,
|
||||||
|
descriptionCTRL: descriptionCTRL,
|
||||||
|
deviceBlockSize: _deviceBlockSize,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ConnectionErrorBox();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -110,10 +110,11 @@ class CyclesProvider extends ChangeNotifier {
|
|||||||
result.add(label['id'].toString());
|
result.add(label['id'].toString());
|
||||||
// print(hospital['name']);
|
// print(hospital['name']);
|
||||||
}
|
}
|
||||||
|
if (result.isEmpty) result.add("");
|
||||||
labelVals = result;
|
labelVals = result;
|
||||||
initialLabelValue = labelVals[0];
|
initialLabelValue = labelVals[0];
|
||||||
TextEditingController newLbl = new TextEditingController();
|
TextEditingController newLbl = new TextEditingController();
|
||||||
newLbl.text = initialLabelValue;
|
newLbl.text = "";
|
||||||
labelValues.add(newLbl);
|
labelValues.add(newLbl);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -103,16 +103,17 @@ class LabelsProvider extends ChangeNotifier {
|
|||||||
// "${package['name']} - ${package['package_id'] != null ? package['package_id'] : ''}");
|
// "${package['name']} - ${package['package_id'] != null ? package['package_id'] : ''}");
|
||||||
result.add("${package['id'].toString()} - ${package['name'].toString()}");
|
result.add("${package['id'].toString()} - ${package['name'].toString()}");
|
||||||
}
|
}
|
||||||
|
if (result.isEmpty) result.add("");
|
||||||
packageVals = result;
|
packageVals = result;
|
||||||
initialPackageValue = packageId ?? packageVals[0];
|
initialPackageValue = packageId ?? packageVals[0];
|
||||||
TextEditingController newLbl = new TextEditingController();
|
TextEditingController newLbl = new TextEditingController();
|
||||||
newLbl.text = initialPackageValue;
|
newLbl.text = "";
|
||||||
packageValues.add(newLbl);
|
packageValues.add(newLbl);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> createLabelResult(lotNumber, cycleNumber, sterileDate, packages,
|
Future<void> createLabelResult(lotNumber, cycleNumber, sterileDate, packageId,
|
||||||
expireDate, sterilizerId) async {
|
expireDate, sterilizerId) async {
|
||||||
// List<Map<String, Object>> pkgs = [];
|
// List<Map<String, Object>> pkgs = [];
|
||||||
// for (var package in packages) {
|
// for (var package in packages) {
|
||||||
@@ -126,7 +127,7 @@ class LabelsProvider extends ChangeNotifier {
|
|||||||
'sterilizer_id': sterilizerId,
|
'sterilizer_id': sterilizerId,
|
||||||
'cycle_number': cycleNumber,
|
'cycle_number': cycleNumber,
|
||||||
'lot_number': lotNumber,
|
'lot_number': lotNumber,
|
||||||
'package_id': packages,
|
'package_id': packageId,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
headers: {
|
headers: {
|
||||||
@@ -268,8 +269,8 @@ class LabelsProvider extends ChangeNotifier {
|
|||||||
LabelResultObject(
|
LabelResultObject(
|
||||||
expireDate: item['expire_date'],
|
expireDate: item['expire_date'],
|
||||||
id: item['id'].toString(),
|
id: item['id'].toString(),
|
||||||
package: item['package']['name'],
|
package: item['package'] != null ? item['package']['name'].toString() : ' ',
|
||||||
packageId: item['package']['id'].toString(),
|
packageId: item['package'] != null ? item['package']['id'].toString() : ' ',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -303,8 +304,8 @@ class LabelsProvider extends ChangeNotifier {
|
|||||||
print(data);
|
print(data);
|
||||||
result = LabelDetailsObject(
|
result = LabelDetailsObject(
|
||||||
id: data['id'].toString(),
|
id: data['id'].toString(),
|
||||||
package: data['package']['name'] != null ? data['package']['name'] : '',
|
package: data['package'] != null ? data['package']['name'] : '',
|
||||||
packageId: data['package']['id'].toString() != 'null'
|
packageId: data['package'] != null
|
||||||
? data['package']['id'].toString()
|
? data['package']['id'].toString()
|
||||||
: '',
|
: '',
|
||||||
hospitalName: data['user']['medical_center']['name'],
|
hospitalName: data['user']['medical_center']['name'],
|
||||||
|
|||||||
@@ -112,6 +112,12 @@ class AddLabelBox extends StatelessWidget {
|
|||||||
const EdgeInsets.symmetric(horizontal: 0),
|
const EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: values,
|
controller: values,
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Label required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.only(
|
contentPadding: EdgeInsets.only(
|
||||||
bottom: 12,
|
bottom: 12,
|
||||||
|
|||||||
@@ -49,23 +49,6 @@ class CycleAddSaveButton extends StatelessWidget {
|
|||||||
descriptionCTRL.text,
|
descriptionCTRL.text,
|
||||||
striizerIdCTRL.text,
|
striizerIdCTRL.text,
|
||||||
);
|
);
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (ctx) => AlertDialog(
|
|
||||||
content: Text('Cycle added.'),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(ctx).pop();
|
|
||||||
},
|
|
||||||
child: Text('Ok'),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).then((_) {
|
|
||||||
Navigator.of(context)
|
|
||||||
.pushReplacementNamed(Routes.cycleResultScreen);
|
|
||||||
});
|
|
||||||
Navigator.of(context).pushReplacementNamed(Routes.cycleResultScreen);
|
Navigator.of(context).pushReplacementNamed(Routes.cycleResultScreen);
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg: "Cycle added.",
|
msg: "Cycle added.",
|
||||||
|
|||||||
@@ -109,6 +109,12 @@ class AddPackageBox extends StatelessWidget {
|
|||||||
const EdgeInsets.symmetric(horizontal: 0),
|
const EdgeInsets.symmetric(horizontal: 0),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
controller: values,
|
controller: values,
|
||||||
|
validator: (val) {
|
||||||
|
if (val!.isEmpty) {
|
||||||
|
return 'Package required!';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
contentPadding: EdgeInsets.only(
|
contentPadding: EdgeInsets.only(
|
||||||
bottom: 12,
|
bottom: 12,
|
||||||
|
|||||||
@@ -39,10 +39,9 @@ class LabelAddSaveButton extends StatelessWidget {
|
|||||||
if (!_form.currentState!.validate()) {
|
if (!_form.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> packages = [];
|
int packageId;
|
||||||
for (TextEditingController package in packageValue) {
|
var pacagecValues = packageValue[0].text.split(" ");
|
||||||
packages.add(package.text);
|
packageId = int.parse(pacagecValues[0]);
|
||||||
}
|
|
||||||
await Provider.of<LabelsProvider>(context, listen: false)
|
await Provider.of<LabelsProvider>(context, listen: false)
|
||||||
.createLabelResult(
|
.createLabelResult(
|
||||||
lotNumberCTRL.text,
|
lotNumberCTRL.text,
|
||||||
@@ -50,7 +49,7 @@ class LabelAddSaveButton extends StatelessWidget {
|
|||||||
sDateCTRL.text,
|
sDateCTRL.text,
|
||||||
// sDateValue,
|
// sDateValue,
|
||||||
// {'id': packageValue[0], 'name': packageValue[1]},
|
// {'id': packageValue[0], 'name': packageValue[1]},
|
||||||
packages[0],
|
packageId,
|
||||||
eDateCTRL.text,
|
eDateCTRL.text,
|
||||||
// eDateValue,
|
// eDateValue,
|
||||||
striizerIdCTRL.text,
|
striizerIdCTRL.text,
|
||||||
|
|||||||
Reference in New Issue
Block a user