Workaround for web typeahead issues
This commit is contained in:
parent
f66e9c102f
commit
3850a63b15
|
|
@ -133,9 +133,26 @@ class _EntityDropdownState extends State<EntityDropdown> {
|
|||
.toList();
|
||||
},
|
||||
itemBuilder: (context, entityId) {
|
||||
// TODO remove this
|
||||
/*
|
||||
return _EntityListTile(
|
||||
entity: _entityMap[entityId],
|
||||
filter: _textController.text,
|
||||
entity: _entityMap[entityId],
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
||||
|
|
@ -131,17 +132,6 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
|||
key: ValueKey(
|
||||
'__line_item_${index}_${lineItems[index].createdAt}__'),
|
||||
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: const EdgeInsets.only(right: kTableColumnGap),
|
||||
child: TypeAheadFormField<String>(
|
||||
|
|
@ -154,9 +144,37 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
|||
.toList();
|
||||
},
|
||||
itemBuilder: (context, suggestion) {
|
||||
// TODO fix this
|
||||
/*
|
||||
return ListTile(
|
||||
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) {
|
||||
final item = lineItems[index];
|
||||
|
|
@ -185,7 +203,6 @@ class _InvoiceEditItemsDesktopState extends State<InvoiceEditItemsDesktop> {
|
|||
debounceDuration: Duration(seconds: 0),
|
||||
),
|
||||
),
|
||||
*/
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: kTableColumnGap),
|
||||
child: TextFormField(
|
||||
|
|
|
|||
|
|
@ -914,11 +914,28 @@ class ReportResult {
|
|||
.toSet()
|
||||
.toList();
|
||||
},
|
||||
itemBuilder: (context, String entityId) {
|
||||
itemBuilder: (context, String value) {
|
||||
// TODO fix this
|
||||
/*
|
||||
return Padding(
|
||||
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) {
|
||||
textEditingControllers[column].text = value;
|
||||
|
|
|
|||
Loading…
Reference in New Issue