Ensure buttons visible - flutter

I want to scroll buttons into view in two different scenarios.
One scenario is upon clicking a list item, and the second scenario is when a text field is focused.Gif showing both scenarios
From the example, I would like the "edit" and "delete" buttons to scroll into view when the list item is clicked. And I would like the "Save" and "Cancel" buttons to scroll into view when the text field is focused.
Any guidance is appreciated!

Wrap your buttons with Visibility widgets, and use bool variables to set when they should be visible.

Related

Adding Textfields to scroll view programmatically?

I am trying to add a textfield to a scroll view and outlet collection on button press, how am i to do this?
Can't seem to find my answer elsewhere.
You could just add it in the beginning, have it hidden, and bring it forward on the button press by either changing the .isHidden attribute or changing .alpha.
If you want to reposition other elements in the view when it's unhidden, you can add layout constraint outlets and activate new ones each time the button is pressed.

Overlaying buttons on tableviewcell with collectionview inside

I have implemented a image slider with a UICollectionView inside a UITableViewCell which the user can slide to left and right. I want to create two buttons on this UITableViewCell so the user can also tap on that buttons to slide the images.
I've done this by adding the buttons on the images inside the UICollectionViewCells but with that the buttons also are swiping when the user swipes to left or right or taps the buttons.
I tried to fix the buttons on the UITableViewCell, but anyhow the buttons does not get displayed, when I do it like this.
So how can I achieve this, that the buttons are fixed inside the UITableViewCell and the UICollectionView inside the UITableViewCell can move it cells without effecting these two slider buttons?
At storyboard it looks like this:
Can't rearrange the buttons:
Add the buttons directly to the content view of the table view cell, don't add them to the collection view. That way they will stay in position. If you can't see them it's possible that they were underneath the collection view and were obscured. Change the order of the views in interface builder by dragging and dropping in the document outline. This changes which view is on top.
The document outline is the view you have posted as a screenshot in your question, starting at "brandsCollectionTableViewCell". The outline contains the subviews of the cell. Views with the same parent, like the image view, label and buttons currently shown in the outline, will be ordered "on top" of each other by their position in the list. So you drag the items in that list to change the order, or select the buttons then go to Editor -> Arrange -> Send XX to adjust the position.
Use the Xcode view hierarchy debugger to help you understand what is happening (that's this button on the debugging toolbar):
The 3D view will let you see where your "missing" buttons are.
If you really want to include the buttons in the collection view, then you need to use a custom collection view layout implementing floating views. That's not a straightforward task, but I've written something about it here.

What options do I have to provide a feature to allow sorting of a UITableView?

I'm quite short on space. My navigation bar is full. Ideally I'm looking for something below the navigation bar which once tapped will change the sort order of the rows in my uitableview.
I'm looking for options ?
One option is to add tableHeaderView to the table view with the buttons which trigger the sorting action. If your table view contains only one section you can add it as section header(better use tableHeaderView).
Adding UISegmentedControl with the segments(for different types of sorting) as the tableHeaderView is an elegant way.
One option (although much less discoverable than items on the navbar) would be to re-sort when components of the cell are tapped. For example, let's say the cell had a picture on the left of a user, a title and a score. As you tapped on each component of the cell, it would sort by that component. Repeated taps on the same cell component would toggle between ascending and descending. That has the downside of intercepting the cell tap and you would only drill in when tapping on an area of the cell that you're not sorting by.
You could create a really snazzy custom toolbar that appears by tapping a gear shaped button on the navigation bar. It could slide down from under the navigation bar and sit there right below it, and when you finish with it you could send it right back under the navigation bar, hidden.
The advantage of that is your app has a really cool custom toolbar, and all of your buttons are secreted away in a single organized toolbar - the disadvantage being that you actually have to invent one of these.
As I'm thinking about it though, if you have buttons that are navigation related taking up all the space - not ones that do stuff - then this probably won't work.

appcelerator tableview autosliding

Using Appcelerator:
I have a form, a tableView with textFeilds
I want it so when I focus on them, it slides the window or the view to the top, under the navigation bar.
Right now, the keyboard is blocking the last few rows.
Do I need a listener on each form to slide? If so how do you do that?
You could add a focus listener to each of your textFields.
Then you should be able to move the tableview using scrollToTop or scrollToIndex.
If there are a fixed number of textfields you might want to try using a scrollview instead of a tableview. This will handle the move-up action for you when the individual taps in a textfield.

UIAlert button size

Is there a way to specify the size of a UIAlert button?
Is there a way to specify the layout of buttons on UIAlert? Like having three buttons next to each other and a cancel button on the buttom?
Is there a way to specify the size of a UIAlert button?
No easy way. The buttons must fill the whole dialog horizontally unless you heavily override its internal -layout method, or mess with the frames of the UIAlert's subview after it's shown.
Is there a way to specify the layout of buttons on UIAlert? Like having three buttons next to each other and a cancel button on the buttom?
There used to be an int numberOfRows property to specify how the buttons distribute, but this is now ignored for UIAlertView.
You can add a subview with any buttons you'd like to the UIAlertView and grow its height to match. It is difficult to get it to lay out properly if you use any standard alert buttons, titles, or messages.