I am trying to reproduce this navigation bar (made on figma) with flutter :
I have already done the background shape with the CustomPaint class, however I cannot reproduce the shadow.
As you can slightly see, the border isn't equal along all borders, there is more shadow inside the half-circle in the middle than on the top border parts.
Also, I cannot control the blur and spread values (as with figma). Is there a way to achieve what I am trying to do. Or did I missed something ?
Related
I have a container, and I want it to have a custom border like the image below. I found ClipPath, which gave me the shape I wanted, but it doesn't provide the border. I also found ShapeBorder, but I don't know how to deal with it. My question is, "How do I make this shape with a border in a professional way?
How do you make the top section where the widgets scroll and disappear on top has rounded corners so it seems natural?
To make it clearer, here's what I tried to do but didn't work:
The idea is to make the blue-colored section in the middle transparent to show the widgets when it scrolls to disappear while having rounded corners to keep the design language consistent. But so far, if I were to remove the blue color, the widgets would just disappear on the line like how it is with color.
I tried to use WidgetMask and ClipPath but it didn't work like in the example.
Any idea on how to solve this?
I'm using CustomPaint to make a custom shape and I want to apply a color gradient but with hard color stops. Without color transitions.
PS:I cannot use different Paints instead of gradient because of the custom shape.
I checked the documentation and couldn't find anything. Is it impossible? Or is there any other workarounds? Thanks!
You could split your custom shape in smaller shapes and give each one its correct color. That would be one way to do it.
I have another idea. You could do it like so: Give the complete canvas of you custom paint a color, the color of your application's background. Give your custom shape Colors.transparent as its color. Then you make as many containers with the colors you want to have and put them below each other so that there overall size matches the size of your custom paint. You stack the custom paint onto these containers using Stack Widget and your custom shape will take the colors of these containers because its color is transparent. While the surrounding of your custom shape will have the color of the background of your application, because the whole custom paint is colored that way.
Okay I figured it out myself, I use Gradient.linear as the shader for custom paint. I noticed that it only blends colors when there is a big gap in stops. So I put my colors and stops like this.
Colors | Stop
Green 0.2
Green 0.201
Blue 0.5
Blue 0.501
Yellow 1
Now the color stops are hard.
Here's a preview of before and after |
Goal
In flutter how can I have edges around a card, container, material; that aren't fully wrapping, or aren't just one side?
Goal: To achieve a border based on the values between 0 and 1.
Example: https://imgur.com/a/fhrKboE
Possible Solution 1
Flutter | How to draw custom borders around a widget / inside a Container
Create a custom border that activates sides based on progress using the border width based on percentage.
Possible Solution 2
how to draw a custom flutter border like this?
Add A Custom Decoration To Container, Using Painter Class
How to create a custom border for container in Flutter?
Create a custom painter. This would probably be more efficient if I also want to animate the progress bar.
I want a CustomScollView with flexible Header where the items while scrolling vanish/appear smoothlyt by overlaying the top and bottom limit of the SliverList with a gradient that ranges from transparent to the color of the rest of the page.
Like in the this schematic layout.
At the bottom this was possible without any problems by placing the Container with the gradient inside a Stack with overlap=true and positioning it outside the Stack.
I tried the same inside the SliverAppBar's flexiSpace but it did not allow that the gradient container overlapped its limits instead it was clipped.
Is there an easy way to accomplish it? I found a solution by using a Stack around everything and position the gradient container there by listening to the moving of the flexispace but that seems a bit cumbersome.