Update List in FutureBuilder using GetX in Flutter - dart

I'm using the FutureBuilder with GetX and I want to update(add, Edit or remove) the below type of list.
var cardListDetails = Future.value(<CardRenterModel>[]).obs;
Thanks in advance

Related

Problem updating UI with RiverPod in Flutter?

I have a Widget containing a button which increases product quantity in a product list and shows the updated value in a textBox. I am using Riverpod for Statemanagement.
Here is a ItemCounter Widget:
final appNotifier = ref.watch(applicationProvider.notifier);
ItemCounter(
quantity: appNotifier.getQuantityByProductId(product.id!),
onChanged: (i) => appNotifier.setProductQuantity(
i: i, productId: product.id!),
),
When I use above code the UI doesn't update after each click on the button! But when I add this line it works, even though I don't use appProvider anywhere in the code!
// appProvider has no usage in the code but it helps to update UI
final appProvider = ref.watch(applicationProvider); <-----This line
final appNotifier = ref.watch(applicationProvider.notifier);
ItemCounter(
quantity: appNotifier.getQuantityByProductId(product.id!),
onChanged: (i) => appNotifier.setProductQuantity(
i: i, productId: product.id!),
),
By design :)
-> When we use ref.watch(applicationProvider), we listen for state changes (and access it) and trigger a rebuild of the widget whenever it has changed.
-> When we use ref.watch(applicationProvider.notifier), we access the listener class and always have the current version of notifier. The rebuilding will not be triggered.

MultiselectComboBox options for be open

How can I achieve this in Vaadin?
MultiselectComboBox box = new MultiselectComboBox();
I can see a dropdown list which works fine , but I am looking for a function where the dropdown is open by default.
You can try ListSelect :-
ListSelect

Flutter: Sort, Drag and Drop between multiple lists or columns

I've been researching some list sorting libraries like flutter_list_drag_and_drop, reorderable_list, flutter_reorderable_list, dragable_flutter_list, and others, but all work with only one list.
What I'm wanting to do can be understood in the image below, which is exactly what the Trello app has.
Any library suggestions or how to do this?
I've been researching some list sorting libraries like flutter_list_drag_and_drop, reorderable_list, flutter_reorderable_list, dragable_flutter_list and others, but all work with only one list.
Right ! All current available libraries work with only one list.
I got one more plugin called orderable_stack which is based on a "data items" list
Please refer orderable_stack for more details.
Also you can refer this link for more draggable implementations.
Note: Currently orderable_stack is incompatible with Dart 2
Hope this will helps you
I use boardview flutter plugin.
import 'package:boardview/board_item.dart';
import 'package:boardview/board_list.dart';
import 'package:boardview/boardview.dart';
#override
Widget build(BuildContext context) {
List<BoardList> boardList = List<BoardList>();
List<BoardItem> boardItem = List<BoardItem>();
boardItem.add(new BoardItem(
boardList: BoardListState(),
item: boarditem(),
test: '1',
));
boardList.add(BoardList(
index: 1,
items: boardItem,
header: header()
));
Widget header() {
return Row( ... );}
Widget boarditem() {
return Card( ... );}
return BoardView(
lists: boardList,
);
}
Just to complete this old question and for the case someone like me is searching in 2021 here is a package that can manage drag and drop items from one list to another and drag and drop these lists themselves.
Flutter package from pub.dev
Tutorial can be found here: Tutorial by Johannes Milke
If you still haven't found a good solution there's the boardview flutter plugin.
It has the same features as trellos draggable lists.
(P.S. I'm the developer for it I was lazy when creating it so there are no example gifs for it)

Programmatically select a row in Grid in Vaadin 7?

In the Grid widget in Vaadin 7.5.3, we can determine the current selection of rows by calling SelectionEvent::getSelected or Grid::getSelectedRows.
So how do we set the selection programmatically?
While that's true that official documentation for Grid class doesn't have this method stated, still you can do it programmatically. I won't argue whether it's a bug or not. Firstly you need to know what is your SelectionMode. Then you can select a row (or rows):
#Override
protected void init(VaadinRequest request) {
final VerticalLayout layout = new VerticalLayout();
Customer c = new Customer(1);
container = new BeanItemContainer<>(Customer.class, Arrays.asList(c, new Customer(2)));
grid = new Grid(container);
grid.setSelectionMode(SelectionMode.SINGLE);
SingleSelectionModel m = (SingleSelectionModel) grid.getSelectionModel();
m.select(c);
layout.addComponents(grid);
setContent(layout);
}
In newer Vaadin (in my case 7.5.6) there is select(Object) method directly in Grid interface.
Example:
Grid grid = new Grid(container);
grid.setSelectionMode(Grid.SelectionMode.SINGLE);
grid.select(row);
The row object for example could be taken from SelectionListener event or from added before object (as in #kukis answer).
Setter Method Missing (bug?)
The Book of Vaadin mentions the setter method Grid::setSelectedRows along with a getter.
The currently selected rows can be set with setSelectedRows() by a collection of item IDs, and read with getSelectedRows().
However, the Grid class doc does not list that method. Nor does NetBeans 8.0.2 suggest that method in its auto-complete.
So apparently a bug. See Ticket # 18,580.

setFilteringMode in ListSelect

Can I use setFilteringMode of ComboBox in ListSelect ? I didn't found anyway to do this. I am so supprised due to this mothod didn't support in ListSelect. I don't think ComboBox and ListSelect are too many differences. So , if I want to use Filtering in ListSelect , how can I figure it out ?
As a possible solution, you can create a textfield below your ListSelect and use a filterable container (https://vaadin.com/api/com/vaadin/data/Container.Filterable.html) as the data source of your ListSelect and apply a container filter e.g. on each "return" in this textfield or even on each text-change event.
IndexedContainer c = new IndexedContainer();
listSelect.setContainerDataSource(c);
Filter filter = new SimpleStringFilter("name", "Douglas", true, false);
c.addContainerFilter(filter);
See the Book of Vaadin - Filterable Containers

Resources