Workaround for web typeahead issues
This commit is contained in:
parent
f66e9c102f
commit
3850a63b15
|
|
@ -133,9 +133,26 @@ class _EntityDropdownState extends State<EntityDropdown> {
|
||||||
.toList();
|
.toList();
|
||||||
},
|
},
|
||||||
itemBuilder: (context, entityId) {
|
itemBuilder: (context, entityId) {
|
||||||
|
// TODO remove this
|
||||||
|
/*
|
||||||
return _EntityListTile(
|
return _EntityListTile(
|
||||||
entity: _entityMap[entityId],
|
entity: _entityMap[entityId],
|
||||||
filter: _textController.text,
|
filter: _textController.text,
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
return Listener(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
child: _EntityListTile(
|
||||||
|
entity: _entityMap[entityId],
|
||||||
|
filter: _textController.text,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPointerDown: (_) {
|
||||||
|
final entity = _entityMap[entityId];
|
||||||
|
_textController.text = _entityMap[entityId].listDisplayName;
|
||||||
|
widget.onSelected(entity);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
onSuggestionSelected: (entityId) {
|
onSuggestionSelected: (entityId) {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:invoiceninja_flutter/constants.dart';
|
import 'package:invoiceninja_flutter/constants.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
||||||
|
|
@ -131,17 +132,6 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
key: ValueKey(
|
key: ValueKey(
|
||||||
'__line_item_${index}_${lineItems[index].createdAt}__'),
|
'__line_item_${index}_${lineItems[index].createdAt}__'),
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
|
||||||
child: TextFormField(
|
|
||||||
initialValue: lineItems[index].productKey,
|
|
||||||
onChanged: (value) => viewModel.onChangedInvoiceItem(
|
|
||||||
lineItems[index]
|
|
||||||
.rebuild((b) => b..productKey = value),
|
|
||||||
index),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
/*
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||||
child: TypeAheadFormField<String>(
|
child: TypeAheadFormField<String>(
|
||||||
|
|
@ -154,9 +144,37 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
.toList();
|
.toList();
|
||||||
},
|
},
|
||||||
itemBuilder: (context, suggestion) {
|
itemBuilder: (context, suggestion) {
|
||||||
|
// TODO fix this
|
||||||
|
/*
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(productState.map[suggestion].productKey),
|
title: Text(productState.map[suggestion].productKey),
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
return Listener(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: ListTile(
|
||||||
|
title: Text(productState.map[suggestion].productKey),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPointerDown: (_) {
|
||||||
|
final item = lineItems[index];
|
||||||
|
final product = productState.map[suggestion];
|
||||||
|
final updatedItem = item.rebuild((b) => b
|
||||||
|
..productKey = product.productKey
|
||||||
|
..notes = product.notes
|
||||||
|
..cost = product.price
|
||||||
|
..quantity = item.quantity == 0 &&
|
||||||
|
viewModel.state.company.defaultQuantity
|
||||||
|
? 1
|
||||||
|
: item.quantity);
|
||||||
|
viewModel.onChangedInvoiceItem(updatedItem, index);
|
||||||
|
_updateTable();
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
onSuggestionSelected: (suggestion) {
|
onSuggestionSelected: (suggestion) {
|
||||||
final item = lineItems[index];
|
final item = lineItems[index];
|
||||||
|
|
@ -185,7 +203,6 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
||||||
debounceDuration: Duration(seconds: 0),
|
debounceDuration: Duration(seconds: 0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
*/
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
|
|
|
||||||
|
|
@ -914,11 +914,28 @@ class ReportResult {
|
||||||
.toSet()
|
.toSet()
|
||||||
.toList();
|
.toList();
|
||||||
},
|
},
|
||||||
itemBuilder: (context, String entityId) {
|
itemBuilder: (context, String value) {
|
||||||
|
// TODO fix this
|
||||||
|
/*
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.all(12),
|
padding: const EdgeInsets.all(12),
|
||||||
child: Text('$entityId'),
|
child: Text('$value'),
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
return Listener(
|
||||||
|
child: Container(
|
||||||
|
color: Theme.of(context).cardColor,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
child: Text('$value'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPointerDown: (_) {
|
||||||
|
textEditingControllers[column].text = value;
|
||||||
|
onFilterChanged(column, value);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
},
|
},
|
||||||
onSuggestionSelected: (String value) {
|
onSuggestionSelected: (String value) {
|
||||||
textEditingControllers[column].text = value;
|
textEditingControllers[column].text = value;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue