I have a ListView in Flutter and want to send Multiple data into Next widget, but when I add a checkout button, it's showing 3 times because I have 3 items in my cart List so I can't add button in my ListView but when I have tried this button in bottomNavigationBar but I can't access Listing view data. Below is the Screenshot.
I am not able to understand your question, can you phrase it more clearly, try short sentences. Also make sure to add your code, if it is too large then add your GitHub, or any other public repo link so we can see the code. Final thing, I can't see any screenshots.
Related
So lets say I have 3 Pages : [StartingPage, NamePage, AdressPage] inside a PageView.
Each of those children has a TextFormField inside it.
When I am at StartingPage I want to call .validate() on the keys of the TextFormFields on NamePage and AdressPage and I want the errorLabels to show, when the user navigates to the other pages. The problem is that currently, the validation only works for the TextFormFields that are on screen.
So basically there are two questions:
Is it possible to pre-build pages of a pageview? Otherwise when I call formFieldKey.currentState the state is null if I haven't navigated to the respective page.
Is there another way to validate offscreen TextFormField content and show the errorlabel, when they come into view?
Unfortunately Flutter Dosen't Support Multi-Page Forms So You Need To Implement Advanced State Management To Make This Happen.
I Used Riverpod To Create a 4 Page Form By Creating A Form Key For Every Page And Saving The State of the Forms, This Way Every Form Will keep Its State Until You Dispose Of it, Hope This Helped.
I can able to pick the images from gallery and show it up in the UI. I have to delete the one by image after selecting. I done the UI, by showing the red cancel button for each image . But i am unable to delete and show it up un the UI. Please help.
this is my code.
Extract the Bottom Sheet Widget to Separate Stateful Widget and it should work.
setstate won't work inside that particular Bottom Sheet until it's separated to a Stateful Widget. Give it a try.
I Done by myself. The issue is i am using bottom sheet to add the images. To delete the images i called removeAtIndex. it works fine. The problem is the bottom sheet does not know the state of the context, so added statefull builder for the bottom sheet. Now it works fine.
On the home screen on my app :
I have a list view with a bunch of card widgets and a screenshot action associated with each card widget. When I click on the screenshot action it captures the screenshot of that widget as it’s supposed to.
I have a floating action button which when clicked takes me to an add screen where I add data and save it to the database. Once saved a snackbar message is displayed and screen is popped out. The list view now displays the new record as a card widget.
PROBLEM :
After adding the record, when I click the screenshot action no widget screenshot is captured and on debugging I noticed the “Uint8List? image” is null.
Now if I scroll the list view and perform the screenshot action again everything seems to work.
It sounds to me that this might be a widget tree rebuild issue, but I am not sure how to go about with it. I have other actions, edit and delete on the card widget and they work without any issue.
Package used: screenshot 1.2.3
I'm building multiple form pages in one class, I create 4 widgets each widgets is represent a page with text fields or cards or radio buttons.
and I create a method to switch between pages when. I press next.
This works as expected ^^
My issue UI inside first page is not refreshed unless I press ctrl + S,,
inside the first page of the form, I have created custom radio buttons they're simply cards.
and when tap on any card, there's set state method, to highlight the selected card by changing its style..
This works perfectly! at the beginning when I call the first page 1 directly as a child inside the scaffold..
However, after I created the method to switch between pages.. The UI in page 1 does not refresh..
I will put a picture..
Picture of the method to switch pages
Picture of pages widgets
picture of scaffold and how I call the widget pages
this is a picture of custom radio button which has cards, the card color change if it's selected
I tried many ways! but it didn't work..
Is what I'm trying to do correct? I'm a beginner in flutter
& I have a project to submit :(
I couldn't find a solution in google,,
Try making the widgets StatefulWidget and call setState((){}) inside the widget when you tap on the cards.
So here's what I did ^^
because the issue was just in page 1, so I in the scaffold I added page 1 as it's child directly without Switch page method..
Then inside page1, a button that will navigate to another class,
the second class has exactly the same scaffold and app bar as previous page.. But, in it's child I added calledWidget which switch between pages from 2 to 4 in my case ^^
So short words, I put page 1 in a separate page and the rest of the pages in a switch method in separate class
it works, but I hope I don't find any difficulties When saving values & integrating API to post the values
what you think?
Pardon me if this is a naive question but I am trying to figure out a way in Flutter to load different data when the user clicks a button. The way I currently see is routing the user to a new screen everytime but I am sure there would be a better approach without loading the whole screen everytime
You should use a Stateful Widget
I would create a Future Builder / ListView Builder. Depending on how you want it to behave you could have the ListView items clear before regenerating the list of items to show.
Future Builder you could create a function to return certain widgets depending on the request you make with the function.