Navigation...
This commit is contained in:
parent
a853824671
commit
233cff33d0
|
|
@ -8,21 +8,21 @@ class EntityStatusChip extends StatelessWidget {
|
||||||
const EntityStatusChip({
|
const EntityStatusChip({
|
||||||
@required this.entity,
|
@required this.entity,
|
||||||
this.addGap = false,
|
this.addGap = false,
|
||||||
|
this.width = 100,
|
||||||
});
|
});
|
||||||
|
|
||||||
final BaseEntity entity;
|
final BaseEntity entity;
|
||||||
final bool addGap;
|
final bool addGap;
|
||||||
|
final double width;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
String label = '';
|
String label = '';
|
||||||
Color color;
|
Color color;
|
||||||
double width = 80;
|
|
||||||
|
|
||||||
switch (entity.entityType) {
|
switch (entity.entityType) {
|
||||||
case EntityType.payment:
|
case EntityType.payment:
|
||||||
width = 100;
|
|
||||||
final payment = entity as PaymentEntity;
|
final payment = entity as PaymentEntity;
|
||||||
label = kPaymentStatuses[payment.statusId];
|
label = kPaymentStatuses[payment.statusId];
|
||||||
color = PaymentStatusColors.colors[payment.statusId];
|
color = PaymentStatusColors.colors[payment.statusId];
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,21 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
|
import 'package:invoiceninja_flutter/ui/app/entities/entity_status_chip.dart';
|
||||||
|
|
||||||
class EntityHeader extends StatelessWidget {
|
class EntityHeader extends StatelessWidget {
|
||||||
const EntityHeader({
|
const EntityHeader({
|
||||||
|
@required this.entity,
|
||||||
@required this.label,
|
@required this.label,
|
||||||
@required this.value,
|
@required this.value,
|
||||||
this.secondLabel,
|
this.secondLabel,
|
||||||
this.secondValue,
|
this.secondValue,
|
||||||
this.backgroundColor,
|
this.statusLabel,
|
||||||
|
this.statusColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Color backgroundColor;
|
final BaseEntity entity;
|
||||||
|
final Color statusColor;
|
||||||
|
final String statusLabel;
|
||||||
final String label;
|
final String label;
|
||||||
final String value;
|
final String value;
|
||||||
final String secondLabel;
|
final String secondLabel;
|
||||||
|
|
@ -69,14 +75,27 @@ class EntityHeader extends StatelessWidget {
|
||||||
return Container(
|
return Container(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(left: 20, top: 30, right: 20, bottom: 25),
|
padding: EdgeInsets.only(left: 20, top: 30, right: 20, bottom: 25),
|
||||||
child: Flex(
|
child: Column(
|
||||||
direction: value.length > 12 || (secondValue ?? '').length > 12
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
? Axis.vertical
|
children: [
|
||||||
: Axis.horizontal,
|
Flex(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
direction: value.length > 12 || (secondValue ?? '').length > 12
|
||||||
children: <Widget>[
|
? Axis.vertical
|
||||||
Expanded(child: _value1()),
|
: Axis.horizontal,
|
||||||
if (secondValue != null) Expanded(child: _value2()),
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(child: _value1()),
|
||||||
|
if (secondValue != null) Expanded(child: _value2()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
if (statusLabel != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 25, bottom: 5),
|
||||||
|
child: EntityStatusChip(
|
||||||
|
entity: entity,
|
||||||
|
width: 120,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||||
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
import 'package:invoiceninja_flutter/ui/app/actions_menu_button.dart';
|
||||||
|
import 'package:invoiceninja_flutter/utils/icons.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
import 'package:invoiceninja_flutter/utils/platforms.dart';
|
||||||
import 'buttons/edit_icon_button.dart';
|
import 'buttons/edit_icon_button.dart';
|
||||||
import 'entities/entity_state_title.dart';
|
import 'entities/entity_state_title.dart';
|
||||||
|
|
@ -51,6 +52,8 @@ class ViewScaffold extends StatelessWidget {
|
||||||
icon: Icon(Icons.clear),
|
icon: Icon(Icons.clear),
|
||||||
onPressed: () => store.dispatch(ClearEntityFilter()),
|
onPressed: () => store.dispatch(ClearEntityFilter()),
|
||||||
);
|
);
|
||||||
|
} else if (isNotMobile(context)) {
|
||||||
|
leading = Icon(getEntityIcon(entity.entityType));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +69,7 @@ class ViewScaffold extends StatelessWidget {
|
||||||
title: EntityStateTitle(
|
title: EntityStateTitle(
|
||||||
entity: entity,
|
entity: entity,
|
||||||
title: title,
|
title: title,
|
||||||
showStatus: true,
|
showStatus: false,
|
||||||
),
|
),
|
||||||
bottom: appBarBottom,
|
bottom: appBarBottom,
|
||||||
actions: entity.isNew
|
actions: entity.isNew
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ class ClientOverview extends StatelessWidget {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: client,
|
||||||
label: localization.paidToDate,
|
label: localization.paidToDate,
|
||||||
value: formatNumber(client.paidToDate, context, clientId: client.id),
|
value: formatNumber(client.paidToDate, context, clientId: client.id),
|
||||||
secondLabel: localization.balanceDue,
|
secondLabel: localization.balanceDue,
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ class CreditListItem extends StatelessWidget {
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
width: 80,
|
width: 100,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,10 @@ class ExpenseOverview extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
expense.isConverted
|
expense.isConverted
|
||||||
? EntityHeader(
|
? EntityHeader(
|
||||||
backgroundColor: ExpenseStatusColors.colors[expense.statusId],
|
entity: expense,
|
||||||
|
statusColor: ExpenseStatusColors.colors[expense.statusId],
|
||||||
|
statusLabel:
|
||||||
|
localization.lookup('expense_status_${expense.statusId}'),
|
||||||
label: localization.amount,
|
label: localization.amount,
|
||||||
value: formatNumber(expense.amountWithTax, context,
|
value: formatNumber(expense.amountWithTax, context,
|
||||||
currencyId: expense.expenseCurrencyId),
|
currencyId: expense.expenseCurrencyId),
|
||||||
|
|
@ -63,7 +66,10 @@ class ExpenseOverview extends StatelessWidget {
|
||||||
currencyId: expense.invoiceCurrencyId),
|
currencyId: expense.invoiceCurrencyId),
|
||||||
)
|
)
|
||||||
: EntityHeader(
|
: EntityHeader(
|
||||||
backgroundColor: ExpenseStatusColors.colors[expense.statusId],
|
entity: expense,
|
||||||
|
statusColor: ExpenseStatusColors.colors[expense.statusId],
|
||||||
|
statusLabel:
|
||||||
|
localization.lookup('expense_status_${expense.statusId}'),
|
||||||
label: localization.amount,
|
label: localization.amount,
|
||||||
value: formatNumber(expense.amountWithTax, context,
|
value: formatNumber(expense.amountWithTax, context,
|
||||||
currencyId: expense.expenseCurrencyId),
|
currencyId: expense.expenseCurrencyId),
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class InvoiceListItem extends StatelessWidget {
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
width: 80,
|
width: 100,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,9 @@ class InvoiceOverview extends StatelessWidget {
|
||||||
|
|
||||||
final widgets = <Widget>[
|
final widgets = <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
backgroundColor: color,
|
entity: invoice,
|
||||||
|
statusColor: color,
|
||||||
|
statusLabel: localization.lookup('${invoice.entityType}_status_${invoice.statusId}'),
|
||||||
label: localization.totalAmount,
|
label: localization.totalAmount,
|
||||||
value:
|
value:
|
||||||
formatNumber(invoice.amount, context, clientId: invoice.clientId),
|
formatNumber(invoice.amount, context, clientId: invoice.clientId),
|
||||||
|
|
@ -72,9 +74,11 @@ class InvoiceOverview extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<String, String> fields = {
|
final Map<String, String> fields = {
|
||||||
|
/*
|
||||||
InvoiceFields.statusId: invoice.isPastDue
|
InvoiceFields.statusId: invoice.isPastDue
|
||||||
? localization.pastDue
|
? localization.pastDue
|
||||||
: localization.lookup(stauses[invoice.statusId]),
|
: localization.lookup(stauses[invoice.statusId]),
|
||||||
|
*/
|
||||||
InvoiceFields.invoiceDate: formatDate(invoice.date, context),
|
InvoiceFields.invoiceDate: formatDate(invoice.date, context),
|
||||||
dueDateField: formatDate(invoice.dueDate, context),
|
dueDateField: formatDate(invoice.dueDate, context),
|
||||||
InvoiceFields.partial: formatNumber(invoice.partial, context,
|
InvoiceFields.partial: formatNumber(invoice.partial, context,
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,10 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
final fields = <String, String>{};
|
final fields = <String, String>{};
|
||||||
|
/*
|
||||||
fields[PaymentFields.paymentStatusId] =
|
fields[PaymentFields.paymentStatusId] =
|
||||||
localization.lookup('payment_status_${payment.statusId}');
|
localization.lookup('payment_status_${payment.statusId}');
|
||||||
|
*/
|
||||||
if (payment.date.isNotEmpty) {
|
if (payment.date.isNotEmpty) {
|
||||||
fields[PaymentFields.paymentDate] = formatDate(payment.date, context);
|
fields[PaymentFields.paymentDate] = formatDate(payment.date, context);
|
||||||
}
|
}
|
||||||
|
|
@ -72,8 +74,10 @@ class _PaymentViewState extends State<PaymentView> {
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
backgroundColor:
|
entity: payment,
|
||||||
|
statusColor:
|
||||||
PaymentStatusColors.colors[payment.statusId],
|
PaymentStatusColors.colors[payment.statusId],
|
||||||
|
statusLabel: localization.lookup('payment_status_${payment.statusId}'),
|
||||||
label: localization.amount,
|
label: localization.amount,
|
||||||
value: formatNumber(payment.amount, context,
|
value: formatNumber(payment.amount, context,
|
||||||
clientId: client.id),
|
clientId: client.id),
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ class _ProductViewState extends State<ProductView>
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: product,
|
||||||
label: localization.price,
|
label: localization.price,
|
||||||
value: formatNumber(product.price, context),
|
value: formatNumber(product.price, context),
|
||||||
secondLabel: localization.cost,
|
secondLabel: localization.cost,
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ class _ProjectViewState extends State<ProjectView> {
|
||||||
List<Widget> _buildView() {
|
List<Widget> _buildView() {
|
||||||
final widgets = <Widget>[
|
final widgets = <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: project,
|
||||||
label: localization.total,
|
label: localization.total,
|
||||||
value: formatDuration(taskDurationForProject(
|
value: formatDuration(taskDurationForProject(
|
||||||
project, viewModel.state.taskState.map)),
|
project, viewModel.state.taskState.map)),
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ class QuoteListItem extends StatelessWidget {
|
||||||
style: TextStyle(fontSize: 14),
|
style: TextStyle(fontSize: 14),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
width: 80,
|
width: 100,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,8 @@ class _TaskViewState extends State<TaskView> {
|
||||||
List<Widget> _buildView() {
|
List<Widget> _buildView() {
|
||||||
final widgets = <Widget>[
|
final widgets = <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
backgroundColor: task.isInvoiced
|
entity: project,
|
||||||
|
statusColor: task.isInvoiced
|
||||||
? Colors.green
|
? Colors.green
|
||||||
: task.isRunning ? Colors.blue : null,
|
: task.isRunning ? Colors.blue : null,
|
||||||
label: localization.duration,
|
label: localization.duration,
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ class _TaxRateViewState extends State<TaxRateView> {
|
||||||
onBackPressed: () => viewModel.onBackPressed(),
|
onBackPressed: () => viewModel.onBackPressed(),
|
||||||
body: ListView(children: [
|
body: ListView(children: [
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: taxRate,
|
||||||
label: localization.name,
|
label: localization.name,
|
||||||
value: taxRate.name,
|
value: taxRate.name,
|
||||||
secondLabel: localization.rate,
|
secondLabel: localization.rate,
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ class UserView extends StatelessWidget {
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: user,
|
||||||
value: user.email,
|
value: user.email,
|
||||||
label: localization.email,
|
label: localization.email,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ class VendorOverview extends StatelessWidget {
|
||||||
return ListView(
|
return ListView(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
EntityHeader(
|
EntityHeader(
|
||||||
|
entity: vendor,
|
||||||
label: localization.total,
|
label: localization.total,
|
||||||
value: formatNumber(
|
value: formatNumber(
|
||||||
memoizedCalculateVendorBalance(vendor.id, vendor.currencyId,
|
memoizedCalculateVendorBalance(vendor.id, vendor.currencyId,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue