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