Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill closed Polyline with different color than border #972

Closed
S-Man42 opened this issue Jul 18, 2021 · 23 comments
Closed

Fill closed Polyline with different color than border #972

S-Man42 opened this issue Jul 18, 2021 · 23 comments
Labels
feature This issue requests a new feature P: ∞ (won't add) This feature request won't be implemented

Comments

@S-Man42
Copy link

S-Man42 commented Jul 18, 2021

In Polyline options you can insert both, color and borderColor. So, I guess, it should be possible to enter different colors for the outline and the filling, correct? However, this seems not work:

  1. When entering both: color is taken as outline color. No filling, borderColor is ignored.

Is it possible to

  1. Fill the closed polyline
  2. Make the color different to its border?
@JaffaKetchup
Copy link
Member

Can you just use a PolygonLayerOptions? That fill and border can be different colours.

@S-Man42
Copy link
Author

S-Man42 commented Jul 23, 2021

Hi,

I cannot see, that the PolygonLayerOptions itself has a color attribute, but Polygon of course.

Unfortunately I have no polygons, but polylines (some of them are closed, which, of course, makes them a polygon: These are the ones I want to fill).

Moreover, as far as I can see, Polygon and Polyline have the same set of options when it comes to colors:

  final Color color;
  final double borderStrokeWidth;
  final Color? borderColor;

Why should Polygons act differently here?

I need the Polylines, because I need them tappable (adding a Tap Listener), which is done but the plugin flutter_map_tappable_polyline. So I am trying to achive this for Polylines, and it's not clear to me, why there are different color options, but they do not work as I expect it.

@JaffaKetchup
Copy link
Member

I'm not sure. Try increasing the stroke width of your polyline? It could be that color is actually a fill color of the line, and border color is a color of the line's border?

@S-Man42
Copy link
Author

S-Man42 commented Jul 23, 2021

Hm this might be, actually. However, that wouldn't solve my probleme anyway. I need to fill closed area created by a polyline.

@JaffaKetchup
Copy link
Member

In that case you'll need to use Polygon. I'm not sure how you can get a tap listener, however.

@JaffaKetchup
Copy link
Member

Please see #968 for an issue of adding tap handlers to polygons.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Aug 31, 2021
@Birdy2404
Copy link

We would still be interessted in this topic.

@github-actions github-actions bot removed the Stale label Sep 2, 2021
@github-actions
Copy link

github-actions bot commented Oct 2, 2021

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 2, 2021
@S-Man42
Copy link
Author

S-Man42 commented Oct 2, 2021

Still requested

@github-actions github-actions bot removed the Stale label Oct 3, 2021
@cuuycuyy
Copy link

Well, i run into this problem too. i want to add fill color to my closed polyline

@ibrierley
Copy link
Collaborator

How are you drawing your closed polyline ?

@S-Man42
Copy link
Author

S-Man42 commented Oct 23, 2021

Drawing a polyline which includes twice the same point (with at least two points inbetween to create a real shape).

@ibrierley
Copy link
Collaborator

Just pondering, I suspect there's a few issues around this. Sorry it's a bit rambly, just thinking out loud...

Firstly, I'm guessing (but may be wrong), the paths aren't truly closed, and just have a duplicate start/end point (as I don't think there's any current way to specify a polyline is closed)?

There is no area fill for polylines to my understanding (again I may be wrong), so this would never work. However, I think it wouldn't be impossible to add a true "close" option for the polyline, and internally make sure the path is closed.

What's not very clear (to me) is what the intention of the current polyline color options are...ie you currently almost seem to fill the line (rather than area) in, and changing that may break some peoples implementations. So would a 3rd colour option be needed, or reuse the main one.
If anyone knows the correct interpretation of what "should" happen here, it would be useful.

Then there's the issue of the click handler (assuming not using the other tap plugin, which may be the best solution). Let's say you have 3 overlapping poly(line/gons) or layers, I'm guessing the topmost poly should have the click...so I'm guessing all the handlers (and layers) would need to be tied together somehow to traverse through ? I'm guessing there's none of that in flutter_map already ?

If there was a click handler somehow, it would probably remove the need for a filled area polyline (as you'd just use a polygon) ? So wondering if thats actually the main issue.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Nov 23, 2021
@S-Man42
Copy link
Author

S-Man42 commented Nov 23, 2021

Still required

@github-actions github-actions bot removed the Stale label Nov 24, 2021
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Dec 24, 2021
@Birdy2404
Copy link

This topic is still interesting for US.

@github-actions github-actions bot removed the Stale label Dec 25, 2021
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jan 24, 2022
@S-Man42
Copy link
Author

S-Man42 commented Jan 24, 2022

still interested

@github-actions github-actions bot removed the Stale label Jan 25, 2022
@JaffaKetchup JaffaKetchup changed the title How to fill closed Polyline with different color than border Fill closed Polyline with different color than border Feb 8, 2022
@JaffaKetchup JaffaKetchup added feature This issue requests a new feature help wanted labels Feb 8, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 11, 2022
@S-Man42
Copy link
Author

S-Man42 commented Mar 11, 2022

still interested

@github-actions github-actions bot removed the Stale label Mar 12, 2022
@JaffaKetchup
Copy link
Member

I'm going to close this now. For this use-case, a polygon with tap detection would be more appropriate. Please see #385 for the latest discussions on this - hopefully something can be done sooner rather than later.
Thanks for raising. Let me know if you think this shouldn't be closed in favour of that issue, and I will reconsider.

@JaffaKetchup JaffaKetchup added P: ∞ (won't add) This feature request won't be implemented and removed help wanted labels Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature P: ∞ (won't add) This feature request won't be implemented
Projects
None yet
Development

No branches or pull requests

5 participants