This commit is contained in:
erfan hayat'bakhsh
2020-09-13 11:49:53 +04:30
parent 641c4ac776
commit 20cc775bc1
27 changed files with 395 additions and 88 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+96 -25
View File
@@ -1,5 +1,7 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
@@ -130,32 +132,77 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
SizedBox(
height: 20,
),
TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
// Spacer(),
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);
cycleIdCTRL.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
@@ -255,3 +302,27 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
);
}
}
Future<String> scan() async {
try {
var barcode = await BarcodeScanner.scan();
if (barcode.type.name == 'Cancelled') {
return 'cancel';
} else if (barcode.type.name == 'Failed') {
return 'error';
}
try {
var id = barcode.rawContent.contains('www.cssd-doc.com')
? barcode.rawContent.split('/')[5]
: barcode.rawContent;
return id;
} catch (_) {
return 'null';
}
} on PlatformException catch (_) {
return 'access';
} catch (_) {
return 'error';
}
}
+94 -25
View File
@@ -1,3 +1,4 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:cssd/config/routes.dart';
import 'package:cssd/models/label_models.dart';
import 'package:cssd/providers/connectivity.dart';
@@ -6,6 +7,7 @@ import 'package:cssd/widgets/Global/internet_error.dart';
import 'package:cssd/widgets/LabelScreens/Filter/save_button.dart';
import 'package:cssd/widgets/LabelScreens/Filter/selector_box.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import 'package:flutter/cupertino.dart';
@@ -122,32 +124,76 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
SizedBox(
height: 20,
),
TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Label ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_cycleNumberFocusNode);
},
),
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Label ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
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);
labelIdCTRl.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
@@ -241,3 +287,26 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
);
}
}
Future<String> scan() async {
try {
var barcode = await BarcodeScanner.scan();
if (barcode.type.name == 'Cancelled') {
return 'cancel';
} else if (barcode.type.name == 'Failed') {
return 'error';
}
try {
var id = barcode.rawContent.contains('www.cssd-doc.com')
? barcode.rawContent.split('/')[5]
: barcode.rawContent;
return id;
} catch (_) {
return 'null';
}
} on PlatformException catch (_) {
return 'access';
} catch (_) {
return 'error';
}
}
+95 -24
View File
@@ -1,5 +1,7 @@
import 'package:barcode_scan/barcode_scan.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
@@ -165,33 +167,78 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
SizedBox(
height: 20,
),
TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'ID',
isDense: true,
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(_cycleNumberFocusNode);
// },
),
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
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);
idCTRL.text = result;
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
labelText: 'ID',
isDense: true,
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(_cycleNumberFocusNode);
// },
],
),
SizedBox(
height: 25,
),
@@ -347,3 +394,27 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
);
}
}
Future<String> scan() async {
try {
var barcode = await BarcodeScanner.scan();
if (barcode.type.name == 'Cancelled') {
return 'cancel';
} else if (barcode.type.name == 'Failed') {
return 'error';
}
try {
var id = barcode.rawContent.contains('www.cssd-doc.com')
? barcode.rawContent.split('/')[5]
: barcode.rawContent;
return id;
} catch (_) {
return 'null';
}
} on PlatformException catch (_) {
return 'access';
} catch (_) {
return 'error';
}
}
@@ -1,10 +1,12 @@
import 'dart:io';
import 'package:barcode_scan/barcode_scan.dart';
import 'package:cssd/config/routes.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:image_picker_gallery_camera/image_picker_gallery_camera.dart';
import 'package:meta/meta.dart';
import 'package:multiselect_formfield/multiselect_formfield.dart';
@@ -119,7 +121,8 @@ class _FormCreatorState extends State<FormCreator> {
),
InkWell(
onTap: () async {
await Navigator.of(context).pushNamed(Routes.captureImageScreen);
await Navigator.of(context)
.pushNamed(Routes.captureImageScreen);
// await captureImage(context);
},
child: Container(
@@ -164,21 +167,90 @@ class _FormCreatorState extends State<FormCreator> {
}
if (item['type'] == "Text") {
print(item['name']);
TextEditingController idCTRL = new TextEditingController();
final _media = MediaQuery.of(context);
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
listWidgets.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
decoration: InputDecoration(
labelText: item['name'] ?? "",
border: UnderlineInputBorder(),
contentPadding: EdgeInsets.all(0),
),
initialValue: item['value'] ?? '',
onChanged: (String value) {
formItems[count]['value'] = value;
_handleChanged();
},
),
child: item['name'] != 'Autoclave ID'
? TextFormField(
controller: idCTRL,
decoration: InputDecoration(
labelText: item['name'] ?? "",
border: UnderlineInputBorder(),
contentPadding: EdgeInsets.all(0),
),
initialValue: item['value'] ?? '',
onChanged: (String value) {
formItems[count]['value'] = value;
_handleChanged();
},
)
: Container(
child: Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
labelText: item['name'] ?? "",
border: UnderlineInputBorder(),
contentPadding: EdgeInsets.all(0),
),
initialValue: item['value'] ?? '',
onChanged: (String value) {
formItems[count]['value'] = value;
_handleChanged();
},
),
),
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);
idCTRL.text = result;
formItems[count]['value'] = result;
_handleChanged();
// Navigator.of(context).pushNamed(
// CycleDetailScreen.route,
// arguments: result,
// );
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
),
),
);
}
@@ -622,3 +694,27 @@ class ImageBox extends StatelessWidget {
);
}
}
Future<String> scan() async {
try {
var barcode = await BarcodeScanner.scan();
if (barcode.type.name == 'Cancelled') {
return 'cancel';
} else if (barcode.type.name == 'Failed') {
return 'error';
}
try {
var id = barcode.rawContent.contains('www.cssd-doc.com')
? barcode.rawContent.split('/')[5]
: barcode.rawContent;
return id;
} catch (_) {
return 'null';
}
} on PlatformException catch (_) {
return 'access';
} catch (_) {
return 'error';
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.4.1+1
version: 1.5.0+2
environment:
sdk: ">=2.2.2 <3.0.0"