diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileBold.ttf b/assets/Fonts/IRANYekanMobileBold.ttf similarity index 89% rename from assets/Fonts/old-iranyekan/IRANYekanMobileBold.ttf rename to assets/Fonts/IRANYekanMobileBold.ttf index 2f9c5ea..706b059 100644 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileBold.ttf and b/assets/Fonts/IRANYekanMobileBold.ttf differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileLight.ttf b/assets/Fonts/IRANYekanMobileLight.ttf similarity index 89% rename from assets/Fonts/old-iranyekan/IRANYekanMobileLight.ttf rename to assets/Fonts/IRANYekanMobileLight.ttf index 375728a..2ebee13 100644 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileLight.ttf and b/assets/Fonts/IRANYekanMobileLight.ttf differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileMedium.ttf b/assets/Fonts/IRANYekanMobileMedium.ttf similarity index 90% rename from assets/Fonts/old-iranyekan/IRANYekanMobileMedium.ttf rename to assets/Fonts/IRANYekanMobileMedium.ttf index 222cc24..27b07d9 100644 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileMedium.ttf and b/assets/Fonts/IRANYekanMobileMedium.ttf differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileRegular.ttf b/assets/Fonts/IRANYekanMobileRegular.ttf similarity index 89% rename from assets/Fonts/old-iranyekan/IRANYekanMobileRegular.ttf rename to assets/Fonts/IRANYekanMobileRegular.ttf index 5e6aae4..07dd9f7 100644 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileRegular.ttf and b/assets/Fonts/IRANYekanMobileRegular.ttf differ diff --git a/assets/Fonts/Montserrat-Black.ttf b/assets/Fonts/Montserrat-Black.ttf deleted file mode 100644 index f0d24ad..0000000 Binary files a/assets/Fonts/Montserrat-Black.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-BlackItalic.ttf b/assets/Fonts/Montserrat-BlackItalic.ttf deleted file mode 100644 index 5ce4afc..0000000 Binary files a/assets/Fonts/Montserrat-BlackItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-BoldItalic.ttf b/assets/Fonts/Montserrat-BoldItalic.ttf deleted file mode 100644 index ed61ca7..0000000 Binary files a/assets/Fonts/Montserrat-BoldItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-ExtraBold.ttf b/assets/Fonts/Montserrat-ExtraBold.ttf deleted file mode 100644 index 6725d53..0000000 Binary files a/assets/Fonts/Montserrat-ExtraBold.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-ExtraBoldItalic.ttf b/assets/Fonts/Montserrat-ExtraBoldItalic.ttf deleted file mode 100644 index 107f98d..0000000 Binary files a/assets/Fonts/Montserrat-ExtraBoldItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-ExtraLight.ttf b/assets/Fonts/Montserrat-ExtraLight.ttf deleted file mode 100644 index 2967eb6..0000000 Binary files a/assets/Fonts/Montserrat-ExtraLight.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-ExtraLightItalic.ttf b/assets/Fonts/Montserrat-ExtraLightItalic.ttf deleted file mode 100644 index 5d62085..0000000 Binary files a/assets/Fonts/Montserrat-ExtraLightItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-Italic.ttf b/assets/Fonts/Montserrat-Italic.ttf deleted file mode 100644 index 00fadbe..0000000 Binary files a/assets/Fonts/Montserrat-Italic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-LightItalic.ttf b/assets/Fonts/Montserrat-LightItalic.ttf deleted file mode 100644 index 6dba219..0000000 Binary files a/assets/Fonts/Montserrat-LightItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-MediumItalic.ttf b/assets/Fonts/Montserrat-MediumItalic.ttf deleted file mode 100644 index 16dbf4c..0000000 Binary files a/assets/Fonts/Montserrat-MediumItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-SemiBold.ttf b/assets/Fonts/Montserrat-SemiBold.ttf deleted file mode 100644 index 0ecc667..0000000 Binary files a/assets/Fonts/Montserrat-SemiBold.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-SemiBoldItalic.ttf b/assets/Fonts/Montserrat-SemiBoldItalic.ttf deleted file mode 100644 index 39f2393..0000000 Binary files a/assets/Fonts/Montserrat-SemiBoldItalic.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-Thin.ttf b/assets/Fonts/Montserrat-Thin.ttf deleted file mode 100644 index 6a394e7..0000000 Binary files a/assets/Fonts/Montserrat-Thin.ttf and /dev/null differ diff --git a/assets/Fonts/Montserrat-ThinItalic.ttf b/assets/Fonts/Montserrat-ThinItalic.ttf deleted file mode 100644 index 8eeeaa4..0000000 Binary files a/assets/Fonts/Montserrat-ThinItalic.ttf and /dev/null differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileBlack.ttf b/assets/Fonts/old-iranyekan/IRANYekanMobileBlack.ttf deleted file mode 100644 index b0dd1d7..0000000 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileBlack.ttf and /dev/null differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBlack.ttf b/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBlack.ttf deleted file mode 100644 index 62a710d..0000000 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBlack.ttf and /dev/null differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBold.ttf b/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBold.ttf deleted file mode 100644 index aab2037..0000000 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileExtraBold.ttf and /dev/null differ diff --git a/assets/Fonts/old-iranyekan/IRANYekanMobileThin.ttf b/assets/Fonts/old-iranyekan/IRANYekanMobileThin.ttf deleted file mode 100644 index 25da7fc..0000000 Binary files a/assets/Fonts/old-iranyekan/IRANYekanMobileThin.ttf and /dev/null differ diff --git a/lib/pages/cycle_filter_screen.dart b/lib/pages/cycle_filter_screen.dart index f1df39b..fb99cec 100644 --- a/lib/pages/cycle_filter_screen.dart +++ b/lib/pages/cycle_filter_screen.dart @@ -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 { 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 { ); } } + +Future 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'; + } +} diff --git a/lib/pages/label_filter_screen.dart b/lib/pages/label_filter_screen.dart index 93c3309..ae8f29f 100644 --- a/lib/pages/label_filter_screen.dart +++ b/lib/pages/label_filter_screen.dart @@ -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 { 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 { ); } } +Future 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'; + } +} diff --git a/lib/pages/test_filter_screen.dart b/lib/pages/test_filter_screen.dart index 31a122b..9214b6e 100644 --- a/lib/pages/test_filter_screen.dart +++ b/lib/pages/test_filter_screen.dart @@ -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 { 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 { ); } } + +Future 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'; + } +} diff --git a/lib/widgets/TestResultScreens/Add/form_creator.dart b/lib/widgets/TestResultScreens/Add/form_creator.dart index 66fa5be..eadeace 100644 --- a/lib/widgets/TestResultScreens/Add/form_creator.dart +++ b/lib/widgets/TestResultScreens/Add/form_creator.dart @@ -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 { ), 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 { } 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 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'; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index f9c4ef1..dca6ed5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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"