beta commit

This commit is contained in:
Odein
2023-10-26 15:04:34 +04:30
parent ddc5649b1c
commit 11f910bb1c
262 changed files with 31865 additions and 15718 deletions
@@ -0,0 +1,212 @@
import 'package:cssd/providers/labels.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 AddPackageBox extends StatelessWidget {
const AddPackageBox({
Key? key,
required double deviceBlockSize,
required this.values,
required this.vals,
required this.initialLabelValue,
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 initialLabelValue;
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<LabelsProvider>(context,
listen: false)
.changePackageVal(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<LabelsProvider>(context,
listen: false)
.changePackageVal(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<LabelsProvider>(context).addPackageVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.add,
color: Colors.white,
),
),
),
),
],
),
);
}
}
+73 -73
View File
@@ -1,73 +1,73 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor;
class LabelAddDatePicker extends StatefulWidget {
LabelAddDatePicker({
Key key,
@required this.dateCTRL,
@required double deviceBlockSize,
@required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final TextEditingController dateCTRL;
final double _deviceBlockSize;
final String _label;
@override
_LabelAddDatePickerState createState() => _LabelAddDatePickerState();
}
class _LabelAddDatePickerState extends State<LabelAddDatePicker> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
var res = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2010, 1),
lastDate: DateTime(2101),
);
if (res != null) {
setState(
() {
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
// sDateValue =
// DateEditor.DateFormat('y-M-d').format(
// dateTimeS,
// ); // baraye tavize makane gharar giri baraye api
},
);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: TextField(
enabled: false,
controller: widget.dateCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.calendarAlt,
size: 7 * widget._deviceBlockSize,
),
labelText: widget._label,
isDense: true,
contentPadding: EdgeInsets.only(bottom: 7, right: 3, left: 3),
// border: InputBorder.none,
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
),
),
Icon(FontAwesomeIcons.angleDown)
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor;
class LabelAddDatePicker extends StatefulWidget {
LabelAddDatePicker({
Key? key,
required this.dateCTRL,
required double deviceBlockSize,
required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final TextEditingController dateCTRL;
final double _deviceBlockSize;
final String _label;
@override
_LabelAddDatePickerState createState() => _LabelAddDatePickerState();
}
class _LabelAddDatePickerState extends State<LabelAddDatePicker> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
var res = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2010, 1),
lastDate: DateTime(2101),
);
if (res != null) {
setState(
() {
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
// sDateValue =
// DateEditor.DateFormat('y-M-d').format(
// dateTimeS,
// ); // baraye tavize makane gharar giri baraye api
},
);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: TextField(
enabled: false,
controller: widget.dateCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.calendarAlt,
size: 7 * widget._deviceBlockSize,
),
labelText: widget._label,
isDense: true,
contentPadding: EdgeInsets.only(bottom: 7, right: 3, left: 3),
// border: InputBorder.none,
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
),
),
Icon(FontAwesomeIcons.angleDown)
],
),
);
}
}
+92 -91
View File
@@ -1,91 +1,92 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../config/routes.dart';
import '../../../providers/labels.dart';
class LabelAddSaveButton extends StatelessWidget {
const LabelAddSaveButton({
Key key,
@required GlobalKey<FormState> form,
@required this.lotNumberCTRL,
@required this.cycleNumberCTRL,
@required this.sDateCTRL,
@required this.packageValue,
@required this.eDateCTRL,
@required this.striizerIdCTRL,
@required double deviceBlockSize,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!_form.currentState.validate()) {
return;
}
Provider.of<LabelsProvider>(context).createLabelResult(
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
// sDateValue,
{'id': packageValue[0], 'name': packageValue[1]},
eDateCTRL.text,
// eDateValue,
striizerIdCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Label added.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'SAVE',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}
import 'package:cssd/config/colors.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../config/routes.dart';
import '../../../providers/labels.dart';
class LabelAddSaveButton extends StatelessWidget {
const LabelAddSaveButton({
Key? key,
required GlobalKey<FormState> form,
required this.lotNumberCTRL,
required this.cycleNumberCTRL,
required this.sDateCTRL,
required this.packageValue,
required this.eDateCTRL,
required this.striizerIdCTRL,
required double deviceBlockSize,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
Provider.of<LabelsProvider>(context, listen: false).createLabelResult(
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
// sDateValue,
{'id': packageValue[0], 'name': packageValue[1]},
eDateCTRL.text,
// eDateValue,
striizerIdCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Label added.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kLightBlue, kLightBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}
+149 -144
View File
@@ -1,144 +1,149 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class LabelAddSelectorBox extends StatefulWidget {
const LabelAddSelectorBox({
Key key,
@required double deviceBlockSize,
@required this.packageCTRL,
@required this.packageVals,
@required this.packageValue,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
final TextEditingController packageCTRL;
final List<Map<String, String>> packageVals;
final List<String> packageValue;
@override
_LabelAddSelectorBoxState createState() => _LabelAddSelectorBoxState();
}
class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
@override
Widget build(BuildContext context) {
return 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 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: widget._deviceBlockSize,
),
Text(
'Package',
style: TextStyle(
fontSize: 3.5 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w700),
),
],
),
Container(
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding:
EdgeInsets.only(left: widget._deviceBlockSize),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.packageCTRL.text,
textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
// Container(
// // width: 100,
// height: 70,
// padding: const EdgeInsets.symmetric(horizontal: 0),
// child: TextFormField(
// controller: widget.packageCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// fontSize: 5 * widget._deviceBlockSize,
// ),
// ),
// ),
isDense: true,
items: widget.packageVals.map((val) {
return new DropdownMenuItem<String>(
value: val['name'],
child: Container(
child: Text(
val['name'],
textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
widget.packageValue[1] = val;
widget.packageCTRL.text = val;
widget.packageVals.forEach((package) {
if (package['name'] == val) {
widget.packageValue[0] = package['id'];
}
});
});
},
),
),
]),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class LabelAddSelectorBox extends StatefulWidget {
const LabelAddSelectorBox({
Key? key,
required double deviceBlockSize,
required this.packageCTRL,
required this.packageVals,
required this.packageValue,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
final TextEditingController packageCTRL;
final List<Map<String, String>> packageVals;
final List<String> packageValue;
@override
_LabelAddSelectorBoxState createState() => _LabelAddSelectorBoxState();
}
class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
@override
Widget build(BuildContext context) {
return 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 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: widget._deviceBlockSize,
),
Text(
'Package',
style: TextStyle(
fontSize: 3.5 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w700),
),
],
),
Container(
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding:
EdgeInsets.only(left: widget._deviceBlockSize),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.packageCTRL.text,
textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
// Container(
// // width: 100,
// height: 70,
// padding: const EdgeInsets.symmetric(horizontal: 0),
// child: TextFormField(
// controller: widget.packageCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// fontSize: 5 * widget._deviceBlockSize,
// ),
// ),
// ),
isDense: true,
items: widget.packageVals.map((val) {
return new DropdownMenuItem<String>(
value: val['name'],
child: Container(
child: Text(
val['name'] ?? '',
textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(
() {
widget.packageValue[1] = val!;
widget.packageCTRL.text = val;
widget.packageVals.forEach(
(package) {
if (package['name'] == val) {
widget.packageValue[0] = package['id'] ?? '';
}
},
);
},
);
},
),
),
],
),
),
],
),
);
}
}
+93 -93
View File
@@ -1,93 +1,93 @@
import '../../../config/routes.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../providers/labels.dart';
class LabelUpdateButton extends StatelessWidget {
const LabelUpdateButton({
Key key,
@required GlobalKey<FormState> form,
@required this.id,
@required this.lotNumberCTRL,
@required this.cycleNumberCTRL,
@required this.sDateCTRL,
@required this.packageValue,
@required this.eDateCTRL,
@required this.striizerIdCTRL,
@required double deviceBlockSize,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final String id;
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!_form.currentState.validate()) {
return;
}
Provider.of<LabelsProvider>(context).updateLabelResult(
id,
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
// sDateValue,
{'id': packageValue[0], 'name': packageValue[1]},
eDateCTRL.text,
// eDateValue,
striizerIdCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Label updated.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'UPDATE',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}
import 'package:cssd/config/colors.dart';
import 'package:provider/provider.dart';
import '../../../config/routes.dart';
import 'package:flutter/material.dart';
import '../../../providers/labels.dart';
class LabelUpdateButton extends StatelessWidget {
const LabelUpdateButton({
Key? key,
required GlobalKey<FormState> form,
required this.id,
required this.lotNumberCTRL,
required this.cycleNumberCTRL,
required this.sDateCTRL,
required this.packageValue,
required this.eDateCTRL,
required this.striizerIdCTRL,
required double deviceBlockSize,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final String id;
final TextEditingController lotNumberCTRL;
final TextEditingController cycleNumberCTRL;
final TextEditingController sDateCTRL;
final List<String> packageValue;
final TextEditingController eDateCTRL;
final TextEditingController striizerIdCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
Provider.of<LabelsProvider>(context, listen: false).updateLabelResult(
id,
lotNumberCTRL.text,
cycleNumberCTRL.text,
sDateCTRL.text,
{'id': packageValue[0]},
eDateCTRL.text,
striizerIdCTRL.text,
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Label updated.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
});
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kLightBlue, kLightBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Update',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}