There is an icon on the Appbar that darkens when it is tapped. How do I add the current Food displaying on the page to a list of favFoods that has all favorited foods on it. I don't know how to access the data on Food since they are both in separate files and functions.
Related
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?
I have created a listview where I show some movies which I get from a json file. I have added a button "Add favorite" so the movies that I select should be displayed on another page "Favorites Page". When I unselect that button, the movie should be removed from the "Favorites Page". I want this data to be saved even after I restart my app. Is there any way to achieve that?
Sample Image When a user clicks a category it moves to another page and should show items by category. I'm new to Angular. using restful API.
Depending upon your method of navigation to the next screen, you can fetch the details of the category that was initially tapped.
In the ngOnInit() for the second screen, you should fetch/filter data based on that category.
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 !
After the right '+' button is pressed the item in that view is added to favorites and an UIAlertView is shown on screen saying "Added to Favorites". After it is added to favorites I make the '+' button disappear so the same item doesn't get added again to favorites. I am not sure if this ok with Apple's Human Interface Guidelines instead should the '+' remain there and if pressed again say "This item is already in favorites"?
Any help will be appreciated! Thanks
I wouldn't use the AlertView for this. By showing the alert, you force the user to confirm reading some confirmation message and taking action (by pressing the OK button). It is a good idea to provide feedback that the favorite was successfully added, but this should not be an intrusive alert. Perhaps you can use other design patterns for favorites, such as a star that lights up when pressed to indicate that the item is listed as a favorite, or perhaps an animation effect that 'moves' the selected item to a visible 'favorites' category.
The Human Interface Guidelines have this to say about the Alert view (in relation to your question):
Avoid creating unnecessary alerts.
These alerts are usually unnecessary
if they:
Merely increase the visibility of some
information, especially information
that is related to the standard
functioning of your application.
Instead, you should design an
eye-catching way to display the
information that harmonizes with your
app’s style.
Why not have two states for the button ? A "selected" state (for example negative contrast) showing the item is in favorites, and a "normal" state indicating it can be taped.
This way you can add/remove from favorite using the same button, and in a less obstructive way than with a UIAlertView.
I also suggest you use a ★ instead of a +