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