I am looking to create in Flutter a modal dialog that slides in from the bottom and
Appears with a given height (eg. 1/3 of the screen)
Expands vertically if the user scrolls up on it (and shrinks until disappearing if the user scrolls down)
Provides some kind of callback or observable so that I can know when it reaches the top of the screen/parent. (I need this in order to create a back arrow on the top left corner of the panel itself)
Is there any way to achieve this?
I have found the package sliding_up_panel to be really nice, but lacking the third feature.
The SlidingUpPanel does actually have everything you need. You want to use the onPanelSlide property from it which will provide you the current % opened of the panel normalized ([0, 1.0]), so if you want to know when it reaches the top you, it's when its current position is at 1.0.
As an alternative, you may want to take a look at DraggableScrollableSheet widget, but IMO, SlidingUpPanel is more versatile.
Related
my job is to create a few widgets using widgetkit and swiftui, however the main project is build on uikit so I am not very good with swiftUI. Nevertheless, I would like to know whether I can add a graph inside of, for example, medium sized widget, and can the graph be scrollable to reveal more information? Or could it only be clickable? Thank you.
I know how widgets work, just interested in whether it is possible to create a scrollable graph inside of a medium sized widget.
I'm only just getting started with widgets myself, so happy to be corrected. But interactivity with widgets is very limited - effectively to taps and nothing else. They're designed more to be informational displays than interactive user interfaces.
If your widget is larger than the small size (the square one that takes up the same space as 2x2 app icons on the iPhone home screen), you can have multiple tap targets. For example, if your widget had a list of calendar items, you could set it up so that a user tapping on a specific item opened the app with a view showing that item in more detail.
So no, a scrollable graph isn't feasible. But what you can do is create a graph that shows a snapshot of data that a user is most likely to find useful when glancing at their home screen – and making sure that if they tap on it, they go straight through to a more interactive version of the same data.
I have programmed a modal buttom sheet which with this package (using a showCupertinoModalBottomSheet). This modal has a "header" which shows the heading and a close button on the left so the user knows what the modal is about and has a "footer" with two buttons to either apply the filter or reset it.
Between the header and the footer is a a Expanded component with a SingleChildScrollView inside in order to scroll inside the modal. This is needed because there are more filter options available than space! I am very happy that I found a solution without a SizedBox component which has a given height because the height of smartphones vary.
However, now I am facing one last problem: Sadly I am not able to scroll to the bottom of my SingleChildScrollView. This problem also occurs when removing the "footer" with the two buttons. Means, the SingleChildScrollView goes beyond the screen height (which is fine) but which is useless when I am not able to scroll to the bottom of my list. At the end of this post I have added an image so you can see the problem.
Here you can find my dartpad without the modal buttom sheet which is not supported yet on dartpart. However, because dartpad presents the web view instead of the mobile view I am not able to recreate the problem 100%. When using the mouse wheel to scrol you can scroll to the end of the list. But as you can see in the image below in the mobile version is does not work!
Does anyone has an idea how I can solve this?
I already have tried adding Containers with padding and margin to the bottom but this sadly doesn't work or leads to rendering issues.
There is also a stackoverflow post which seems to solve this problem but that leads to an rendering issue for me: https://stackoverflow.com/a/63613723/9445999
Image:
Kind regards and thank you!
I used showModelBottomSheet a lot that pops on the screen from the bottom with a nice animation.
Now I want to use something similar that pops on the screen from the right-hand side instead of the bottom.
It helps me a lot for UI purposes when the user rotates the screen to landscape, then I want to show a pop up from right in the flutter.
I tried to find and also dig deeper inside showModelBottomSheet function but no luck.
Try using drawer on right side it may solve your problem
answered in link below
How to place Drawer widget on the right
I don't think that exists either in Material or Cupertino design language, so no, unfortunately. However, you could build that yourself pretty easily with a Stack widget.
I would like to have a tab bar that looks like this:
Note the center "My ID" button.
So here is my main problem:
Obviously I need a SafeArea to deal with irregular shaped screens, which itself need to be embedded in a Container so I can give the bar its background color. But, by doing this, how can I create the "oversized" button at the center?
After spending several hours banging my head against the wall, found a not so elegant solution. (Hey, but it works)
Here's a picture of the result.
So the way I made it work is actually by having two layers.
On the base of the widget tree is a Stack which contains everything that is currently seen on this page.
The actual bar widget has the text and icons, (the My ID part has only text no icon, but a placeholder SizedBox is used in place of the icon otherwise would be there)
By using the stack, I am able lay the round icon on top of the entire bar much like a FloatingActionButton
As you can see in the below image, the search box is at the top right corner.
Sometimes this image will cover up the text underneath it. Is there a way to move the search box to some other place? For example, like Atom's or Sublime's search box.
NO, there is currently no way to move it.
There was discussion on this amongst the vscode developers: Find Widget UI enhancement.
We should definitely not make this move both vertically and
horizontally since we do not do this anywhere else in our UX.
Introducing such a new concept does not align well with our general
workbench UX which is not very flexible
Looking at the pictures the docked find widget at the top / bottom
feel too heavy for me.
The current find widget solution I like because it is similar to the
chrome experience which every user on the planet is familiar with
While implementing the docking solution, we found we can actually
split this two issues completely. For the issue of covering search
result, we can allow users to scroll beyond the first line by the
height of Find Widget. It doesn't change Find Widget at all, you can
only scroll beyond first line only when the Find Widget is visible so
it won't cover anything.
I made two changes to the Find Widget for this work item.
You can resize the Find widget horizontally
You can scroll beyond the first line when the find widget is visible.
Which gives us the only customizations we can do to the search/find widget if it (as you said) "covers up text underneath it":
You can adjust the width horizontally
You can set "editor.find.addExtraSpaceOnTop": true to allow "scroll beyond the first line when the Find Widget is visible"