How to load card item from a list opened upon Onclick on the same card in jetpack compose - android-listview

I have a screen listing 4 cards in total. When I click on any one card, a list of items is shown. Users can select any one item from the list. After clicking done, the selected item should be loaded only on the card which was clicked. I am implementing this use case in jetpack compose. I have tried using a mutable state for each card but as the screen of cards and the list of items are in is a different composable function, so not able to maintain the state of the card. How can I perform this use case with help of view model?

Related

Flutter widget choice

Im creating for my girlfriend app for her work that will store her customers with some details and dates when they comes to her.
It is my first application, and also im new to flutter, as far i have one screen where i have button when i pressed it, shows bottomsheet with form to add customer and additional info in to listviews Card that build in body on this screen.
Soo far i have that correct.
My problem is i want to add something like this...
when i click on that added card i want it to take to another screen or unwind/ show textfield for that specific card when she could add dates for that client.
Any suggestions for me what to change or what widget/method to use?
You should implement a navigation so you can bring the user to a new page and pass an argument when you want to load the data. Best example is with the todo list : https://flutter.dev/docs/cookbook/navigation/passing-data

Bring back first card on screen after swiping last card/all cards (flutter)

I am using flutter tindercard package. Currently, after swiping all cards, screen goes blank, i.e. it doesn't show any more cards.
But I want to show cards again repeatedly starting from the first card. Kind of loop, where user is presented with first card again after swiping all cards.
Each card has a button, which will take user to a screen (which is same for all cards), so its not about like or dislike thing, if user will click on submit button of any card, swipe card screen will navigate out of current screen. Final action will happen only when user will tap on that submit button, that's why I want this loop of cards.
Checked the documentation, nothing much is written or explained. Checked all the available functions/parameters of the package, no idea how to achieve this functionality.
Maybe something can be done in 'swipeCompleteCallback(CardSwipeOrientation orientation, int index){}', but don't know exactly how. This seems more linked to action related to swipe complete of a individual card.
This is the question you were asking for is here on the github issue.

Flutter: How to properly listen to providers changes when on details page?

Here is my question, I have a simple grid list, where each tile contains a text and a favorite icon.
That grid is linked to a provider (which contains all the data), and each tile is linked to a nested provider which points to an individual element of the list provided above.
Now when I click on a tile I navigate to a details page, which just shows the name of the object, a favorite icon (outlined or not if the object is favorite or not) and a button "mark as favorite".
(I do that via Navigator with an argument representing my object, that I retrieve after from the grid provider)
Now when I click on the button I want to mark that object as a favorite, which is working fine (in the grid it shows the good status thanks to the provider), BUT how do I update my details page right away ?
Should I always use a stateful widget in that case ? or is there another way to "listen" to my item provider ?
I suppose that somehow I should be able to mark my details page as a listener of my provider, but I don't know how cause the details page is not in the same hierarchy as my grid tile...
Thanks for any feedback on this !

Questions about Android listview

If I have more than 100 items in listview then is there any better solution than creating new 100 classes and XML files for staring new activity on click of each list item?
Using switch case and array of list items I can create but I am searching better solution than this
I am new to Android development
If any one having any idea please share it.
Thanks in advance.
You wrote:
"I am having predefined list of items in my project but it is having around 150 items in list and after clicking on item there must be new page which shows some text and images on next page"
So make only one new Activity and display text and images depending on the selected item. At the onCreate-Method of your Activity ask for the selected value from the list (you can transport this item/its name as a String with a Bundle). And depending on the selected item you generate your text and your images and - if needed - their functionality.

How to determine which ListView item was clicked upon by the user?

how to fill listview with data that comes from online database.
Also,say the list view has several rows of items(say a list containing book titles),and the user clicks one of them.
How can the app determine which row was selected by the user,so that the details of the item(book) will be then fethed from the database and displayed in another activity.
So basically what I am asking is-How to determine which item on the listview was selested by the user.