Fix some issue

This commit is contained in:
fhkhd
2024-02-13 17:17:42 +03:30
parent c448b695ec
commit d2b81bd4a6
9 changed files with 839 additions and 780 deletions
+276 -255
View File
@@ -36,6 +36,7 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
List<TextEditingController> labelsCTRL = [TextEditingController()];
int curLabelVal = 1;
@override
void initState() {
descriptionCTRL.text = '';
@@ -73,276 +74,296 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope(
onWillPop: () async {
Navigator.pushReplacementNamed(
context,
Routes.cycleResultScreen,
);
return true;
},
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) {
return WillPopScope(
onWillPop: () async {
cyclesProvider.resetLoadingButton();
Navigator.pushReplacementNamed(
context,
Routes.cycleResultScreen,
);
return true;
},
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
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>(
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(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'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',
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(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Add a Cycle',
style: TextStyle(
color: kPink,
letterSpacing: 2,
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);
},
),
),
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) => AddLabelBox(
text: 'Select Labels included',
iconColor: kPinkSub,
deviceBlockSize: _deviceBlockSize,
values:
cycleProvider.labelValues[index],
vals: cycleProvider.labelVals,
initialLabelValue:
cycleProvider.initialLabelValue,
index: index,
hasRemoveButton:
cycleProvider.labelValues.length > 1
? true
: false,
SizedBox(
height: 30,
),
CycleAddDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20.0,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Labels included',
style: TextStyle(
color: kPink,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
itemCount:
cycleProvider.labelValues.length,
),
),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddLabelBox(
text: 'Select Labels included',
iconColor: kPinkSub,
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,
fontSize: 4 * _deviceBlockSize,
),
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),
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
SizedBox(
height: 70,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(
context,
listen: false,
).labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(
context,
listen: false,
).labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
),
)
: ConnectionErrorBox();
},
)
: ConnectionErrorBox();
},
),
),
),
),
),
);
);
});
}
}
+299 -271
View File
@@ -31,11 +31,13 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
final _form = GlobalKey<FormState>();
bool isInit = true;
// String? packageId;
// String? previousRoute;
List<TextEditingController> labelsCTRL = [TextEditingController()];
int curLabelVal = 1;
@override
void initState() {
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 _deviceBlockSize = _devicewidth / 100;
// String initialLabelValue;
return WillPopScope(
onWillPop: () async {
Navigator.pushReplacementNamed(
context,
Routes.labelResultScreen,
);
return true;
},
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
return Consumer<LabelsProvider>(
builder: (context, labelsProvider, _) {
return WillPopScope(
onWillPop: () async {
labelsProvider.resetLoadingButton();
Navigator.pushReplacementNamed(
context,
Routes.labelResultScreen,
);
return true;
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'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)
.pushReplacementNamed(Routes.labelResultScreen),
),
),
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 Label',
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);
},
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 Label',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
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;
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);
},
);
},
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,
),
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();
},
),
)
: ConnectionErrorBox();
},
),
),
),
),
),
),
);
},
);
}
}
+238 -224
View File
@@ -21,6 +21,7 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
final _packageUdiFocusNode = FocusNode();
final _descriptionFocusNode = FocusNode();
TextEditingController descriptionCTRL = new TextEditingController();
// TextEditingController udiCTRL = new TextEditingController();
TextEditingController nameCTRL = new TextEditingController();
TextEditingController dateCTRL = new TextEditingController();
@@ -30,6 +31,7 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
PackageFilterObject? filters;
int curLabelVal = 1;
@override
void initState() {
descriptionCTRL.text = '';
@@ -62,234 +64,246 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return WillPopScope(
onWillPop: () async {
Navigator.pushReplacementNamed(
context,
Routes.packageResultScreen,
);
return true;
},
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
return Consumer<PackageProvider>(
builder: (context, packageProvider, _) {
return WillPopScope(
onWillPop: () async {
packageProvider.resetLoadingButton();
Navigator.pushReplacementNamed(
context,
Routes.packageResultScreen,
);
return true;
},
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: () => 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: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
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();
},
),
),
),
),
),
),
);
},
);
}
}