Adjust UI
This commit is contained in:
parent
57d62f007b
commit
a4cc23974b
|
|
@ -1039,11 +1039,13 @@ void createEntity({
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void editEntity(
|
void editEntity({
|
||||||
{@required BuildContext context,
|
@required BuildContext context,
|
||||||
@required BaseEntity entity,
|
@required BaseEntity entity,
|
||||||
int subIndex,
|
int subIndex,
|
||||||
Completer completer}) {
|
bool force = false,
|
||||||
|
Completer completer,
|
||||||
|
}) {
|
||||||
final store = StoreProvider.of<AppState>(context);
|
final store = StoreProvider.of<AppState>(context);
|
||||||
final state = store.state;
|
final state = store.state;
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
@ -1056,6 +1058,7 @@ void editEntity(
|
||||||
checkForChanges(
|
checkForChanges(
|
||||||
store: store,
|
store: store,
|
||||||
context: context,
|
context: context,
|
||||||
|
force: force,
|
||||||
callback: () {
|
callback: () {
|
||||||
switch (entityType) {
|
switch (entityType) {
|
||||||
case EntityType.client:
|
case EntityType.client:
|
||||||
|
|
@ -1465,7 +1468,11 @@ void checkForChanges({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force && store.state.hasChanges() && !isMobile(context)) {
|
if (force) {
|
||||||
|
store.dispatch(DiscardChanges());
|
||||||
|
store.dispatch(ResetSettings());
|
||||||
|
callback();
|
||||||
|
} else if (store.state.hasChanges() && !isMobile(context)) {
|
||||||
showDialog<MessageDialog>(
|
showDialog<MessageDialog>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext dialogContext) {
|
builder: (BuildContext dialogContext) {
|
||||||
|
|
|
||||||
|
|
@ -100,10 +100,15 @@ class CreditEditVM extends AbstractInvoiceEditVM {
|
||||||
navigator.pop(savedCredit);
|
navigator.pop(savedCredit);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedCredit, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedCredit);
|
||||||
|
}
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
handleEntityAction(savedCredit, action);
|
handleEntityAction(savedCredit, action);
|
||||||
} else {
|
|
||||||
viewEntity(entity: savedCredit, force: true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
|
|
|
||||||
|
|
@ -152,10 +152,14 @@ class ExpenseEditVM extends AbstractExpenseEditVM {
|
||||||
navigator.pop(savedExpense);
|
navigator.pop(savedExpense);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntityById(
|
if (state.prefState.isPreviewEnabled) {
|
||||||
entityType: EntityType.expense,
|
viewEntity(entity: savedExpense, force: true);
|
||||||
entityId: savedExpense.id,
|
} else {
|
||||||
force: true);
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext,
|
||||||
|
entity: savedExpense,
|
||||||
|
force: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,14 @@ class InvoiceEditVM extends AbstractInvoiceEditVM {
|
||||||
navigator.pop(savedInvoice);
|
navigator.pop(savedInvoice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedInvoice, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedInvoice, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext,
|
||||||
|
entity: savedInvoice,
|
||||||
|
force: true);
|
||||||
|
}
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
handleEntityAction(savedInvoice, action);
|
handleEntityAction(savedInvoice, action);
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,13 @@ class PaymentEditVM {
|
||||||
if (payment.isApplying == true) {
|
if (payment.isApplying == true) {
|
||||||
navigator.pop();
|
navigator.pop();
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedPayment, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedPayment, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext,
|
||||||
|
entity: savedPayment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,12 @@ class ProductEditVM {
|
||||||
navigator.pop(savedProduct);
|
navigator.pop(savedProduct);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedProduct, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedProduct, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedProduct);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,12 @@ class ProjectEditVM {
|
||||||
navigator.pop(savedProject);
|
navigator.pop(savedProject);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedProject, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedProject, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedProject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
|
|
@ -99,10 +99,15 @@ class QuoteEditVM extends AbstractInvoiceEditVM {
|
||||||
navigator.pop(savedQuote);
|
navigator.pop(savedQuote);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedQuote, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedQuote);
|
||||||
|
}
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
handleEntityAction(savedQuote, action);
|
handleEntityAction(savedQuote, action);
|
||||||
} else {
|
|
||||||
viewEntity(entity: savedQuote, force: true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import 'dart:async';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
import 'package:flutter_redux/flutter_redux.dart';
|
||||||
|
import 'package:invoiceninja_flutter/main_app.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/expense/edit/expense_edit.dart';
|
import 'package:invoiceninja_flutter/ui/expense/edit/expense_edit.dart';
|
||||||
|
|
@ -107,7 +108,13 @@ class RecurringExpenseEditVM extends AbstractExpenseEditVM {
|
||||||
Navigator.of(context).pop(savedRecurringExpense);
|
Navigator.of(context).pop(savedRecurringExpense);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedRecurringExpense, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedRecurringExpense, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext,
|
||||||
|
entity: savedRecurringExpense);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,16 @@ class RecurringInvoiceEditVM extends AbstractInvoiceEditVM {
|
||||||
navigator.pop(savedRecurringInvoice);
|
navigator.pop(savedRecurringInvoice);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedRecurringInvoice, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext,
|
||||||
|
entity: savedRecurringInvoice);
|
||||||
|
}
|
||||||
|
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
handleEntityAction(savedRecurringInvoice, action);
|
handleEntityAction(savedRecurringInvoice, action);
|
||||||
} else {
|
|
||||||
viewEntity(entity: savedRecurringInvoice, force: true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,12 @@ class TaskEditVM {
|
||||||
navigator.pop(savedTask);
|
navigator.pop(savedTask);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedTask, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedTask, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedTask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,12 @@ class VendorEditVM {
|
||||||
navigator.pop(savedVendor);
|
navigator.pop(savedVendor);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
viewEntity(entity: savedVendor, force: true);
|
if (state.prefState.isPreviewEnabled) {
|
||||||
|
viewEntity(entity: savedVendor, force: true);
|
||||||
|
} else {
|
||||||
|
editEntity(
|
||||||
|
context: navigatorKey.currentContext, entity: savedVendor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}).catchError((Object error) {
|
}).catchError((Object error) {
|
||||||
showDialog<ErrorDialog>(
|
showDialog<ErrorDialog>(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue