This commit is contained in:
HooDie
2023-11-11 19:57:09 +03:30
parent b567d4dac9
commit f43f5cc54f
41 changed files with 1181 additions and 399 deletions
@@ -190,7 +190,8 @@ class AddLabelBox extends StatelessWidget {
right: 0,
child: InkWell(
onTap: () {
Provider.of<CyclesProvider>(context).addLabelVal();
Provider.of<CyclesProvider>(context, listen: false)
.addLabelVal();
},
child: Container(
padding: EdgeInsets.all(3),
@@ -34,7 +34,6 @@ class CycleAddSaveButton extends StatelessWidget {
if (!_form.currentState!.validate()) {
return;
}
List<String> labels = [];
for (TextEditingController label in labelValues) {
labels.add(label.text);
@@ -1,3 +1,4 @@
import 'package:cssd/config/routes.dart';
import 'package:cssd/providers/items.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
@@ -51,6 +52,30 @@ class UploaderImage extends StatelessWidget {
),
),
),
SizedBox(
height: 10,
),
InkWell(
onTap: () async {
await Navigator.of(context)
.pushNamed(Routes.captureImageScreen);
// await captureImage(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
color: Colors.black,
),
child: Text(
'+ Add an image from camera',
textDirection: TextDirection.ltr,
style: TextStyle(color: Colors.white),
textAlign: TextAlign.center,
),
),
),
],
),
),
@@ -120,16 +120,39 @@ class ItemItemBox extends StatelessWidget {
: InkWell(
customBorder: CircleBorder(),
onTap: () {
Provider.of<ItemProvider>(context,
listen: false)
.changeStatus(item!.id)
.then(
(value) {
if (value) {
print('true');
}
Navigator.of(context).popAndPushNamed(
Routes.itemResultScreen);
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
'Do you want to change the status of the item?'),
actions: <Widget>[
TextButton(
onPressed: () {
Provider.of<ItemProvider>(context,
listen: false)
.changeStatus(item!.id)
.then(
(value) {
if (value) {
print('true');
}
Navigator.of(context)
.popAndPushNamed(Routes
.itemResultScreen);
},
);
},
child: Text('Yes'),
),
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('No'),
),
],
);
},
);
},
@@ -185,26 +185,26 @@ class AddPackageBox extends StatelessWidget {
),
),
),
Positioned(
bottom: 15,
right: 0,
child: InkWell(
onTap: () {
Provider.of<LabelsProvider>(context).addPackageVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.add,
color: Colors.white,
),
),
),
),
// Positioned(
// bottom: 15,
// right: 0,
// child: InkWell(
// onTap: () {
// Provider.of<LabelsProvider>(context, listen: false).addPackageVal();
// },
// child: Container(
// padding: EdgeInsets.all(3),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: iconColor,
// ),
// child: Icon(
// Icons.add,
// color: Colors.white,
// ),
// ),
// ),
// ),
],
),
);
@@ -24,7 +24,7 @@ class LabelAddSaveButton extends StatelessWidget {
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final List<TextEditingController> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@@ -36,12 +36,17 @@ class LabelAddSaveButton extends StatelessWidget {
if (!_form.currentState!.validate()) {
return;
}
List<String> packages = [];
for (TextEditingController package in packageValue) {
packages.add(package.text);
}
Provider.of<LabelsProvider>(context, listen: false).createLabelResult(
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
// sDateValue,
{'id': packageValue[0], 'name': packageValue[1]},
// {'id': packageValue[0], 'name': packageValue[1]},
packages,
eDateCTRL.text,
// eDateValue,
striizerIdCTRL.text,
@@ -13,7 +13,7 @@ class LabelUpdateButton extends StatelessWidget {
required this.lotNumberCTRL,
required this.cycleNumberCTRL,
required this.sDateCTRL,
required this.packageValue,
// required this.packageValue,
required this.eDateCTRL,
required this.striizerIdCTRL,
required double deviceBlockSize,
@@ -26,7 +26,7 @@ class LabelUpdateButton extends StatelessWidget {
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
// final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@@ -43,7 +43,7 @@ class LabelUpdateButton extends StatelessWidget {
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
{'id': packageValue[0]},
// {'id': packageValue[0]},
eDateCTRL.text,
striizerIdCTRL.text,
);
@@ -129,33 +129,33 @@ class MyPackageDetailsDataBox extends StatelessWidget {
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'UDI',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.udi.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
// Divider(),
// SizedBox(
// height: 5,
// ),
// Row(
// children: <Widget>[
// Container(
// width: 35 * _deviceBlockSize,
// child: Text(
// 'UDI',
// style: TextStyle(
// color: Colors.grey,
// ),
// ),
// ),
// Container(
// width: 45 * _deviceBlockSize,
// child: Text(
// datas.udi.toString(),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// ),
// overflow: TextOverflow.clip,
// ),
// ),
// ],
// ),
Divider(),
SizedBox(
height: 5,
@@ -10,19 +10,19 @@ class MyPackageFilterChip extends StatelessWidget {
required String label,
required String id,
required String name,
required String udi,
// required String udi,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
_id = id,
_name = name,
_udi = udi,
// _udi = udi,
super(key: key);
final double _deviceBlockSize;
final String _label;
final String _id;
final String _name;
final String _udi;
// final String _udi;
@override
Widget build(BuildContext context) {
@@ -50,7 +50,7 @@ class MyPackageFilterChip extends StatelessWidget {
packageProvider.setFilters(
_id,
_name,
_udi,
// _udi,
);
packageProvider.setLoading();
if (userData['roles']?.contains('User')) {
@@ -7,7 +7,7 @@ class MyPackagesFilterSaveButton extends StatelessWidget {
Key? key,
required this.idCTRL,
required this.nameCTRL,
required this.udiCTRL,
// required this.udiCTRL,
required this.firstColor,
required this.secondColor,
required this.push,
@@ -17,7 +17,7 @@ class MyPackagesFilterSaveButton extends StatelessWidget {
final TextEditingController idCTRL;
final TextEditingController nameCTRL;
final TextEditingController udiCTRL;
// final TextEditingController udiCTRL;
final Color firstColor;
final Color secondColor;
final String push;
@@ -30,7 +30,7 @@ class MyPackagesFilterSaveButton extends StatelessWidget {
Provider.of<MyPackageProvider>(context, listen: false).setFilters(
idCTRL.text,
nameCTRL.text,
udiCTRL.text,
// udiCTRL.text,
);
showDialog(
context: context,
@@ -0,0 +1,213 @@
import 'package:cssd/providers/packages.dart';
import 'package:cssd/utils/scan.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
class AddItemBox extends StatelessWidget {
const AddItemBox({
Key? key,
required double deviceBlockSize,
required this.values,
required this.vals,
required this.initialItemValue,
required this.index,
required this.text,
this.iconColor,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
final TextEditingController values;
final List<String> vals;
final String initialItemValue;
final int index;
final String text;
final Color? iconColor;
@override
Widget build(BuildContext context) {
return Container(
height: 150,
child: Stack(
children: <Widget>[
Container(
padding: EdgeInsets.only(
right: 10,
bottom: 25,
left: 10,
top: 10,
),
decoration: BoxDecoration(
border: Border(
left: BorderSide(color: Colors.black, width: 2),
right: BorderSide(color: Colors.grey),
bottom: BorderSide(color: Colors.grey),
top: BorderSide(color: Colors.grey),
),
),
height: 120,
child: Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 7 * _deviceBlockSize,
),
SizedBox(
width: 4 * _deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: _deviceBlockSize,
),
Text(
text,
style: TextStyle(
fontSize: 3.5 * _deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width -
(40 * _deviceBlockSize),
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: _deviceBlockSize,
),
border: InputBorder.none,
),
iconSize: 7 * _deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding:
const EdgeInsets.symmetric(horizontal: 0),
child: TextFormField(
controller: values,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: 12,
),
isDense: true,
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
),
),
),
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
Provider.of<PackageProvider>(context,
listen: false)
.changeItemVal(val!, index);
},
),
),
Spacer(),
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);
Provider.of<PackageProvider>(context,
listen: false)
.changeItemVal(result, index);
}
},
);
},
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,
),
),
)
],
),
],
),
),
],
),
),
),
Positioned(
bottom: 15,
right: 0,
child: InkWell(
onTap: () {
Provider.of<PackageProvider>(context, listen: false)
.addItemVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.add,
color: Colors.white,
),
),
),
),
],
),
);
}
}
@@ -12,7 +12,7 @@ class PackageAddSaveButton extends StatelessWidget {
required this.itemValues,
required this.nameCTRL,
required this.descriptionCTRL,
required this.udiCTRL,
// required this.udiCTRL,
required this.dateValue,
required double deviceBlockSize,
}) : _form = form,
@@ -23,7 +23,7 @@ class PackageAddSaveButton extends StatelessWidget {
final List<TextEditingController> itemValues;
final TextEditingController nameCTRL;
final TextEditingController descriptionCTRL;
final TextEditingController udiCTRL;
// final TextEditingController udiCTRL;
final String dateValue;
final double _deviceBlockSize;
@@ -34,7 +34,6 @@ class PackageAddSaveButton extends StatelessWidget {
if (!_form.currentState!.validate()) {
return;
}
List<String> items = [];
for (TextEditingController item in itemValues) {
items.add(item.text);
@@ -42,7 +41,7 @@ class PackageAddSaveButton extends StatelessWidget {
Provider.of<PackageProvider>(context, listen: false)
.createPackageResult(
nameCTRL.text,
udiCTRL.text,
// udiCTRL.text,
items,
descriptionCTRL.text,
);
@@ -12,7 +12,7 @@ class PackageUpdateButton extends StatelessWidget {
required this.id,
required this.descriptionCTRL,
required this.nameCTRL,
required this.udiCTRL,
// required this.udiCTRL,
required this.itemCTRL,
required double deviceBlockSize,
}) : _form = form,
@@ -23,7 +23,7 @@ class PackageUpdateButton extends StatelessWidget {
final String id;
final TextEditingController descriptionCTRL;
final TextEditingController nameCTRL;
final TextEditingController udiCTRL;
// final TextEditingController udiCTRL;
final TextEditingController itemCTRL;
final double _deviceBlockSize;
@@ -38,7 +38,7 @@ class PackageUpdateButton extends StatelessWidget {
.updatePackageResult(
id,
nameCTRL.text,
udiCTRL.text,
// udiCTRL.text,
descriptionCTRL.text,
int.parse(itemCTRL.text),
);
@@ -129,33 +129,33 @@ class PackageDetailsDataBox extends StatelessWidget {
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'UDI',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.udi.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
// Row(
// children: <Widget>[
// Container(
// width: 35 * _deviceBlockSize,
// child: Text(
// 'UDI',
// style: TextStyle(
// color: Colors.grey,
// ),
// ),
// ),
// Container(
// width: 45 * _deviceBlockSize,
// child: Text(
// datas.udi.toString(),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// ),
// overflow: TextOverflow.clip,
// ),
// ),
// ],
// ),
// Divider(),
// SizedBox(
// height: 5,
// ),
Row(
children: <Widget>[
Container(
@@ -254,7 +254,25 @@ class PackageDetailsDataBox extends StatelessWidget {
),
SizedBox(
height: 50,
)
),
// TransferDestroyButton(
// deviceBlockSize: _deviceBlockSize,
// firstColor: kPurple,
// secondColor: kPurpleSub,
// onTap: () {
// Navigator.pushNamed(
// context,
// Routes.labelAddScreen,
// arguments: {
// 'id': datas.id,
// },
// );
// },
// text: 'Make a Label For Package',
// ),
// SizedBox(
// height: 5.0,
// ),
],
),
),
@@ -12,7 +12,7 @@ class PackageFilterSaveButton extends StatelessWidget {
required this.hospitalCTRL,
required this.idCTRL,
required this.nameCTRL,
required this.udiCTRL,
// required this.udiCTRL,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
@@ -21,7 +21,7 @@ class PackageFilterSaveButton extends StatelessWidget {
final TextEditingController hospitalCTRL;
final TextEditingController idCTRL;
final TextEditingController nameCTRL;
final TextEditingController udiCTRL;
// final TextEditingController udiCTRL;
final double _deviceBlockSize;
@override
@@ -40,7 +40,7 @@ class PackageFilterSaveButton extends StatelessWidget {
idCTRL.text,
nameCTRL.text,
hospitalID,
udiCTRL.text,
// udiCTRL.text,
);
showDialog(
context: context,
@@ -10,13 +10,13 @@ class PackageFilterChip extends StatelessWidget {
required String id,
required String name,
required String hospital,
required String udi,
// required String udi,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
_id = id,
_name = name,
_hospital = hospital,
_udi = udi,
// _udi = udi,
super(key: key);
final double _deviceBlockSize;
@@ -24,7 +24,7 @@ class PackageFilterChip extends StatelessWidget {
final String _id;
final String _name;
final String _hospital;
final String _udi;
// final String _udi;
@override
Widget build(BuildContext context) {
@@ -52,7 +52,7 @@ class PackageFilterChip extends StatelessWidget {
_id,
_name,
_hospital,
_udi,
// _udi,
);
packageProvider.setLoading();
packageProvider.getPackageResults().then(