From e30f1b346600c21565087221f76d0926f8ffed71 Mon Sep 17 00:00:00 2001 From: "Serik.Uvaissov" Date: Wed, 9 Sep 2020 16:18:18 +0600 Subject: [PATCH 1/4] barcode-scanner --- lib/core/services/DataService.dart | 8 + lib/views/home/tabs/KassaTab.dart | 306 ++++++++++++-------- lib/views/start_up/start_up_view.dart | 2 + lib/widgets/components/ProductListItem.dart | 84 +++++- pubspec.lock | 111 ++++--- pubspec.yaml | 15 +- 6 files changed, 340 insertions(+), 186 deletions(-) diff --git a/lib/core/services/DataService.dart b/lib/core/services/DataService.dart index c28b250..6385a54 100644 --- a/lib/core/services/DataService.dart +++ b/lib/core/services/DataService.dart @@ -41,6 +41,11 @@ class DataService extends BaseService { return list.map((e) => Good.fromMap(e)).toList(); } + Future> getGoodsByBarcode ({ String barcode}) async { + List> list = await _db.queryRowsWithWhere(Goog_tableName, ' $Goog_columnEan = ?', [barcode]); + return list.map((e) => Good.fromMap(e)).toList(); + } + CheckData _transformProductsToCheckData( {String paymentType, String tradeType, List items}) { List itemsList = []; @@ -128,6 +133,8 @@ class DataService extends BaseService { return null; } + + Future> sellOrReturn( {String paymentType, String tradeType, @@ -215,6 +222,7 @@ class DataService extends BaseService { if (goods.body.isNotEmpty) { for (var key in goods.body.keys) { Good row = Good.fromJson(goods.body[key]); + //log.i(row.toMap()); await _db.insert(Goog_tableName, row.toMap()); } log.i('Inserted ${goods.body.length} to table $Goog_tableName'); diff --git a/lib/views/home/tabs/KassaTab.dart b/lib/views/home/tabs/KassaTab.dart index ec7fced..bb88b8d 100644 --- a/lib/views/home/tabs/KassaTab.dart +++ b/lib/views/home/tabs/KassaTab.dart @@ -1,8 +1,11 @@ - +import 'package:aman_kassa_flutter/core/entity/Goods.dart'; import 'package:aman_kassa_flutter/core/locator.dart'; import 'package:aman_kassa_flutter/core/models/product_dao.dart'; import 'package:aman_kassa_flutter/core/route_names.dart'; +import 'package:aman_kassa_flutter/core/services/DataService.dart'; +import 'package:aman_kassa_flutter/core/services/dialog_service.dart'; import 'package:aman_kassa_flutter/core/services/navigator_service.dart'; +import 'package:aman_kassa_flutter/redux/actions/kassa_actions.dart'; import 'package:aman_kassa_flutter/redux/constants/operation_const.dart'; import 'package:aman_kassa_flutter/redux/constants/setting_const.dart'; import 'package:aman_kassa_flutter/redux/state/kassa_state.dart'; @@ -13,12 +16,19 @@ import 'package:aman_kassa_flutter/views/home/tabs/kassaView/CatalogBottomSheet. import 'package:aman_kassa_flutter/views/home/tabs/kassaView/ProductAddBottomSheet.dart'; import 'package:aman_kassa_flutter/views/payment/payment_view.dart'; import 'package:aman_kassa_flutter/widgets/components/ProductListItem.dart'; +import 'package:barcode_scan/gen/protos/protos.pb.dart'; +import 'package:barcode_scan/gen/protos/protos.pbenum.dart'; +import 'package:barcode_scan/model/scan_options.dart'; +import 'package:barcode_scan/platform_wrapper.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_redux/flutter_redux.dart'; +import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; class KassaTab extends StatelessWidget { - final NavigatorService _navigatorService = locator(); + final DialogService _dialogService = locator(); + final DataService _dataService = locator(); final int index; @@ -33,107 +43,132 @@ class KassaTab extends StatelessWidget { @override Widget build(BuildContext context) { - return Padding( - padding: EdgeInsets.all(4), - child: Column( - children: [ - Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: RaisedButton( - padding: EdgeInsets.all(8), - color: primaryColor, - child: Text( - "Добавить", - style: buttonBigTitleTextStyle, - ), - onPressed: () { showModalBottomSheetCatalog(context, 'add');}, - ), - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: RaisedButton( - padding: EdgeInsets.all(8), - color: greenColor, - child: Text( - "Каталог", - style: buttonBigTitleTextStyle, - ), - onPressed: () { showModalBottomSheetCatalog(context, 'catalog');}, - ), - ), - ), - ], - ), - Expanded( - child: Container( - child: StoreConnector( - converter: (store) => store.state.kassaState, - builder: (context, vm) { - return ListView.builder( - itemCount: vm.kassaItems.length, - itemBuilder: (BuildContext ctxt, int index) => - buildItem(ctxt, index, vm.kassaItems[index])); - } - ), + return Scaffold( + floatingActionButton: Container( + padding: EdgeInsets.only(bottom: 65.0, left: 8.0), + child: Align( + alignment: Alignment.bottomLeft, + child: FloatingActionButton( + elevation: 3.0, + onPressed: scan, + child: Icon( + MdiIcons.barcode, + size: 30, ), ), - Divider(), - Container( - margin: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, + ), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, + body: Padding( + padding: const EdgeInsets.all(4), + child: Column( + children: [ + Row( children: [ - StoreConnector( - converter: (store) => store.state.kassaState, - builder: (context, vm) { - return Text(totalCalc(vm.kassaItems), style: TextStyle(fontSize: 25)); - } + Expanded( + child: Padding( + padding: const EdgeInsets.all(4.0), + child: RaisedButton( + padding: const EdgeInsets.all(8), + color: primaryColor, + child: Text( + "Добавить", + style: buttonBigTitleTextStyle, + ), + onPressed: () { + showModalBottomSheetCatalog(context, 'add'); + }, + ), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(4.0), + child: RaisedButton( + padding: EdgeInsets.all(8), + color: greenColor, + child: Text( + "Каталог", + style: buttonBigTitleTextStyle, + ), + onPressed: () { + showModalBottomSheetCatalog(context, 'catalog'); + }, + ), + ), ), ], ), - ), - Row( - children: [ - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: RaisedButton( - padding: EdgeInsets.all(8), - color: redColor, - child: Text( - "возврат", - style: buttonBigTitleTextStyle, - ), + Expanded( + child: Container( + child: StoreConnector( + converter: (store) => store.state.kassaState, + builder: (context, vm) { + return ListView.builder( + itemCount: vm.kassaItems.length, + itemBuilder: (BuildContext ctxt, int index) => + buildItem(ctxt, index, vm.kassaItems[index])); + }), + ), + ), + //Divider(), + Container( + margin: const EdgeInsets.symmetric(vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + StoreConnector( + converter: (store) => store.state.kassaState, + builder: (context, vm) { + return Text(totalCalc(vm.kassaItems), + style: TextStyle(fontSize: 25)); + }), + ], + ), + ), + Row( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.all(4.0), + child: RaisedButton( + padding: const EdgeInsets.all(8), + color: redColor, + child: Text( + "возврат", + style: buttonBigTitleTextStyle, + ), + onPressed: () { + _navigatorService.push(PaymentViewRoute, + arguments: PaymentModel( + mode: SettingModeKassa, + operationType: OperationTypeReturn)); + }), + ), + ), + Expanded( + child: Padding( + padding: const EdgeInsets.all(4.0), + child: RaisedButton( + padding: const EdgeInsets.all(8), + color: greenColor, + child: Text( + "оплата", + style: buttonBigTitleTextStyle, + ), onPressed: () { - _navigatorService.push(PaymentViewRoute, arguments: PaymentModel(mode: SettingModeKassa, operationType: OperationTypeReturn) ); - } - ), - ), - ), - Expanded( - child: Padding( - padding: const EdgeInsets.all(4.0), - child: RaisedButton( - padding: EdgeInsets.all(8), - color: greenColor, - child: Text( - "оплата", - style: buttonBigTitleTextStyle, + _navigatorService.push(PaymentViewRoute, + arguments: PaymentModel( + mode: SettingModeKassa, + operationType: OperationTypePay)); + }, ), - onPressed: () { - _navigatorService.push(PaymentViewRoute, arguments: PaymentModel(mode: SettingModeKassa, operationType: OperationTypePay) ); - }, ), ), - ), - ], - ) - ], + ], + ) + ], + ), ), ); } @@ -141,32 +176,77 @@ class KassaTab extends StatelessWidget { String totalCalc(List kassaItems) { num total = 0.0; kassaItems.forEach((element) { - total+= element.total == null ? 0.0 : element.total.toDouble(); + total += element.total == null ? 0.0 : element.total.toDouble(); }); return total.toString(); } - void showModalBottomSheetCatalog(BuildContext context, String action) { - showModalBottomSheet( - context: context, - isScrollControlled: true, - backgroundColor: Colors.transparent, - builder: (context){ - return DraggableScrollableSheet( - initialChildSize: 0.8, - maxChildSize: 0.95, - minChildSize: 0.5, - builder: (BuildContext context, ScrollController scrollController) { - if( action == 'add') { - return ProductAddBottomSheet(scrollController: scrollController,); - } else { - return CatalogBottomSheet(scrollController: scrollController,); - } - }, - ); + Future scan() async { + try { + var options = ScanOptions(strings: { + "cancel": 'Отмена', + "flash_on": 'Вкл фонарик', + "flash_off": 'Выкл фонарик', + }); + var result = await BarcodeScanner.scan(options: options); +// print(result.type); // The result type (barcode, cancelled, failed) +// print(result.rawContent); // The barcode content +// print(result.format); // The barcode format (as enum) +// print(result.formatNote); // If a unknown format was scanned this field contains a note + if (result.type == ResultType.Barcode && + (result.format == BarcodeFormat.ean13 || + result.format == BarcodeFormat.ean8)) { + String barcode = result.rawContent; + List goods = + await _dataService.getGoodsByBarcode(barcode: barcode); + if (goods != null && goods.isNotEmpty) { + Redux.store.dispatch(addProductToKassaItems(goods.first)); + } else { + _dialogService.showDialog( + description: 'Товар не найден: ${result.rawContent}'); + } + } else if (result.type == ResultType.Error) { + _dialogService.showDialog(description: 'Не верный формат QR кода'); } - ); + } on PlatformException catch (e) { + var result = ScanResult.create(); + result.type = ResultType.Error; + result.format = BarcodeFormat.unknown; + if (e.code == BarcodeScanner.cameraAccessDenied) { + result.rawContent = 'The user did not grant the camera permission!'; + _dialogService.showDialog( + description: 'Нет доступа до камеры устройства'); + } else { + result.rawContent = 'Unknown error: $e'; + _dialogService.showDialog(description: 'Неизвестная ошибка: $e'); + } + } } + + void showModalBottomSheetCatalog(BuildContext context, String action) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (context) { + return DraggableScrollableSheet( + initialChildSize: 0.8, + maxChildSize: 0.95, + minChildSize: 0.5, + builder: (BuildContext context, ScrollController scrollController) { + if (action == 'add') { + return ProductAddBottomSheet( + scrollController: scrollController, + ); + } else { + return CatalogBottomSheet( + scrollController: scrollController, + ); + } + }, + ); + }); + } } diff --git a/lib/views/start_up/start_up_view.dart b/lib/views/start_up/start_up_view.dart index eaa0b08..414cfb9 100644 --- a/lib/views/start_up/start_up_view.dart +++ b/lib/views/start_up/start_up_view.dart @@ -3,6 +3,7 @@ import 'package:aman_kassa_flutter/redux/state/user_state.dart'; import 'package:aman_kassa_flutter/redux/store.dart'; import 'package:flutter_redux/flutter_redux.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/screenutil.dart'; class StartUpView extends StatefulWidget { @@ -20,6 +21,7 @@ class _StartUpViewState extends State { @override Widget build(BuildContext context) { + ScreenUtil.init(context, width: 411.43, height: 683.43, allowFontScaling: false); return StoreConnector( converter: (store) => store.state.userState, builder: (context, userState) { diff --git a/lib/widgets/components/ProductListItem.dart b/lib/widgets/components/ProductListItem.dart index 3a66e99..677f8ec 100644 --- a/lib/widgets/components/ProductListItem.dart +++ b/lib/widgets/components/ProductListItem.dart @@ -55,14 +55,13 @@ class ProductListItem extends StatelessWidget { //margin: const EdgeInsets.symmetric(horizontal: 4), child: Row( children: [ - buildClipRect(primaryColor, Icons.remove, () { - Redux.store.dispatch( - counterProductFromKassaItems(index, -1)); - }), - buildClipRect(primaryColor, Icons.add, () { - Redux.store - .dispatch(counterProductFromKassaItems(index, 1)); + buildClipRect(primaryColor, Icons.edit, () { + editCountForm(context, item.count); }), +// buildClipRect(primaryColor, Icons.add, () { +// Redux.store +// .dispatch(counterProductFromKassaItems(index, 1)); +// }), Expanded( child: Container(), ), @@ -103,4 +102,75 @@ class ProductListItem extends StatelessWidget { ), ); } + + + void editCountForm(BuildContext context, num count) { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + actionsPadding: const EdgeInsets.only(right: 15, bottom: 5), + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'request.title', + style: TextStyle(fontWeight: FontWeight.bold), + ), + //Divider(), + ], + ), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + //Text(request.description), + TextField( + autofocus: true, + decoration: InputDecoration( + labelText: 'request.description', + ), + //controller: _controller, + onSubmitted: (value) { + + }, + keyboardType: TextInputType.phone, + + ) + ], + ), + actions: [ + Row( + children: [ + RaisedButton( + color: redColor, + child: Text( + 'Отмена', + style: TextStyle(fontSize: 18), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + SizedBox( + width: 5, + ), + RaisedButton( + color: primaryColor, + child: Text( + 'Сохранить', + style: TextStyle(fontSize: 18), + ), + onPressed: () { + + }, + ), + ], + ), + ], + ); + }); + } } diff --git a/pubspec.lock b/pubspec.lock index a91ad99..cb129e2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,27 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.13" - args: - dependency: transitive - description: - name: args - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.1" + version: "2.4.2" auto_size_text: dependency: "direct main" description: @@ -43,6 +29,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" charcode: dependency: transitive description: @@ -50,13 +43,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.3" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.12" + version: "1.14.13" convert: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -84,14 +84,21 @@ packages: name: device_info url: "https://pub.dartlang.org" source: hosted - version: "0.4.2+4" + version: "0.4.2+7" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" equatable: dependency: "direct main" description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "1.2.3" + version: "1.2.4" esys_flutter_share: dependency: "direct main" description: @@ -99,6 +106,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" file: dependency: transitive description: @@ -125,6 +139,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.0" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" flutter_test: dependency: "direct dev" description: flutter @@ -163,13 +184,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.4" - image: - dependency: transitive - description: - name: image - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.12" intl: dependency: "direct main" description: @@ -197,7 +211,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.6" + version: "0.12.8" material_design_icons_flutter: dependency: "direct main" description: @@ -225,14 +239,14 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" + version: "1.7.0" path_provider: dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "1.6.11" + version: "1.6.14" path_provider_linux: dependency: transitive description: @@ -253,7 +267,7 @@ packages: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.3" pedantic: dependency: transitive description: @@ -261,13 +275,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.9.0" - petitparser: - dependency: transitive - description: - name: petitparser - url: "https://pub.dartlang.org" - source: hosted - version: "2.4.0" platform: dependency: transitive description: @@ -309,7 +316,7 @@ packages: name: provider url: "https://pub.dartlang.org" source: hosted - version: "4.3.1" + version: "4.3.2+1" pub_semver: dependency: transitive description: @@ -331,13 +338,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.2.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.3" redux: dependency: "direct main" description: @@ -379,14 +379,14 @@ packages: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "0.5.8" + version: "0.5.10" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "0.0.2+1" + version: "0.0.2+2" shared_preferences_macos: dependency: transitive description: @@ -440,7 +440,7 @@ packages: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.9.5" stream_channel: dependency: transitive description: @@ -475,14 +475,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.15" + version: "0.2.17" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.2.0" url_launcher: dependency: "direct main" description: @@ -517,7 +517,7 @@ packages: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "0.1.2" + version: "0.1.2+1" vector_math: dependency: transitive description: @@ -532,13 +532,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.0" - xml: - dependency: transitive - description: - name: xml - url: "https://pub.dartlang.org" - source: hosted - version: "3.6.1" sdks: - dart: ">=2.8.0 <3.0.0" + dart: ">=2.9.0-14.0.dev <3.0.0" flutter: ">=1.17.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index e6e1d00..8044309 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,29 +7,30 @@ dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.3 - redux: ^4.0.0 + redux: ^4.0.0+3 flutter_redux: ^0.6.0 redux_thunk: ^0.3.0 redux_persist: ^0.8.4 redux_persist_flutter: ^0.8.2 responsive_builder: ^0.2.0+2 - provider: ^4.3.1 - logger: ^0.9.1 - get_it: ^4.0.2 - equatable: ^1.2.2 + provider: ^4.3.2+1 + logger: ^0.9.2 + get_it: ^4.0.4 + equatable: ^1.2.4 http: ^0.12.2 sqflite: ^1.3.1 - path_provider: ^1.6.11 + path_provider: ^1.6.14 google_fonts: ^1.1.0 material_design_icons_flutter: ^4.0.5345 intl: ^0.16.1 barcode_scan: ^3.0.1 - device_info: ^0.4.2+4 + device_info: ^0.4.2+7 esys_flutter_share: ^1.0.2 auto_size_text: ^2.1.0 url_launcher: ^5.5.0 qr_flutter: ^3.2.0 mask_text_input_formatter: ^1.0.7 + flutter_screenutil: ^2.3.1 dev_dependencies: flutter_test: sdk: flutter From 07c661c994ba99d995ac6127a583e1bbf3242708 Mon Sep 17 00:00:00 2001 From: suvaissov Date: Fri, 15 Jan 2021 11:11:44 +0600 Subject: [PATCH 2/4] =?UTF-8?q?#1790=20-=20=D0=9A=D0=B0=D0=BC=D0=B5=D1=80?= =?UTF-8?q?=D0=B0=20EAN-Datamatrix=20=D0=B4=D0=BB=D1=8F=20JS1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/models/check_item.dart | 7 +- lib/core/models/product_dao.dart | 3 +- lib/core/services/DataService.dart | 4 +- lib/redux/actions/kassa_actions.dart | 8 +- lib/test/foo.dart | 11 + lib/views/home/tabs/KassaTab.dart | 54 +- .../tabs/kassaView/CatalogBottomSheet.dart | 2 +- lib/widgets/components/ProductListItem.dart | 25 +- pubspec.lock | 558 ++++++++++++++++++ 9 files changed, 637 insertions(+), 35 deletions(-) create mode 100644 lib/test/foo.dart create mode 100644 pubspec.lock diff --git a/lib/core/models/check_item.dart b/lib/core/models/check_item.dart index 6e2125c..1793081 100644 --- a/lib/core/models/check_item.dart +++ b/lib/core/models/check_item.dart @@ -3,7 +3,8 @@ class CheckItem { final num cnt; final num price; final int articul; - CheckItem({this.name, this.cnt, this.price, this.articul}); + final String excise; + CheckItem({this.name, this.cnt, this.price, this.articul, this.excise}); static CheckItem fromJson(Map json) { return CheckItem( @@ -11,6 +12,7 @@ class CheckItem { cnt: json['cnt'], price: json['price'], articul: json['articul'], + excise: json['excise'], ); } Map toJson() => @@ -18,6 +20,7 @@ class CheckItem { 'name': name, 'cnt': cnt, 'price': price, - 'articul': articul + 'articul': articul, + 'excise' : excise }; } \ No newline at end of file diff --git a/lib/core/models/product_dao.dart b/lib/core/models/product_dao.dart index 8885b86..2e7dd26 100644 --- a/lib/core/models/product_dao.dart +++ b/lib/core/models/product_dao.dart @@ -8,8 +8,9 @@ class ProductDao { num total; final Good good; final Service service; + final String excise; - ProductDao( {this.name, this.price, this.count, this.total, this.good, this.service }); + ProductDao( {this.name, this.price, this.count, this.total, this.good, this.service, this.excise }); } \ No newline at end of file diff --git a/lib/core/services/DataService.dart b/lib/core/services/DataService.dart index 6385a54..5f84729 100644 --- a/lib/core/services/DataService.dart +++ b/lib/core/services/DataService.dart @@ -62,7 +62,9 @@ class DataService extends BaseService { name: el.name ?? 'Позиция №$iterator', cnt: el.count, price: el.price, - articul: articul)); + articul: articul, + excise: el.excise, + )); summ += el.total; iterator++; }); diff --git a/lib/redux/actions/kassa_actions.dart b/lib/redux/actions/kassa_actions.dart index 0d797fc..56795cb 100644 --- a/lib/redux/actions/kassa_actions.dart +++ b/lib/redux/actions/kassa_actions.dart @@ -43,15 +43,15 @@ ThunkAction addCustomProductToKassaItems(String name, int count, doubl } -ThunkAction addProductToKassaItems(Good good) { +ThunkAction addProductToKassaItems(Good good, String excise) { return (Store store) async { List items = store.state.kassaState.kassaItems; - int index = items.indexWhere((element) => element.good?.id == good.id); - if (index > -1) { + int index = items.indexWhere((element) => element.excise == null && element.good?.id == good.id); + if (index > -1 && excise == null) { store.dispatch(counterProductFromKassaItems(index, 1)); } else { items.add(new ProductDao( - name: good.name, good: good, count: 1, price: good.price, total: good.price)); + name: good.name, good: good, count: 1, price: good.price, total: good.price, excise: excise)); store.dispatch(SetKassaStateAction(KassaState(kassaItems: items))); } }; diff --git a/lib/test/foo.dart b/lib/test/foo.dart new file mode 100644 index 0000000..47ce671 --- /dev/null +++ b/lib/test/foo.dart @@ -0,0 +1,11 @@ +// Define a function. +void printInteger(int aNumber) { + print('The number is $aNumber.'); // Print to console. +} + +// This is where the app starts executing. +void main() { + String dataMatrix = "00000046208262nZ2qnLHODVFWktT"; + String numberText = dataMatrix.replaceAll(RegExp("[a-zA-Z]"), ''); + print(int.parse(numberText)); +} \ No newline at end of file diff --git a/lib/views/home/tabs/KassaTab.dart b/lib/views/home/tabs/KassaTab.dart index bb88b8d..096c09d 100644 --- a/lib/views/home/tabs/KassaTab.dart +++ b/lib/views/home/tabs/KassaTab.dart @@ -189,25 +189,43 @@ class KassaTab extends StatelessWidget { "flash_off": 'Выкл фонарик', }); var result = await BarcodeScanner.scan(options: options); -// print(result.type); // The result type (barcode, cancelled, failed) -// print(result.rawContent); // The barcode content -// print(result.format); // The barcode format (as enum) -// print(result.formatNote); // If a unknown format was scanned this field contains a note - if (result.type == ResultType.Barcode && - (result.format == BarcodeFormat.ean13 || - result.format == BarcodeFormat.ean8)) { - String barcode = result.rawContent; - List goods = - await _dataService.getGoodsByBarcode(barcode: barcode); - if (goods != null && goods.isNotEmpty) { - Redux.store.dispatch(addProductToKassaItems(goods.first)); - } else { - _dialogService.showDialog( - description: 'Товар не найден: ${result.rawContent}'); + // print(result.type); // The result type (barcode, cancelled, failed) + // print(result.rawContent); // The barcode content + // print(result.format); // The barcode format (as enum) + // print(result.formatNote); // If a unknown format was scanned this field contains a note + // print(result.rawContent); // content + if (result.type == ResultType.Barcode ) { + String barcode; + String dataMatrix; + if(result.format == BarcodeFormat.ean13 || result.format == BarcodeFormat.ean8) { + barcode = result.rawContent; + } else if( result.format == BarcodeFormat.dataMatrix ) { + dataMatrix = result.rawContent; + if(dataMatrix!= null && dataMatrix.length >15) { + try { + String numberText = dataMatrix.substring(0, dataMatrix.length - 15 ).replaceAll(RegExp("[a-zA-Z]"), ''); + barcode = int.parse(numberText).toString(); + } catch (e) { + + } + } + // 00000046208262 nZ2qnLH ODVFWktT + // 00000046208262 tjKDqfu UzVSeFE5 } - } else if (result.type == ResultType.Error) { - _dialogService.showDialog(description: 'Не верный формат QR кода'); - } + + if(barcode != null) { + List goods = + await _dataService.getGoodsByBarcode(barcode: barcode); + if (goods != null && goods.isNotEmpty) { + Redux.store.dispatch(addProductToKassaItems(goods.first, dataMatrix)); + } else { + _dialogService.showDialog( + description: 'Товар не найден: $barcode'); + } + } else if (result.type == ResultType.Error) { + _dialogService.showDialog(description: 'Не верный формат QR кода'); + } + } } on PlatformException catch (e) { var result = ScanResult.create(); result.type = ResultType.Error; diff --git a/lib/views/home/tabs/kassaView/CatalogBottomSheet.dart b/lib/views/home/tabs/kassaView/CatalogBottomSheet.dart index f7929a0..664a006 100644 --- a/lib/views/home/tabs/kassaView/CatalogBottomSheet.dart +++ b/lib/views/home/tabs/kassaView/CatalogBottomSheet.dart @@ -95,7 +95,7 @@ class CatalogBottomSheet extends StatelessWidget { .dispatch(selectBottomElement(el.id)); } else if (el is Good) { await Redux.store - .dispatch(addProductToKassaItems(el)); + .dispatch(addProductToKassaItems(el, null)); Navigator.pop(context); } else if (el is Service) { await Redux.store diff --git a/lib/widgets/components/ProductListItem.dart b/lib/widgets/components/ProductListItem.dart index 677f8ec..5a5b35a 100644 --- a/lib/widgets/components/ProductListItem.dart +++ b/lib/widgets/components/ProductListItem.dart @@ -52,16 +52,25 @@ class ProductListItem extends StatelessWidget { Expanded( flex: 1, child: Container( - //margin: const EdgeInsets.symmetric(horizontal: 4), + margin: const EdgeInsets.symmetric(horizontal: 4), child: Row( children: [ - buildClipRect(primaryColor, Icons.edit, () { - editCountForm(context, item.count); - }), -// buildClipRect(primaryColor, Icons.add, () { -// Redux.store -// .dispatch(counterProductFromKassaItems(index, 1)); -// }), + // buildClipRect(primaryColor, Icons.edit, () { + // editCountForm(context, item.count); + // }), + if(item.excise == null) + buildClipRect(primaryColor, Icons.remove, () { + Redux.store + .dispatch( + counterProductFromKassaItems(index, -1)); + }), + if(item.excise == null) + buildClipRect(primaryColor, Icons.add, () { + Redux.store + .dispatch( + counterProductFromKassaItems(index, 1)); + }), + Expanded( child: Container(), ), diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..e5e4568 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,558 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety.1" + auto_size_text: + dependency: "direct main" + description: + name: auto_size_text + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + barcode_scan: + dependency: "direct main" + description: + name: barcode_scan + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.3" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.3" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + device_info: + dependency: "direct main" + description: + name: device_info + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2+10" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + equatable: + dependency: "direct main" + description: + name: equatable + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.5" + esys_flutter_share: + dependency: "direct main" + description: + name: esys_flutter_share + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "5.2.1" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.11" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_redux: + dependency: "direct main" + description: + name: flutter_redux + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.0" + flutter_screenutil: + dependency: "direct main" + description: + name: flutter_screenutil + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + get_it: + dependency: "direct main" + description: + name: get_it + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.4" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.1" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.2" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + intl: + dependency: "direct main" + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + logger: + dependency: "direct main" + description: + name: logger + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.4" + mask_text_input_formatter: + dependency: "direct main" + description: + name: mask_text_input_formatter + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.1" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety.1" + material_design_icons_flutter: + dependency: "direct main" + description: + name: material_design_icons_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.5855" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.1" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.27" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+2" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+8" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4+3" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.2" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.13" + protobuf: + dependency: transitive + description: + name: protobuf + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + provider: + dependency: "direct main" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.2+4" + qr: + dependency: transitive + description: + name: qr + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + qr_flutter: + dependency: "direct main" + description: + name: qr_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.0" + redux: + dependency: "direct main" + description: + name: redux + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0+3" + redux_persist: + dependency: "direct main" + description: + name: redux_persist + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.4" + redux_persist_flutter: + dependency: "direct main" + description: + name: redux_persist_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.8.3" + redux_thunk: + dependency: "direct main" + description: + name: redux_thunk + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" + responsive_builder: + dependency: "direct main" + description: + name: responsive_builder + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+2" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.12+4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.2+4" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+11" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+7" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+3" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety.2" + sqflite: + dependency: "direct main" + description: + name: sqflite + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.2+2" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.1" + synchronized: + dependency: transitive + description: + name: synchronized + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0+2" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety.1" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety.2" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.3" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.dartlang.org" + source: hosted + version: "5.7.10" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+4" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+9" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.9" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5+1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.1+3" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.3" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "1.7.4" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" +sdks: + dart: ">=2.10.2 <2.11.0" + flutter: ">=1.22.2 <2.0.0" From 4210c98f188ace5ecb34b7eba829840777737c99 Mon Sep 17 00:00:00 2001 From: suvaissov Date: Sat, 16 Jan 2021 12:01:55 +0600 Subject: [PATCH 3/4] =?UTF-8?q?=D0=9D=D0=B5=D0=BB=D1=8C=D0=B7=D1=8F=20?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=BE=20=D0=BE=D0=B4=D0=B8=D0=BD?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=B2=D1=8B=D0=B5=20=D1=82=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/redux/actions/kassa_actions.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/redux/actions/kassa_actions.dart b/lib/redux/actions/kassa_actions.dart index 56795cb..3c7be85 100644 --- a/lib/redux/actions/kassa_actions.dart +++ b/lib/redux/actions/kassa_actions.dart @@ -5,6 +5,7 @@ import 'package:aman_kassa_flutter/core/locator.dart'; import 'package:aman_kassa_flutter/core/models/dict_dao.dart'; import 'package:aman_kassa_flutter/core/models/product_dao.dart'; import 'package:aman_kassa_flutter/core/services/DataService.dart'; +import 'package:aman_kassa_flutter/core/services/dialog_service.dart'; import 'package:aman_kassa_flutter/redux/constants/setting_const.dart'; import 'package:aman_kassa_flutter/redux/state/kassa_state.dart'; import 'package:meta/meta.dart'; @@ -20,6 +21,7 @@ class SetKassaStateAction { } final DataService _dataService = locator(); +final DialogService _dialogService = locator(); Future backBottomElement(Store store) async { List prevCategories = store.state.kassaState.prevCategories; @@ -47,6 +49,13 @@ ThunkAction addProductToKassaItems(Good good, String excise) { return (Store store) async { List items = store.state.kassaState.kassaItems; int index = items.indexWhere((element) => element.excise == null && element.good?.id == good.id); + if(excise !=null) { + int existIndex = items.indexWhere((element) => element.excise != null && element.excise == excise); + if(existIndex > -1) { + _dialogService.showDialog(description: 'Нельзя добавить повторно одинаковые товары'); + return; + } + } if (index > -1 && excise == null) { store.dispatch(counterProductFromKassaItems(index, 1)); } else { From 0d905b6c4fdc8ee794a5f8deab443878fb336fa1 Mon Sep 17 00:00:00 2001 From: Serik Uvaissov Date: Sat, 16 Jan 2021 13:03:28 +0600 Subject: [PATCH 4/4] ios build --- ios/Podfile | 76 ++++++---------------------- ios/Podfile.lock | 50 ++---------------- ios/Runner.xcodeproj/project.pbxproj | 3 -- pubspec.yaml | 2 +- 4 files changed, 20 insertions(+), 111 deletions(-) diff --git a/ios/Podfile b/ios/Podfile index 6697f0a..1e8c3c9 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -10,78 +10,32 @@ project 'Runner', { 'Release' => :release, } -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches end - generated_key_values + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" end +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + target 'Runner' do use_frameworks! use_modular_headers! - # Flutter Pod - - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end + flutter_additional_ios_build_settings(target) end end diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 7097adf..7836658 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -14,28 +14,14 @@ PODS: - MTBBarcodeScanner (5.0.11) - path_provider (0.0.1): - Flutter - - path_provider_linux (0.0.1): - - Flutter - - path_provider_macos (0.0.1): - - Flutter - shared_preferences (0.0.1): - Flutter - - shared_preferences_macos (0.0.1): + - sqflite (0.0.2): - Flutter - - shared_preferences_web (0.0.1): - - Flutter - - sqflite (0.0.1): - - Flutter - - FMDB (~> 2.7.2) + - FMDB (>= 2.7.5) - SwiftProtobuf (1.9.0) - url_launcher (0.0.1): - Flutter - - url_launcher_linux (0.0.1): - - Flutter - - url_launcher_macos (0.0.1): - - Flutter - - url_launcher_web (0.0.1): - - Flutter DEPENDENCIES: - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) @@ -43,16 +29,9 @@ DEPENDENCIES: - esys_flutter_share (from `.symlinks/plugins/esys_flutter_share/ios`) - Flutter (from `Flutter`) - path_provider (from `.symlinks/plugins/path_provider/ios`) - - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) - - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) - - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) SPEC REPOS: trunk: @@ -71,26 +50,12 @@ EXTERNAL SOURCES: :path: Flutter path_provider: :path: ".symlinks/plugins/path_provider/ios" - path_provider_linux: - :path: ".symlinks/plugins/path_provider_linux/ios" - path_provider_macos: - :path: ".symlinks/plugins/path_provider_macos/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" - shared_preferences_macos: - :path: ".symlinks/plugins/shared_preferences_macos/ios" - shared_preferences_web: - :path: ".symlinks/plugins/shared_preferences_web/ios" sqflite: :path: ".symlinks/plugins/sqflite/ios" url_launcher: :path: ".symlinks/plugins/url_launcher/ios" - url_launcher_linux: - :path: ".symlinks/plugins/url_launcher_linux/ios" - url_launcher_macos: - :path: ".symlinks/plugins/url_launcher_macos/ios" - url_launcher_web: - :path: ".symlinks/plugins/url_launcher_web/ios" SPEC CHECKSUMS: barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 @@ -100,18 +65,11 @@ SPEC CHECKSUMS: FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c - path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 - path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 - shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 - sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0 + sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SwiftProtobuf: ecbec1be9036d15655f6b3443a1c4ea693c97932 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 - url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 - url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c -PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c COCOAPODS: 1.8.4 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 27c4d75..b28cc99 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -335,7 +335,6 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -417,7 +416,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -473,7 +471,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/pubspec.yaml b/pubspec.yaml index 99fbb17..a5bfcdf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: aman_kassa_flutter description: A new Flutter project. -version: 1.0.5+25 +version: 1.1.1+26 environment: sdk: '>=2.3.0 <3.0.0' dependencies: