diff --git a/lib/ui/reports/reports_screen_vm.dart b/lib/ui/reports/reports_screen_vm.dart index ab5f4740e..c77f918ed 100644 --- a/lib/ui/reports/reports_screen_vm.dart +++ b/lib/ui/reports/reports_screen_vm.dart @@ -93,7 +93,8 @@ class ReportsScreenVM { final GroupTotals groupTotals; final Function(BuildContext, List) onReportColumnsChanged; final Function(BuildContext) onExportPressed; - final Function(BuildContext, BuiltMap) onReportFiltersChanged; + final Function(BuildContext, BuiltMap) + onReportFiltersChanged; final Function(String?, bool) onReportSorted; final Function(int, bool) onReportTotalsSorted; final Function({ @@ -471,7 +472,8 @@ class ReportsScreenVM { getReportColumnType(column, context) == ReportColumnType.number) .toList(); - columns.sort((String? str1, String? str2) => str1!.compareTo(str2!)); + columns + .sort((String? str1, String? str2) => str1!.compareTo(str2!)); csvData += localization!.lookup(reportState.group)! + ',' + @@ -651,7 +653,7 @@ GroupTotals calculateReportTotals({ final column = columns[j]; if (column == reportState.group) { - totals[group]!['count'] += 1; + totals[group]!['count'] = totals[group]!['count']! + 1; } if (cell is ReportNumberValue || @@ -676,9 +678,9 @@ GroupTotals calculateReportTotals({ fromCurrencyId: cell.currencyId, toCurrencyId: company.currencyId); cellValue = round(cellValue * rate, toCurrency.precision); - totals[group]![column] += cellValue; + totals[group]![column] = totals[group]![column]! + cellValue; } else { - totals[group]![column] += cell.doubleValue!; + totals[group]![column] = totals[group]![column]! + cell.doubleValue!; } } } diff --git a/lib/ui/schedule/edit/schedule_edit.dart b/lib/ui/schedule/edit/schedule_edit.dart index 6f85cb6ce..260e662f2 100644 --- a/lib/ui/schedule/edit/schedule_edit.dart +++ b/lib/ui/schedule/edit/schedule_edit.dart @@ -129,8 +129,9 @@ class _ScheduleEditState extends State { ''); return EditScaffold( - title: - schedule.isNew ? localization!.newSchedule : localization!.editSchedule, + title: schedule.isNew + ? localization!.newSchedule + : localization!.editSchedule, onCancelPressed: (context) => viewModel.onCancelPressed(context), onSavePressed: (context) => _onSavePressed(), body: Form( @@ -236,7 +237,8 @@ class _ScheduleEditState extends State { labelText: localization.dateRange, blankValue: null, value: parameters.dateRange!.isNotEmpty - ? DateRange.valueOf(toCamelCase(parameters.dateRange!)) + ? DateRange.valueOf( + toCamelCase(parameters.dateRange!)) : null, onChanged: (dynamic value) { viewModel.onChanged(schedule.rebuild((b) => b @@ -290,8 +292,8 @@ class _ScheduleEditState extends State { label: localization.onlyClientsWithInvoices, value: parameters.onlyClientsWithInvoices, onChanged: (value) { - viewModel.onChanged(schedule.rebuild( - (b) => b..parameters.onlyClientsWithInvoices = value)); + viewModel.onChanged(schedule.rebuild((b) => + b..parameters.onlyClientsWithInvoices = value)); }), ]), FormCard( @@ -305,6 +307,9 @@ class _ScheduleEditState extends State { clientState: state.clientState, excludeIds: parameters.clients!.toList(), onSelected: (value) { + if (value == null) { + return; + } if (!parameters.clients!.contains(value.id)) { viewModel.onChanged(schedule.rebuild( (b) => b..parameters.clients.add(value.id))); @@ -319,8 +324,8 @@ class _ScheduleEditState extends State { HelpText(localization.allClients), for (var clientId in parameters.clients!) ListTile( - title: - Text(state.clientState.get(clientId)!.displayName), + title: Text( + state.clientState.get(clientId)!.displayName), trailing: IconButton( icon: Icon(Icons.clear), onPressed: () { diff --git a/lib/ui/schedule/schedule_list_item.dart b/lib/ui/schedule/schedule_list_item.dart index faa08614b..5c97d7c5c 100644 --- a/lib/ui/schedule/schedule_list_item.dart +++ b/lib/ui/schedule/schedule_list_item.dart @@ -43,9 +43,9 @@ class ScheduleListItem extends StatelessWidget { String subtitle = formatDate(schedule!.nextRun, context); - String? title = localization.lookup(schedule!.template); + String title = localization.lookup(schedule!.template) ?? ''; if (schedule!.template == ScheduleEntity.TEMPLATE_EMAIL_RECORD) { - final entityType = EntityType.valueOf(schedule!.parameters.entityType); + final entityType = EntityType.valueOf(schedule!.parameters.entityType!); final entity = state.getEntityMap(entityType)![schedule!.parameters.entityId]; @@ -87,7 +87,8 @@ class ScheduleListItem extends StatelessWidget { child: Container( width: MediaQuery.of(context).size.width, child: ListTile( - onTap: () => onTap != null ? onTap!() : selectEntity(entity: schedule!), + onTap: () => + onTap != null ? onTap!() : selectEntity(entity: schedule!), onLongPress: () => onLongPress != null ? onLongPress!() : selectEntity(entity: schedule!, longPress: true), diff --git a/lib/ui/schedule/view/schedule_view.dart b/lib/ui/schedule/view/schedule_view.dart index ea64d8c25..c5858ddd2 100644 --- a/lib/ui/schedule/view/schedule_view.dart +++ b/lib/ui/schedule/view/schedule_view.dart @@ -36,8 +36,9 @@ class _ScheduleViewState extends State { BaseEntity? entity; if (schedule.template == ScheduleEntity.TEMPLATE_EMAIL_RECORD) { - final entityType = EntityType.valueOf(schedule.parameters.entityType); - entity = state.getEntityMap(entityType)![schedule.parameters.entityId] as BaseEntity?; + final entityType = EntityType.valueOf(schedule.parameters.entityType!); + entity = state.getEntityMap(entityType)![schedule.parameters.entityId] + as BaseEntity?; } return ViewScaffold( @@ -86,9 +87,11 @@ class _ScheduleViewState extends State { localization.showPaymentsTable: parameters.showPaymentsTable! ? localization.yes : localization.no, - localization.onlyClientsWithInvoices: (parameters.onlyClientsWithInvoices != null && parameters.onlyClientsWithInvoices!) - ? localization.yes - : localization.no, + localization.onlyClientsWithInvoices: + (parameters.onlyClientsWithInvoices != null && + parameters.onlyClientsWithInvoices!) + ? localization.yes + : localization.no, localization.status: localization.lookup(parameters.status), }) ], diff --git a/lib/utils/completers.dart b/lib/utils/completers.dart index f9f89f5ce..050417e23 100644 --- a/lib/utils/completers.dart +++ b/lib/utils/completers.dart @@ -46,9 +46,11 @@ Completer snackBarCompleter( Completer popCompleter(BuildContext context, dynamic result) { final Completer completer = Completer(); - completer.future.then((_) { + completer.future + .then(() { Navigator.of(context).pop(result); - } as FutureOr<_> Function(Null)).catchError((Object error) { + } as FutureOr Function(Null)) + .catchError((Object error) { showDialog( context: navigatorKey.currentContext!, builder: (BuildContext context) { diff --git a/lib/utils/dialogs.dart b/lib/utils/dialogs.dart index 748c73500..765947958 100644 --- a/lib/utils/dialogs.dart +++ b/lib/utils/dialogs.dart @@ -419,7 +419,7 @@ class _FieldConfirmationState extends State { maxLengthEnforcement: widget.maxLength != null ? MaxLengthEnforcement.enforced : MaxLengthEnforcement.none, - buildCounter: (_, {currentLength, maxLength, isFocused}) => null, + //buildCounter: (_, {currentLength, maxLength, isFocused}) => null, decoration: InputDecoration( labelText: widget.field, ), diff --git a/lib/utils/markdown.dart b/lib/utils/markdown.dart index 75a8128e5..a9e83b079 100644 --- a/lib/utils/markdown.dart +++ b/lib/utils/markdown.dart @@ -1,3 +1,4 @@ +/* // DELETE THIS FILE ONCE SUPER EDITOR IS UPDATED import 'dart:convert'; @@ -587,3 +588,4 @@ class _EmptyParagraphSyntax extends md.BlockSyntax { return md.Element('p', []); } } +*/ \ No newline at end of file diff --git a/lib/utils/super_editor/super_editor.dart b/lib/utils/super_editor/super_editor.dart index 950d64f9d..5a21d4930 100644 --- a/lib/utils/super_editor/super_editor.dart +++ b/lib/utils/super_editor/super_editor.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:invoiceninja_flutter/utils/markdown.dart'; import 'package:invoiceninja_flutter/utils/super_editor/toolbar.dart'; import 'package:super_editor/super_editor.dart'; +import 'package:super_editor_markdown/super_editor_markdown.dart'; /// Example of a rich text editor. /// diff --git a/pubspec.lock b/pubspec.lock index 43658f96e..f033fdd44 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: attributed_text - sha256: "892b9517ba27f78ebee526424a91d1aba44d729e610f06a0dd9a3a43d3d81f6d" + sha256: e43495051b63e6cdbe96aa62123974074cca109d9c56f74ce2ffaec8060e044e url: "https://pub.dev" source: hosted - version: "0.2.1" + version: "0.2.2" barcode: dependency: transitive description: @@ -466,6 +466,14 @@ packages: description: flutter source: sdk version: "0.0.0" + follow_the_leader: + dependency: transitive + description: + name: follow_the_leader + sha256: "44396bad4abbf0d43d5ca3ee98180772bb45a78f39a1960c62170843bd46753f" + url: "https://pub.dev" + source: hosted + version: "0.0.4+3" frontend_server_client: dependency: transitive description: @@ -808,13 +816,13 @@ packages: source: hosted version: "1.0.2" markdown: - dependency: "direct main" + dependency: transitive description: name: markdown - sha256: "39caf989ccc72c63e87b961851a74257141938599ed2db45fbd9403fee0db423" + sha256: "01512006c8429f604eb10f9848717baeaedf99e991d14a50d540d9beff08e5c6" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "4.0.1" matcher: dependency: transitive description: @@ -911,6 +919,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.3.1" + overlord: + dependency: transitive + description: + name: overlord + sha256: "7fa6a83455b7da5c66a16320c02783d110c574a6e6c511750c662dbadfe9399f" + url: "https://pub.dev" + source: hosted + version: "0.0.3+2" package_config: dependency: transitive description: @@ -1456,20 +1472,27 @@ packages: super_editor: dependency: "direct main" description: - path: super_editor - ref: HEAD - resolved-ref: e4eceea4a72706410a1e910ad0ce01b815c63a8e - url: "https://github.com/superlistapp/super_editor.git" - source: git - version: "0.2.3-dev.1" + name: super_editor + sha256: "2d5acf95449f53eec1c7d0788530b3a667758224a1e4aa4164bd5d6c0d159bab" + url: "https://pub.dev" + source: hosted + version: "0.2.6" + super_editor_markdown: + dependency: "direct main" + description: + name: super_editor_markdown + sha256: "2515d0183ee21aa22d577e95e80b1e4bc1b9ce0f651127d40844be7cb58b5330" + url: "https://pub.dev" + source: hosted + version: "0.1.5" super_text_layout: dependency: transitive description: name: super_text_layout - sha256: "6cf41a07780d7e40cec56ed3dcde59b527968a4e282b78e2d7e9a0134b26685c" + sha256: "8afed48db5e15c9c3488ca9f24b24cd24a4867a6d9d2dd2ba540ac363f50b60d" url: "https://pub.dev" source: hosted - version: "0.1.4" + version: "0.1.6" sync_http: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ea728c467..c899c0d84 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,12 +69,13 @@ dependencies: contacts_service: ^0.6.3 diacritic: ^0.1.3 states_rebuilder: ^6.2.0 - # super_editor: ^0.2.2 - markdown: ^5.0.0 # REMOVE THIS - super_editor: - git: - url: https://github.com/superlistapp/super_editor.git - path: super_editor + super_editor: ^0.2.6 + super_editor_markdown: ^0.1.5 + #markdown: ^5.0.0 # REMOVE THIS + #super_editor: + # git: + # url: https://github.com/superlistapp/super_editor.git + # path: super_editor html2md: ^1.2.6 printing: ^5.10.1 image_cropper: ^3.0.1