Transactions
This commit is contained in:
parent
0dc6dc711e
commit
633193b29a
|
|
@ -120,7 +120,6 @@ class InvoiceSidebar extends StatelessWidget {
|
|||
itemBuilder: (BuildContext context, int index) {
|
||||
return InvoiceListItem(
|
||||
invoice: upcomingInvoices[index],
|
||||
showCheckbox: false,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => ListDivider(),
|
||||
|
|
@ -134,7 +133,6 @@ class InvoiceSidebar extends StatelessWidget {
|
|||
itemBuilder: (BuildContext context, int index) {
|
||||
return InvoiceListItem(
|
||||
invoice: pastDueInvoices[index],
|
||||
showCheckbox: false,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => ListDivider(),
|
||||
|
|
@ -152,7 +150,6 @@ class InvoiceSidebar extends StatelessWidget {
|
|||
? SizedBox()
|
||||
: InvoiceListItem(
|
||||
invoice: invoice,
|
||||
showCheckbox: false,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) => ListDivider(),
|
||||
|
|
|
|||
|
|
@ -22,16 +22,16 @@ class InvoiceListItem extends StatelessWidget {
|
|||
const InvoiceListItem({
|
||||
@required this.invoice,
|
||||
this.filter,
|
||||
this.showCheckbox = true,
|
||||
this.forceCheckbox = false,
|
||||
this.forceChecked = false,
|
||||
this.showCheck = false,
|
||||
this.isChecked = false,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
final InvoiceEntity invoice;
|
||||
final String filter;
|
||||
final bool showCheckbox;
|
||||
final bool forceCheckbox;
|
||||
final bool forceChecked;
|
||||
final bool showCheck;
|
||||
final bool isChecked;
|
||||
final Function onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -40,12 +40,6 @@ class InvoiceListItem extends StatelessWidget {
|
|||
final client = state.clientState.get(invoice.clientId);
|
||||
final uiState = state.uiState;
|
||||
final invoiceUIState = uiState.invoiceUIState;
|
||||
final listUIState = state.getUIState(invoice.entityType).listUIState;
|
||||
final isInMultiselect =
|
||||
forceCheckbox || (showCheckbox && listUIState.isInMultiselect());
|
||||
final isChecked = forceCheckbox
|
||||
? forceChecked
|
||||
: isInMultiselect && listUIState.isSelected(invoice.id);
|
||||
final textStyle = TextStyle(fontSize: 16);
|
||||
final localization = AppLocalization.of(context);
|
||||
final filterMatch = filter != null && filter.isNotEmpty
|
||||
|
|
@ -76,26 +70,28 @@ class InvoiceListItem extends StatelessWidget {
|
|||
}
|
||||
|
||||
return DismissibleEntity(
|
||||
isSelected: forceCheckbox
|
||||
? forceChecked
|
||||
: isDesktop(context) &&
|
||||
invoice.id ==
|
||||
(uiState.isEditing
|
||||
? invoiceUIState.editing.id
|
||||
: invoiceUIState.selectedId),
|
||||
showCheckbox: showCheckbox,
|
||||
isSelected: isDesktop(context) &&
|
||||
!showCheck &&
|
||||
invoice.id ==
|
||||
(uiState.isEditing
|
||||
? invoiceUIState.editing.id
|
||||
: invoiceUIState.selectedId),
|
||||
showCheckbox: showCheck,
|
||||
userCompany: state.userCompany,
|
||||
entity: invoice,
|
||||
child: LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return constraints.maxWidth > kTableListWidthCutoff
|
||||
? InkWell(
|
||||
onTap: () => selectEntity(
|
||||
entity: invoice,
|
||||
forceView: !showCheckbox,
|
||||
),
|
||||
onLongPress: () =>
|
||||
selectEntity(entity: invoice, longPress: true),
|
||||
onTap: () => onTap != null
|
||||
? onTap()
|
||||
: selectEntity(
|
||||
entity: invoice,
|
||||
forceView: !showCheck,
|
||||
),
|
||||
onLongPress: () => onTap != null
|
||||
? null
|
||||
: selectEntity(entity: invoice, longPress: true),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10,
|
||||
|
|
@ -107,9 +103,8 @@ class InvoiceListItem extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
child: isInMultiselect
|
||||
child: showCheck
|
||||
? IgnorePointer(
|
||||
ignoring: listUIState.isInMultiselect(),
|
||||
child: Checkbox(
|
||||
value: isChecked,
|
||||
materialTapTargetSize:
|
||||
|
|
@ -191,13 +186,14 @@ class InvoiceListItem extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
: ListTile(
|
||||
onTap: () =>
|
||||
selectEntity(entity: invoice, forceView: !showCheckbox),
|
||||
onLongPress: () =>
|
||||
selectEntity(entity: invoice, longPress: true),
|
||||
leading: isInMultiselect
|
||||
onTap: () => onTap != null
|
||||
? onTap()
|
||||
: selectEntity(entity: invoice, forceView: !showCheck),
|
||||
onLongPress: () => onTap != null
|
||||
? null
|
||||
: selectEntity(entity: invoice, longPress: true),
|
||||
leading: showCheck
|
||||
? IgnorePointer(
|
||||
ignoring: listUIState.isInMultiselect(),
|
||||
child: Checkbox(
|
||||
value: isChecked,
|
||||
materialTapTargetSize:
|
||||
|
|
|
|||
|
|
@ -44,10 +44,13 @@ class InvoiceListBuilder extends StatelessWidget {
|
|||
itemBuilder: (BuildContext context, index) {
|
||||
final invoiceId = viewModel.invoiceList[index];
|
||||
final invoice = viewModel.invoiceMap[invoiceId];
|
||||
final invoiceListState = viewModel.state.invoiceListState;
|
||||
|
||||
return InvoiceListItem(
|
||||
filter: viewModel.filter,
|
||||
invoice: invoice,
|
||||
showCheck: invoiceListState.isInMultiselect(),
|
||||
isChecked: invoiceListState.isSelected(invoice.id),
|
||||
);
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ class __MatchInvoicesState extends State<_MatchInvoices> {
|
|||
itemBuilder: (BuildContext context, int index) {
|
||||
return InvoiceListItem(
|
||||
invoice: _invoices[index],
|
||||
forceCheckbox: true,
|
||||
showCheck: true,
|
||||
onTap: () => null,
|
||||
);
|
||||
},
|
||||
)),
|
||||
|
|
|
|||
Loading…
Reference in New Issue